diff --git a/api/config/bundles.php b/api/config/bundles.php index 0b350522..4f75440e 100644 --- a/api/config/bundles.php +++ b/api/config/bundles.php @@ -1,20 +1,20 @@ ['all' => true], - Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true], - Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], - Symfony\Bundle\MercureBundle\MercureBundle::class => ['all' => true], - Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], - Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], - ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true], - Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true], - Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true], - Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], - Conduction\CommonGroundBundle\CommonGroundBundle::class => ['all' => true], - Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true], + Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], + Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true], + Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], + Symfony\Bundle\MercureBundle\MercureBundle::class => ['all' => true], + Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], + Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], + ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true], + Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true], + Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true], + Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], + Conduction\CommonGroundBundle\CommonGroundBundle::class => ['all' => true], + Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true], Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true], - Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['all' => true], - Tbbc\MoneyBundle\TbbcMoneyBundle::class => ['all' => true], - Knp\Bundle\MarkdownBundle\KnpMarkdownBundle::class => ['all' => true], + Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['all' => true], + Tbbc\MoneyBundle\TbbcMoneyBundle::class => ['all' => true], + Knp\Bundle\MarkdownBundle\KnpMarkdownBundle::class => ['all' => true], ]; diff --git a/api/src/Command/ApiHelmCommand.php b/api/src/Command/ApiHelmCommand.php index 0caa16f6..72c6793c 100644 --- a/api/src/Command/ApiHelmCommand.php +++ b/api/src/Command/ApiHelmCommand.php @@ -65,9 +65,9 @@ protected function execute(InputInterface $input, OutputInterface $output) } else { // outputs multiple lines to the console (adding "\n" at the end of each line) $output->writeln([ - 'Helm Chart Creator', - '============', - $chart, + 'Helm Chart Creator', + '============', + $chart, ]); } } diff --git a/api/src/Command/PubliccodeCommand.php b/api/src/Command/PubliccodeCommand.php index 75c24371..1ff5e1fe 100644 --- a/api/src/Command/PubliccodeCommand.php +++ b/api/src/Command/PubliccodeCommand.php @@ -57,14 +57,14 @@ protected function execute(InputInterface $input, OutputInterface $output) $publiccode = $this->twig->render('publiccode/publiccode.yaml.twig'); if (!empty($location = $input->getOption('location')) && \is_string($location)) { - file_put_contents($location.'/publiccode.yaml', $publiccode); + file_put_contents($location.'/publiccode.yaml', $publiccode); $io->success(sprintf('Data written to %s/publiccode.yaml (specification version %s).', $location, $version)); } else { // outputs multiple lines to the console (adding "\n" at the end of each line) $output->writeln([ - 'Publiccode Chart', - '============', - $chart, + 'Publiccode Chart', + '============', + $chart, ]); } } diff --git a/api/src/DataFixtures/AppFixtures.php b/api/src/DataFixtures/AppFixtures.php index ae700c80..bf42ae33 100644 --- a/api/src/DataFixtures/AppFixtures.php +++ b/api/src/DataFixtures/AppFixtures.php @@ -2,349 +2,345 @@ namespace App\DataFixtures; +use App\Entity\Property; +use App\Entity\RequestType; use Doctrine\Bundle\FixturesBundle\Fixture; use Doctrine\Common\Persistence\ObjectManager; - use Ramsey\Uuid\Uuid; -use App\Entity\RequestType; -use App\Entity\Property; - class AppFixtures extends Fixture { public function load(ObjectManager $manager) { - /* - * Verhuizen + /* + * Verhuizen */ - $id = Uuid::fromString('2bfb3cea-b5b5-459c-b3e0-e1100089a11a'); - - $verhuizenNL = new RequestType(); - $verhuizenNL->setId($id); - $verhuizenNL->setSourceOrganization('0000'); - $verhuizenNL->setName('Verhuizen'); - $verhuizenNL->setDescription('Het doorgeven van een verhuizing aan een gemeente'); - $manager->persist($verhuizenNL); - - $property= new Property(); - //$property->setId(''); - $property->setTitle('Datum'); - $property->setType('string'); - $property->setFormat('date'); - $property->setDescription('Wat is de verhuisdatum?'); - $property->setRequestType($verhuizenNL); - $manager->persist($property); - - $property= new Property(); - //$property->setId(''); - $property->setTitle('Adress'); - $property->setType('string'); - $property->setFormat('bag'); - $property->setRequired(true); - $property->setDescription('Wat is het nieuwe adres?'); - $property->setRequestType($verhuizenNL); - $manager->persist($property); - - $property= new Property(); - //$property->setId(''); - $property->setTitle('Wie'); - $property->setType('array'); - $property->setFormat('bsn'); - $property->setRequired(true); - $property->setDescription('Wie gaan er verhuizen?'); - $property->setRequestType($verhuizenNL); - $manager->persist($property); - - $id = Uuid::fromString('9d76fb58-0711-4437-acc4-9f4d9d403cdf'); - $verhuizenDenBosh = new RequestType(); - $verhuizenDenBosh->setName('Verhuizen'); - $verhuizenDenBosh->setDescription('Het doorgeven van een verhuizing aan de gemeente \'s-Hertogenbosch'); - $verhuizenDenBosh->setSourceOrganization('001709124'); - $verhuizenDenBosh->setExtends($verhuizenNL); - $manager->persist($verhuizenDenBosh); - $verhuizenDenBosh->setId($id); - $manager->persist($verhuizenDenBosh); - - - $property = new Property(); - //$verhuizenNL->setId(''); - $property->setTitle('Email'); - $property->setDescription('Het e-mail addres dat wordt gebruikt om contact op te nemen (indien nodig) over deze verhuizing'); - $property->setType('string'); - $property->setFormat('email'); - $property->setRequired(true); - $property->setRequestType($verhuizenNL); - $manager->persist($property); - - - $property = new Property(); - //$verhuizenNL->setId(''); - $property->setTitle('Telefoon'); - $property->setDescription('Het telefoon nummer dat wordt gebruikt om contact op te nemen (indien nodig) over deze verhuizing'); - $property->setType('string'); - $property->setFormat('string'); - $property->setRequired(true); - $property->setRequestType($verhuizenNL); - $manager->persist($property); - - $verhuizenEindhoven = new RequestType(); - //$verhuizenEindhoven->setId('fc79c4c9-b3b3-4258-bdbb-449262f3e5d7'); - $verhuizenEindhoven->setName('Verhuizen'); - $verhuizenEindhoven->setDescription('Het doorgeven van een verhuizing aan de gemeente Eindhoven'); - $verhuizenEindhoven->setSourceOrganization('001902763'); - $verhuizenEindhoven->setExtends($verhuizenNL); - $manager->persist($verhuizenEindhoven); - - $property = new Property(); - //$verhuizenNL->setId(''); - $property->setTitle('Eigenaar'); - $property->setDescription('Bent u de eigenaar van de woning waar u heen verhuist?'); - $property->setType('boolean'); - $property->setFormat('boolean'); - $property->setRequired(true); - $property->setRequestType($verhuizenNL); - $manager->persist($property); - - $property = new Property(); - //$verhuizenNL->setId(''); - $property->setTitle('Doorgeven gegevens'); - $property->setDescription('Wilt u dat we uw verhuizing ook doorgeven aan postNl?'); - $property->setType('boolean'); - $property->setFormat('boolean'); - $property->setRequestType($verhuizenNL); - $manager->persist($property); - - /* + $id = Uuid::fromString('2bfb3cea-b5b5-459c-b3e0-e1100089a11a'); + + $verhuizenNL = new RequestType(); + $verhuizenNL->setId($id); + $verhuizenNL->setSourceOrganization('0000'); + $verhuizenNL->setName('Verhuizen'); + $verhuizenNL->setDescription('Het doorgeven van een verhuizing aan een gemeente'); + $manager->persist($verhuizenNL); + + $property = new Property(); + //$property->setId(''); + $property->setTitle('Datum'); + $property->setType('string'); + $property->setFormat('date'); + $property->setDescription('Wat is de verhuisdatum?'); + $property->setRequestType($verhuizenNL); + $manager->persist($property); + + $property = new Property(); + //$property->setId(''); + $property->setTitle('Adress'); + $property->setType('string'); + $property->setFormat('bag'); + $property->setRequired(true); + $property->setDescription('Wat is het nieuwe adres?'); + $property->setRequestType($verhuizenNL); + $manager->persist($property); + + $property = new Property(); + //$property->setId(''); + $property->setTitle('Wie'); + $property->setType('array'); + $property->setFormat('bsn'); + $property->setRequired(true); + $property->setDescription('Wie gaan er verhuizen?'); + $property->setRequestType($verhuizenNL); + $manager->persist($property); + + $id = Uuid::fromString('9d76fb58-0711-4437-acc4-9f4d9d403cdf'); + $verhuizenDenBosh = new RequestType(); + $verhuizenDenBosh->setName('Verhuizen'); + $verhuizenDenBosh->setDescription('Het doorgeven van een verhuizing aan de gemeente \'s-Hertogenbosch'); + $verhuizenDenBosh->setSourceOrganization('001709124'); + $verhuizenDenBosh->setExtends($verhuizenNL); + $manager->persist($verhuizenDenBosh); + $verhuizenDenBosh->setId($id); + $manager->persist($verhuizenDenBosh); + + $property = new Property(); + //$verhuizenNL->setId(''); + $property->setTitle('Email'); + $property->setDescription('Het e-mail addres dat wordt gebruikt om contact op te nemen (indien nodig) over deze verhuizing'); + $property->setType('string'); + $property->setFormat('email'); + $property->setRequired(true); + $property->setRequestType($verhuizenNL); + $manager->persist($property); + + $property = new Property(); + //$verhuizenNL->setId(''); + $property->setTitle('Telefoon'); + $property->setDescription('Het telefoon nummer dat wordt gebruikt om contact op te nemen (indien nodig) over deze verhuizing'); + $property->setType('string'); + $property->setFormat('string'); + $property->setRequired(true); + $property->setRequestType($verhuizenNL); + $manager->persist($property); + + $verhuizenEindhoven = new RequestType(); + //$verhuizenEindhoven->setId('fc79c4c9-b3b3-4258-bdbb-449262f3e5d7'); + $verhuizenEindhoven->setName('Verhuizen'); + $verhuizenEindhoven->setDescription('Het doorgeven van een verhuizing aan de gemeente Eindhoven'); + $verhuizenEindhoven->setSourceOrganization('001902763'); + $verhuizenEindhoven->setExtends($verhuizenNL); + $manager->persist($verhuizenEindhoven); + + $property = new Property(); + //$verhuizenNL->setId(''); + $property->setTitle('Eigenaar'); + $property->setDescription('Bent u de eigenaar van de woning waar u heen verhuist?'); + $property->setType('boolean'); + $property->setFormat('boolean'); + $property->setRequired(true); + $property->setRequestType($verhuizenNL); + $manager->persist($property); + + $property = new Property(); + //$verhuizenNL->setId(''); + $property->setTitle('Doorgeven gegevens'); + $property->setDescription('Wilt u dat we uw verhuizing ook doorgeven aan postNl?'); + $property->setType('boolean'); + $property->setFormat('boolean'); + $property->setRequestType($verhuizenNL); + $manager->persist($property); + + /* * Trouwen */ - $meldingTrouwenNL= new RequestType(); - //$meldingTrouwenNL->setId('d009032d-8fdd-4d09-bf43-5000f19737a7'); - $meldingTrouwenNL->setSourceOrganization('0000'); - $meldingTrouwenNL->setName('Melding voorgenomen huwelijk'); - $meldingTrouwenNL->setDescription('Melding voorgenomen huwelijk'); - - $property= new Property(); - //$verhuizenNL->setId(''); - $property->setTitle('Partner1'); - $property->setType('string'); - $property->setFormat('bsn'); - $property->setRequired(true); - $property->setDescription('Welke partners willen hun partnerschap omzetten?'); - $property->setRequestType($meldingTrouwenNL); - $manager->persist($property); - - $property= new Property(); - //$verhuizenNL->setId(''); - $property->setTitle('Partner2'); - $property->setType('string'); - $property->setFormat('bsn'); - $property->setRequired(true); - $property->setDescription('Welke partners willen hun partnerschap omzetten?'); - $property->setRequestType($meldingTrouwenNL); - $manager->persist($property); - - $omzettingNL = new RequestType(); - //$omzettingNL->setId('dc65cbe9-d608-4946-b3d4-368b5b0c4061'); - $omzettingNL->setSourceOrganization('0000'); - $omzettingNL->setName('Omzetting'); - $omzettingNL->setDescription('Het omzetten van een bestaand partnerschap in een huwelijk.'); - $manager->persist($omzettingNL); - - $property= new Property(); - //$verhuizenNL->setId(''); - $property->setTitle('Ingangsdatum'); - $property->setType('string'); - $property->setFormat('date'); - $property->setDescription('Wat is de datum voor de omzetting naar huwelijk?'); - $property->setRequestType($verhuizenNL); - $manager->persist($property); - - $property= new Property(); - //$verhuizenNL->setId(''); - $property->setTitle('Partner1'); - $property->setType('string'); - $property->setFormat('bsn'); - $property->setRequired(true); - $property->setDescription('Welke partners willen hun partnerschap omzetten'); - $property->setRequestType($omzettingNL); - $manager->persist($property); - - $property= new Property(); - //$verhuizenNL->setId(''); - $property->setTitle('Partner 2'); - $property->setType('string'); - $property->setFormat('bsn'); - $property->setRequired(true); - $property->setDescription('Welke partners willen hun partnerschap omzetten'); - $property->setRequestType($omzettingNL); - $manager->persist($property); - - $id = Uuid::fromString('5b10c1d6-7121-4be2-b479-7523f1b625f1'); - $trouwenNL = new RequestType(); - $trouwenNL->setSourceOrganization('000'); - $trouwenNL->setName('Huwelijk / Partnerschap'); - $trouwenNL->setDescription('Huwelijk / Partnerschap'); - $manager->persist($trouwenNL); - $trouwenNL->setId($id); - $manager->persist($trouwenNL); - $manager->flush(); - $trouwenNL= $manager->getRepository('App:RequestType')->findOneBy(array('id'=> $id)); - - $stage1= new Property(); - $stage1->setStart(true); - $stage1->setTitle('Type'); - $stage1->setIcon('fas fa-ring'); - $stage1->setSlug('ceremonies'); - $stage1->setType('string'); - $stage1->setFormat('strin'); - $stage1->setMaxLength('12'); - $stage1->setMinLength('7'); - $stage1->setEnum(['trouwen','partnerschap','omzetten']); - $stage1->setRequired(true); - $stage1->setDescription('Selecteer een huwelijk of partnerschap?'); - $stage1->setRequestType($trouwenNL); - $manager->persist($stage1); - - $stage2= new Property(); - $stage2->addPrevious($stage1); - $stage2->setTitle('Partners'); - $stage2->setIcon('fas fa-user-friends'); - $stage2->setSlug('partners'); - $stage2->setType('array'); - $stage2->setFormat('bsn'); - $stage2->setMinItems(2); - $stage2->setMaxItems(2); - $stage2->setRequired(true); - $stage2->setDescription('Wie zijn de getuigen van partner 2?'); - $stage2->setRequestType($trouwenNL); - $manager->persist($stage2); - - $stage3= new Property(); - $stage3->addPrevious($stage2); - $stage3->setTitle('Plechtigheid '); - $stage3->setIcon('fas fa-glass-cheers'); - $stage3->setSlug('plechtigheid'); - $stage3->setType('string'); - $stage3->setFormat('uri'); - $stage3->setDescription('Onder welke uri kunnen we de bestaande \'melding voorgenomen huwelijk\' terugvinden?'); - $stage3->setRequestType($trouwenNL); - $manager->persist($stage3); - - $stage4= new Property(); - $stage4->addPrevious($stage3); - $stage4->setTitle('Datum'); - $stage4->setIcon('fas fa-calendar-day'); - $stage4->setSlug('datum'); - $stage4->setType('string'); - $stage4->setFormat('date'); - $stage4->setDescription('Selecteer een datum voor de omzetting naar huwelijk'); - $stage4->setRequestType($trouwenNL); - $manager->persist($stage4); - - $stage5= new Property(); - $stage5->addPrevious($stage4); - $stage5->setTitle('Locatie'); - $stage5->setIcon('fas fa-building'); - $stage5->setSlug('locaties'); - $stage5->setType('string'); - $stage5->setFormat('uri'); - $stage5->setMaxLength('255'); - $stage5->setRequired(true); - $stage5->setDescription('We gebruiken de order om de bestelling (bestaande uit locatie, ambtenaar en eventuele extra\'s) op te slaan'); - $stage5->setRequestType($trouwenNL); - $manager->persist($stage5); - - $stage6= new Property(); - $stage6->addPrevious($stage5); - $stage6->setTitle('Ambtenaar'); - $stage6->setIcon('fas fa-user-tie'); - $stage6->setSlug('ambtenaren'); - $stage6->setType('string'); - $stage6->setFormat('uri'); - $stage6->setMaxLength('255'); - $stage6->setRequired(true); - $stage6->setDescription('We gebruiken de order om de bestelling (bestaande uit locatie, ambtenaar en eventuele extra\'s) op te slaan'); - $stage6->setRequestType($trouwenNL); - $manager->persist($stage6); - - $stage7= new Property(); - $stage7->addPrevious($stage6); - $stage7->setTitle('Getuigen'); - $stage7->setIcon('fas fa-users'); - $stage7->setSlug('getuigen'); - $stage7->setType('array'); - $stage7->setFormat('bsn'); - $stage7->setMinItems(2); - $stage7->setMaxItems(4); - $stage7->setRequired(true); - $stage7->setDescription('Wie zijn de getuigen van partner?'); - $stage7->setRequestType($trouwenNL); - $manager->persist($stage7); - - $stage8= new Property(); - $stage8->addPrevious($stage7); - $stage8->setTitle('Extras'); - $stage8->setIcon('fas fa-gift'); - $stage8->setSlug('extras'); - $stage8->setType('array'); - $stage8->setFormat('bsn'); - $stage8->setRequired(true); - $stage8->setDescription('Wie zijn de getuigen van partner?'); - $stage8->setRequestType($trouwenNL); - $manager->persist($stage8); - - $stage9= new Property(); - $stage9->addPrevious($stage8); - $stage9->setTitle('Melding '); - $stage9->setIcon('fas fa-envelope'); - $stage9->setSlug('melding'); - $stage9->setType('string'); - $stage9->setFormat('uri'); - $stage9->setDescription('Onder welke uri kunnen we de bestaande \'melding voorgenomen huwelijk\' terugvinden?'); - $stage9->setRequestType($trouwenNL); - $manager->persist($stage9); - - $stage10= new Property(); - $stage10->addPrevious($stage9); - $stage10->setTitle('Betalen '); - $stage10->setIcon('fas fa-cash-register'); - $stage10->setSlug('betalen'); - $stage10->setType('string'); - $stage10->setFormat('uri'); - $stage10->setDescription('Onder welke uri kunnen we de bestaande \'melding voorgenomen huwelijk\' terugvinden?'); - $stage10->setRequestType($trouwenNL); - $manager->persist($stage10); - - $stage11= new Property(); - $stage11->addPrevious($stage10); - $stage11->setTitle('Reserveren '); - $stage11->setIcon('fas fa-calendar-check'); - $stage11->setSlug('checklist'); - $stage11->setDescription('Onder welke uri kunnen we de bestaande \'melding voorgenomen huwelijk\' terugvinden?'); - $stage11->setRequestType($trouwenNL); - $manager->persist($stage11); - - $property= new Property(); - //$property->setId(''); - $property->setTitle('Order'); - $property->setType('string'); - $property->setFormat('uri'); - $property->setMaxLength('255'); - $property->setRequired(true); - $property->setDescription('We gebruiken de order om de bestelling (bestaande uit locatie, ambtenaar en eventuele extra\'s) op te slaan'); - $property->setRequestType($trouwenNL); - $manager->persist($property); - - $id = Uuid::fromString('47577f44-0ede-4655-a629-027f051d2b07'); - $trouwenUtrecht = new RequestType(); - $trouwenUtrecht->setExtends($trouwenNL); - $trouwenUtrecht->setSourceOrganization('002220647'); - $trouwenUtrecht->setName('Trouwen of Partnerschap in Utrecht'); - $trouwenUtrecht->setDescription('Trouwen of Partnerschap in Utrecht'); - $manager->persist($trouwenUtrecht); - $trouwenUtrecht->setId($id); - $manager->persist($trouwenUtrecht); - - $manager->flush(); + $meldingTrouwenNL = new RequestType(); + //$meldingTrouwenNL->setId('d009032d-8fdd-4d09-bf43-5000f19737a7'); + $meldingTrouwenNL->setSourceOrganization('0000'); + $meldingTrouwenNL->setName('Melding voorgenomen huwelijk'); + $meldingTrouwenNL->setDescription('Melding voorgenomen huwelijk'); + + $property = new Property(); + //$verhuizenNL->setId(''); + $property->setTitle('Partner1'); + $property->setType('string'); + $property->setFormat('bsn'); + $property->setRequired(true); + $property->setDescription('Welke partners willen hun partnerschap omzetten?'); + $property->setRequestType($meldingTrouwenNL); + $manager->persist($property); + + $property = new Property(); + //$verhuizenNL->setId(''); + $property->setTitle('Partner2'); + $property->setType('string'); + $property->setFormat('bsn'); + $property->setRequired(true); + $property->setDescription('Welke partners willen hun partnerschap omzetten?'); + $property->setRequestType($meldingTrouwenNL); + $manager->persist($property); + + $omzettingNL = new RequestType(); + //$omzettingNL->setId('dc65cbe9-d608-4946-b3d4-368b5b0c4061'); + $omzettingNL->setSourceOrganization('0000'); + $omzettingNL->setName('Omzetting'); + $omzettingNL->setDescription('Het omzetten van een bestaand partnerschap in een huwelijk.'); + $manager->persist($omzettingNL); + + $property = new Property(); + //$verhuizenNL->setId(''); + $property->setTitle('Ingangsdatum'); + $property->setType('string'); + $property->setFormat('date'); + $property->setDescription('Wat is de datum voor de omzetting naar huwelijk?'); + $property->setRequestType($verhuizenNL); + $manager->persist($property); + + $property = new Property(); + //$verhuizenNL->setId(''); + $property->setTitle('Partner1'); + $property->setType('string'); + $property->setFormat('bsn'); + $property->setRequired(true); + $property->setDescription('Welke partners willen hun partnerschap omzetten'); + $property->setRequestType($omzettingNL); + $manager->persist($property); + + $property = new Property(); + //$verhuizenNL->setId(''); + $property->setTitle('Partner 2'); + $property->setType('string'); + $property->setFormat('bsn'); + $property->setRequired(true); + $property->setDescription('Welke partners willen hun partnerschap omzetten'); + $property->setRequestType($omzettingNL); + $manager->persist($property); + + $id = Uuid::fromString('5b10c1d6-7121-4be2-b479-7523f1b625f1'); + $trouwenNL = new RequestType(); + $trouwenNL->setSourceOrganization('000'); + $trouwenNL->setName('Huwelijk / Partnerschap'); + $trouwenNL->setDescription('Huwelijk / Partnerschap'); + $manager->persist($trouwenNL); + $trouwenNL->setId($id); + $manager->persist($trouwenNL); + $manager->flush(); + $trouwenNL = $manager->getRepository('App:RequestType')->findOneBy(['id'=> $id]); + + $stage1 = new Property(); + $stage1->setStart(true); + $stage1->setTitle('Type'); + $stage1->setIcon('fas fa-ring'); + $stage1->setSlug('ceremonies'); + $stage1->setType('string'); + $stage1->setFormat('strin'); + $stage1->setMaxLength('12'); + $stage1->setMinLength('7'); + $stage1->setEnum(['trouwen', 'partnerschap', 'omzetten']); + $stage1->setRequired(true); + $stage1->setDescription('Selecteer een huwelijk of partnerschap?'); + $stage1->setRequestType($trouwenNL); + $manager->persist($stage1); + + $stage2 = new Property(); + $stage2->addPrevious($stage1); + $stage2->setTitle('Partners'); + $stage2->setIcon('fas fa-user-friends'); + $stage2->setSlug('partners'); + $stage2->setType('array'); + $stage2->setFormat('bsn'); + $stage2->setMinItems(2); + $stage2->setMaxItems(2); + $stage2->setRequired(true); + $stage2->setDescription('Wie zijn de getuigen van partner 2?'); + $stage2->setRequestType($trouwenNL); + $manager->persist($stage2); + + $stage3 = new Property(); + $stage3->addPrevious($stage2); + $stage3->setTitle('Plechtigheid '); + $stage3->setIcon('fas fa-glass-cheers'); + $stage3->setSlug('plechtigheid'); + $stage3->setType('string'); + $stage3->setFormat('uri'); + $stage3->setDescription('Onder welke uri kunnen we de bestaande \'melding voorgenomen huwelijk\' terugvinden?'); + $stage3->setRequestType($trouwenNL); + $manager->persist($stage3); + + $stage4 = new Property(); + $stage4->addPrevious($stage3); + $stage4->setTitle('Datum'); + $stage4->setIcon('fas fa-calendar-day'); + $stage4->setSlug('datum'); + $stage4->setType('string'); + $stage4->setFormat('date'); + $stage4->setDescription('Selecteer een datum voor de omzetting naar huwelijk'); + $stage4->setRequestType($trouwenNL); + $manager->persist($stage4); + + $stage5 = new Property(); + $stage5->addPrevious($stage4); + $stage5->setTitle('Locatie'); + $stage5->setIcon('fas fa-building'); + $stage5->setSlug('locaties'); + $stage5->setType('string'); + $stage5->setFormat('uri'); + $stage5->setMaxLength('255'); + $stage5->setRequired(true); + $stage5->setDescription('We gebruiken de order om de bestelling (bestaande uit locatie, ambtenaar en eventuele extra\'s) op te slaan'); + $stage5->setRequestType($trouwenNL); + $manager->persist($stage5); + + $stage6 = new Property(); + $stage6->addPrevious($stage5); + $stage6->setTitle('Ambtenaar'); + $stage6->setIcon('fas fa-user-tie'); + $stage6->setSlug('ambtenaren'); + $stage6->setType('string'); + $stage6->setFormat('uri'); + $stage6->setMaxLength('255'); + $stage6->setRequired(true); + $stage6->setDescription('We gebruiken de order om de bestelling (bestaande uit locatie, ambtenaar en eventuele extra\'s) op te slaan'); + $stage6->setRequestType($trouwenNL); + $manager->persist($stage6); + + $stage7 = new Property(); + $stage7->addPrevious($stage6); + $stage7->setTitle('Getuigen'); + $stage7->setIcon('fas fa-users'); + $stage7->setSlug('getuigen'); + $stage7->setType('array'); + $stage7->setFormat('bsn'); + $stage7->setMinItems(2); + $stage7->setMaxItems(4); + $stage7->setRequired(true); + $stage7->setDescription('Wie zijn de getuigen van partner?'); + $stage7->setRequestType($trouwenNL); + $manager->persist($stage7); + + $stage8 = new Property(); + $stage8->addPrevious($stage7); + $stage8->setTitle('Extras'); + $stage8->setIcon('fas fa-gift'); + $stage8->setSlug('extras'); + $stage8->setType('array'); + $stage8->setFormat('bsn'); + $stage8->setRequired(true); + $stage8->setDescription('Wie zijn de getuigen van partner?'); + $stage8->setRequestType($trouwenNL); + $manager->persist($stage8); + + $stage9 = new Property(); + $stage9->addPrevious($stage8); + $stage9->setTitle('Melding '); + $stage9->setIcon('fas fa-envelope'); + $stage9->setSlug('melding'); + $stage9->setType('string'); + $stage9->setFormat('uri'); + $stage9->setDescription('Onder welke uri kunnen we de bestaande \'melding voorgenomen huwelijk\' terugvinden?'); + $stage9->setRequestType($trouwenNL); + $manager->persist($stage9); + + $stage10 = new Property(); + $stage10->addPrevious($stage9); + $stage10->setTitle('Betalen '); + $stage10->setIcon('fas fa-cash-register'); + $stage10->setSlug('betalen'); + $stage10->setType('string'); + $stage10->setFormat('uri'); + $stage10->setDescription('Onder welke uri kunnen we de bestaande \'melding voorgenomen huwelijk\' terugvinden?'); + $stage10->setRequestType($trouwenNL); + $manager->persist($stage10); + + $stage11 = new Property(); + $stage11->addPrevious($stage10); + $stage11->setTitle('Reserveren '); + $stage11->setIcon('fas fa-calendar-check'); + $stage11->setSlug('checklist'); + $stage11->setDescription('Onder welke uri kunnen we de bestaande \'melding voorgenomen huwelijk\' terugvinden?'); + $stage11->setRequestType($trouwenNL); + $manager->persist($stage11); + + $property = new Property(); + //$property->setId(''); + $property->setTitle('Order'); + $property->setType('string'); + $property->setFormat('uri'); + $property->setMaxLength('255'); + $property->setRequired(true); + $property->setDescription('We gebruiken de order om de bestelling (bestaande uit locatie, ambtenaar en eventuele extra\'s) op te slaan'); + $property->setRequestType($trouwenNL); + $manager->persist($property); + + $id = Uuid::fromString('47577f44-0ede-4655-a629-027f051d2b07'); + $trouwenUtrecht = new RequestType(); + $trouwenUtrecht->setExtends($trouwenNL); + $trouwenUtrecht->setSourceOrganization('002220647'); + $trouwenUtrecht->setName('Trouwen of Partnerschap in Utrecht'); + $trouwenUtrecht->setDescription('Trouwen of Partnerschap in Utrecht'); + $manager->persist($trouwenUtrecht); + $trouwenUtrecht->setId($id); + $manager->persist($trouwenUtrecht); + + $manager->flush(); } } diff --git a/api/src/Entity/Property.php b/api/src/Entity/Property.php index 7bfcfb65..bf75ff87 100644 --- a/api/src/Entity/Property.php +++ b/api/src/Entity/Property.php @@ -2,27 +2,20 @@ namespace App\Entity; -use ApiPlatform\Core\Annotation\ApiProperty; use ApiPlatform\Core\Annotation\ApiResource; -use ApiPlatform\Core\Annotation\ApiFilter; -use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; -use Gedmo\Mapping\Annotation as Gedmo; use Doctrine\ORM\Mapping as ORM; use Ramsey\Uuid\UuidInterface; use Symfony\Component\Serializer\Annotation\Groups; -use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Serializer\Annotation\MaxDepth; - - -use App\Entity\RequestType; +use Symfony\Component\Validator\Constraints as Assert; /** * This property follows the following schemes (in order of importance) * https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md * https://tools.ietf.org/html/draft-wright-json-schema-validation-00 - * http://json-schema.org/ + * http://json-schema.org/. * * @ApiResource( * normalizationContext={"groups"={"read"}, "enable_max_depth"=true}, @@ -32,22 +25,23 @@ */ class Property { - /** - * @var UuidInterface $id The UUID identifier of this object - * @example e2984465-190a-4562-829e-a8cca81aa35d - * + /** + * @var UuidInterface The UUID identifier of this object + * + * @example e2984465-190a-4562-829e-a8cca81aa35d + * * @Groups({"read"}) - * @Assert\Uuid - * @ORM\Id - * @ORM\Column(type="uuid", unique=true) - * @ORM\GeneratedValue(strategy="CUSTOM") - * @ORM\CustomIdGenerator(class="Ramsey\Uuid\Doctrine\UuidGenerator") - */ - private $id; + * @Assert\Uuid + * @ORM\Id + * @ORM\Column(type="uuid", unique=true) + * @ORM\GeneratedValue(strategy="CUSTOM") + * @ORM\CustomIdGenerator(class="Ramsey\Uuid\Doctrine\UuidGenerator") + */ + private $id; /** - * @var Object $requestType The requestType that this property belongs to - * + * @var object The requestType that this property belongs to + * * @Assert\NotBlank * @Assert\Valid * @MaxDepth(1) @@ -58,7 +52,8 @@ class Property private $requestType; /** - * @var string The title of this property + * @var string The title of this property + * * @example My Property * @Assert\NotBlank * @Assert\Length(min = 15, max = 255) @@ -67,9 +62,9 @@ class Property */ private $title; - /** - * @var string $name The name of the property as used in api calls, extracted from title on snake_case basis + * @var string The name of the property as used in api calls, extracted from title on snake_case basis + * * @example my_property * @Assert\Length(min = 15, max = 255) * @Groups({"read"}) @@ -77,7 +72,8 @@ class Property private $name; /** - * @var string $type The type of this property + * @var string The type of this property + * * @example string * * @Assert\NotBlank @@ -89,9 +85,10 @@ class Property private $type; /** - * @var string $type The swagger type of the property as used in api calls + * @var string The swagger type of the property as used in api calls + * * @example string - * + * * @Assert\NotBlank * @Assert\Length(max = 255) * @Assert\Choice({"int32","int64","float","double","byte","binary","date","date-time","duration","password","boolean","string","uuid","uri","email","rsin","bag","bsn","iban","challenge","service","assent"}) @@ -101,9 +98,10 @@ class Property private $format; /** - * @var string $multipleOf *Can only be used in combination with type integer* Specifies a number where the value should be a multiple of, e.g. a multiple of 2 would validate 2,4 and 6 but would prevent 5 + * @var string *Can only be used in combination with type integer* Specifies a number where the value should be a multiple of, e.g. a multiple of 2 would validate 2,4 and 6 but would prevent 5 + * * @example 2 - * + * * * @Assert\Type("integer") * @Groups({"read", "write"}) @@ -112,9 +110,10 @@ class Property private $multipleOf; /** - * @var string $multipleOf *Can only be used in combination with type integer* The maximum allowed value - * @example 2 - * + * @var string *Can only be used in combination with type integer* The maximum allowed value + * + * @example 2 + * * * @Assert\Type("integer") * @Groups({"read", "write"}) @@ -123,7 +122,8 @@ class Property private $maximum; /** - * @var string $exclusiveMaximum *Can only be used in combination with type integer* Defines if the maximum is exclusive, e.g. a exclusive maximum of 5 would invalidate 5 but validate 4 + * @var string *Can only be used in combination with type integer* Defines if the maximum is exclusive, e.g. a exclusive maximum of 5 would invalidate 5 but validate 4 + * * @example true * * @Assert\Type("bool") @@ -133,7 +133,8 @@ class Property private $exclusiveMaximum; /** - * @var string $minimum *Can only be used in combination with type integer* The minimum allowed value + * @var string *Can only be used in combination with type integer* The minimum allowed value + * * @example 2 * * @Assert\Type("integer") @@ -143,9 +144,10 @@ class Property private $minimum; /** - * @var string $exclusiveMinimum *Can only be used in combination with type integer* Defines if the minimum is exclusive, e.g. a exclusive minimum of 5 would invalidate 5 but validate 6 + * @var string *Can only be used in combination with type integer* Defines if the minimum is exclusive, e.g. a exclusive minimum of 5 would invalidate 5 but validate 6 + * * @example true - * + * * * @Assert\Type("bool") * @Groups({"read", "write"}) @@ -154,9 +156,10 @@ class Property private $exclusiveMinimum; /** - * @var string $maxLength The maximum amount of characters in the value + * @var string The maximum amount of characters in the value + * * @example 2 - * + * * * @Assert\Type("integer") * @Groups({"read", "write"}) @@ -165,7 +168,8 @@ class Property private $maxLength; /** - * @var int $minLength The minimal amount of characters in the value + * @var int The minimal amount of characters in the value + * * @example 2 * * @Assert\Type("integer") @@ -175,9 +179,10 @@ class Property private $minLength; /** - * @var string $pattern A [regular expression](https://en.wikipedia.org/wiki/Regular_expression) that the value should comply to + * @var string A [regular expression](https://en.wikipedia.org/wiki/Regular_expression) that the value should comply to + * * @example regex - * + * * * @Assert\Length(max = 255) * @Groups({"read", "write"}) @@ -186,14 +191,14 @@ class Property private $pattern; /** - * Not yet supported by business logic + * Not yet supported by business logic. * * @ORM\ManyToMany(targetEntity="App\Entity\Property") */ private $items; /** - * @var boolean Not yet supported by business logic + * @var bool Not yet supported by business logic * * @Assert\Type("bool") * @Groups({"read", "write"}) @@ -202,9 +207,10 @@ class Property private $additionalItems; /** - * @var string $maxItems *Can only be used in combination with type array* The maximum array length + * @var string *Can only be used in combination with type array* The maximum array length + * * @example 2 - * + * * * @Assert\Type("integer") * @Groups({"read", "write"}) @@ -213,9 +219,10 @@ class Property private $maxItems; /** - * @var string $minItems *Can only be used in combination with type array* The minimum allowed value + * @var string *Can only be used in combination with type array* The minimum allowed value + * * @example 2 - * + * * * @Assert\Type("integer") * @Groups({"read", "write"}) @@ -224,7 +231,8 @@ class Property private $minItems; /** - * @var boolean *Can only be used in combination with type array* Define whether or not values in an array should be unique + * @var bool *Can only be used in combination with type array* Define whether or not values in an array should be unique + * * @example false * * @Assert\Type("bool") @@ -234,9 +242,10 @@ class Property private $uniqueItems; /** - * @var string $maxProperties *Can only be used in combination with type integer* The maximum amount of properties an object should contain + * @var string *Can only be used in combination with type integer* The maximum amount of properties an object should contain + * * @example 2 - * + * * * @Assert\Type("integer") * @Groups({"read", "write"}) @@ -245,7 +254,8 @@ class Property private $maxProperties; /** - * @var int $minProperties *Can only be used in combination with type object* The minimum amount of properties an object should contain + * @var int *Can only be used in combination with type object* The minimum amount of properties an object should contain + * * @example 2 * * @Assert\Type("integer") @@ -255,7 +265,8 @@ class Property private $minProperties; /** - * @var boolean $required Only whether or not this property is required + * @var bool Only whether or not this property is required + * * @example false * * @Assert\Type("bool") @@ -281,7 +292,7 @@ class Property private $additionalProperties; /** - * @var Object Not yet supported by business logic + * @var object Not yet supported by business logic * * @Groups({"read", "write"}) * @ORM\Column(type="object", nullable=true) @@ -289,8 +300,8 @@ class Property private $object; /** - * @var array $enum An array of possible values, input is limited to this array] - * + * @var array An array of possible values, input is limited to this array] + * * * @Groups({"read", "write"}) * @ORM\Column(type="array", nullable=true) @@ -298,38 +309,39 @@ class Property private $enum = []; /** - * @var array $allOf *mutually exclusive with using type* An array of possible types that an property should confirm to] - * + * @var array *mutually exclusive with using type* An array of possible types that an property should confirm to] + * * * @ORM\Column(type="array", nullable=true) */ private $allOf = []; /** - * @var array $anyOf *mutually exclusive with using type* An array of possible types that an property might confirm to] - * + * @var array *mutually exclusive with using type* An array of possible types that an property might confirm to] + * * * @ORM\Column(type="array", nullable=true) */ private $anyOf = []; /** - * @var array $oneOf *mutually exclusive with using type* An array of possible types that an property must confirm to] - * + * @var array *mutually exclusive with using type* An array of possible types that an property must confirm to] + * * * @ORM\Column(type="array", nullable=true) */ private $oneOf = []; /** - * Not yet supported by business logic + * Not yet supported by business logic. * * @ORM\Column(type="object", nullable=true) */ private $definitions; /** - * @var string An description of the value asked, supports markdown syntax as described by [CommonMark 0.27.](https://spec.commonmark.org/0.27/) + * @var string An description of the value asked, supports markdown syntax as described by [CommonMark 0.27.](https://spec.commonmark.org/0.27/) + * * @example My value * * @Groups({"read", "write"}) @@ -338,7 +350,8 @@ class Property private $description; /** - * @var string An default value for this value that will be used if a user doesn't supply a value + * @var string An default value for this value that will be used if a user doesn't supply a value + * * @example My value * * @Assert\Length(max = 255) @@ -347,9 +360,9 @@ class Property */ private $defaultValue; - /** - * @var boolean Whether or not this property can be left empty + * @var bool Whether or not this property can be left empty + * * @example false * * @Assert\Type("bool") @@ -359,7 +372,8 @@ class Property private $nullable; /** - * @var string To help API consumers detect the object type, you can add the discriminator/propertyName keyword to model definitions. This keyword points to the property that specifies the data type name + * @var string To help API consumers detect the object type, you can add the discriminator/propertyName keyword to model definitions. This keyword points to the property that specifies the data type name + * * @example name * * @Assert\Length(max = 255) @@ -369,7 +383,8 @@ class Property private $discriminator; /** - * @var boolean Whether or not this property is read only + * @var bool Whether or not this property is read only + * * @example false * * @Assert\Type("bool") @@ -379,7 +394,8 @@ class Property private $readOnly; /** - * @var boolean Whether or not this property is write only + * @var bool Whether or not this property is write only + * * @example false * * @Assert\Type("bool") @@ -389,7 +405,8 @@ class Property private $writeOnly; /** - * @var string An XML representation of the swagger docs + * @var string An XML representation of the swagger docs + * * @example '' * * @Groups({"read", "write"}) @@ -398,7 +415,8 @@ class Property private $xml; /** - * @var string An link to any external documentation for the value + * @var string An link to any external documentation for the value + * * @example https://www.w3.org/TR/NOTE-datetime * * @Assert\Length(max = 255) @@ -408,9 +426,10 @@ class Property private $externalDoc; /** - * @var string An example of the value that should be supplied + * @var string An example of the value that should be supplied + * * @example My value - * + * * @Assert\Length(max = 255) * @Groups({"read", "write"}) * @ORM\Column(type="string", length=255, nullable=true) @@ -418,7 +437,8 @@ class Property private $example; /** - * @var boolean Whether or not this property has been deprecated and wil be removed in the future + * @var bool Whether or not this property has been deprecated and wil be removed in the future + * * @example false * * @Assert\Type("bool") @@ -428,7 +448,8 @@ class Property private $deprecated; /** - * @var string The moment from which this value is available + * @var string The moment from which this value is available + * * @example 2019-09-16T14:26:51+00:00 * * @Groups({"read", "write"}) @@ -438,7 +459,8 @@ class Property private $availableFrom; /** - * @var string *should be used in combination with deprecated* The moment where until this value is available + * @var string *should be used in combination with deprecated* The moment where until this value is available + * * @example 2019-09-16T14:26:51+00:00 * * @Groups({"read", "write"}) @@ -448,7 +470,8 @@ class Property private $availableUntil; /** - * @var string The minimal date for value, either a date, datetime or duration (ISO_8601) + * @var string The minimal date for value, either a date, datetime or duration (ISO_8601) + * * @example 2019-09-16T14:26:51+00:00 * * @Groups({"read", "write"}) @@ -457,7 +480,8 @@ class Property private $minDate; /** - * @var string The maximum date for value, either a date, datetime or duration (ISO_8601) + * @var string The maximum date for value, either a date, datetime or duration (ISO_8601) + * * @example 2019-09-16T14:26:51+00:00 * * @Groups({"read", "write"}) @@ -465,7 +489,6 @@ class Property */ private $maxDate; - /** * @ORM\ManyToOne(targetEntity="App\Entity\Property", inversedBy="previous") */ @@ -477,9 +500,10 @@ class Property private $previous; /** - * @var string The icon of this property + * @var string The icon of this property + * * @example My Property - * + * * @Assert\Length(min = 15, max = 255) * @Groups({"read", "write"}) * @ORM\Column(type="string", length=255, nullable=true) @@ -487,7 +511,8 @@ class Property private $icon; /** - * @var string The slug of this property + * @var string The slug of this property + * * @example my-slug * * @Assert\Length(min = 15, max = 255) @@ -497,7 +522,8 @@ class Property private $slug; /** - * @var string Whether or not this proerty is the starting oint of a process + * @var string Whether or not this proerty is the starting oint of a process + * * @example true * * @Groups({"read", "write"}) @@ -518,26 +544,26 @@ public function getId() public function setId(string $id): self { - $this->id = $id; + $this->id = $id; - return $this; + return $this; } public function getRequestType(): ?RequestType { - return $this->requestType; + return $this->requestType; } public function setRequestType(?RequestType $requestType): self { - $this->requestType = $requestType; + $this->requestType = $requestType; return $this; } public function getTitle(): ?string { - return $this->title; + return $this->title; } public function setTitle(string $title): self @@ -549,13 +575,13 @@ public function setTitle(string $title): self public function getName(): ?string { - // titles wil be used as strings so lets convert the to camelcase - $string = $this->title; - $string = trim($string); //removes whitespace at begin and ending - $string = preg_replace('/\s+/', '_', $string); // replaces other whitespaces with _ - $string = strtolower($string); + // titles wil be used as strings so lets convert the to camelcase + $string = $this->title; + $string = trim($string); //removes whitespace at begin and ending + $string = preg_replace('/\s+/', '_', $string); // replaces other whitespaces with _ + $string = strtolower($string); - return $string; + return $string; } public function getMultipleOf(): ?int diff --git a/api/src/Entity/RequestType.php b/api/src/Entity/RequestType.php index 7f5787b4..3056ca18 100644 --- a/api/src/Entity/RequestType.php +++ b/api/src/Entity/RequestType.php @@ -2,24 +2,21 @@ namespace App\Entity; -use ApiPlatform\Core\Annotation\ApiSubresource; -use ApiPlatform\Core\Annotation\ApiProperty; -use ApiPlatform\Core\Annotation\ApiResource; use ApiPlatform\Core\Annotation\ApiFilter; +use ApiPlatform\Core\Annotation\ApiResource; use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Criteria; use Doctrine\ORM\Mapping as ORM; -use Gedmo\Mapping\Annotation as Gedmo; +use Ramsey\Uuid\Uuid; use Ramsey\Uuid\UuidInterface; use Symfony\Component\Serializer\Annotation\Groups; -use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Serializer\Annotation\MaxDepth; -use Ramsey\Uuid\Uuid; +use Symfony\Component\Validator\Constraints as Assert; /** - * All properties contained in the RequestType type + * All properties contained in the RequestType type. * * @ApiResource( * normalizationContext={"groups"={"read"}, "enable_max_depth"=true}, @@ -50,21 +47,23 @@ */ class RequestType { - /** - * @var UuidInterface $id The UUID identifier of this object - * @example e2984465-190a-4562-829e-a8cca81aa35d - * - * @Groups({"read"}) - * @Assert\Uuid - * @ORM\Id - * @ORM\Column(type="uuid", unique=true) - * @ORM\GeneratedValue(strategy="CUSTOM") - * @ORM\CustomIdGenerator(class="Ramsey\Uuid\Doctrine\UuidGenerator") - */ - private $id; + /** + * @var UuidInterface The UUID identifier of this object + * + * @example e2984465-190a-4562-829e-a8cca81aa35d + * + * @Groups({"read"}) + * @Assert\Uuid + * @ORM\Id + * @ORM\Column(type="uuid", unique=true) + * @ORM\GeneratedValue(strategy="CUSTOM") + * @ORM\CustomIdGenerator(class="Ramsey\Uuid\Doctrine\UuidGenerator") + */ + private $id; /** - * @var string $sourceOrganization The RSIN of the organization that owns this process + * @var string The RSIN of the organization that owns this process + * * @example 002851234 * @Assert\NotNull * @Assert\Length( @@ -78,24 +77,26 @@ class RequestType private $sourceOrganization; /** - * @var string $name The name of this RequestType + * @var string The name of this RequestType + * * @example My RequestType * @Assert\NotNull * @Assert\Length( * max = 255 * ) - * @Groups({"read"}) + * @Groups({"read"}) * @ORM\Column(type="string", length=255) */ private $name; /** - * @var string $description An short description of this RequestType + * @var string An short description of this RequestType + * * @example This is the best request ever * @Assert\Length( * max = 2550 * ) - * @Groups({"read"}) + * @Groups({"read"}) * @ORM\Column(type="text", nullable=true) */ private $description; @@ -109,7 +110,6 @@ class RequestType */ private $properties; - /** * @Groups({"read"}) * @MaxDepth(1) @@ -117,7 +117,7 @@ class RequestType private $stages; /** - * @var object $extends The requestType that this requestType extends + * @var object The requestType that this requestType extends * * @Groups({"write-requesttype"}) * @ORM\ManyToOne(targetEntity="App\Entity\RequestType", inversedBy="extendedBy", fetch="EAGER") @@ -125,8 +125,8 @@ class RequestType private $extends; /** - * @var object $extendedBy The requestTypes that extend this requestType - * + * @var object The requestTypes that extend this requestType + * * @ORM\OneToMany(targetEntity="App\Entity\RequestType", mappedBy="extends") */ private $extendedBy; @@ -141,11 +141,10 @@ class RequestType */ private $availableUntil; - public function __construct() { - $this->properties= new ArrayCollection(); - $this->extendedBy = new ArrayCollection(); + $this->properties = new ArrayCollection(); + $this->extendedBy = new ArrayCollection(); } public function getId(): Uuid @@ -155,19 +154,19 @@ public function getId(): Uuid public function setId(Uuid $id): self { - $this->id = $id; + $this->id = $id; - return $this; + return $this; } public function getSourceOrganization(): ?string { - return $this->sourceOrganization; + return $this->sourceOrganization; } public function setSourceOrganization(string $sourceOrganization): self { - $this->sourceOrganization = $sourceOrganization; + $this->sourceOrganization = $sourceOrganization; return $this; } @@ -177,7 +176,6 @@ public function getName(): ?string return $this->name; } - public function setName(string $name): self { $this->name = $name; @@ -202,14 +200,14 @@ public function setDescription(string $description): self */ public function getProperties(): Collection { - return $this->properties; + return $this->properties; } public function addProperty(Property $property): self { - if (!$this->properties->contains($property)) { - $this->properties[] = $property; - $property->setRequestType($this); + if (!$this->properties->contains($property)) { + $this->properties[] = $property; + $property->setRequestType($this); } return $this; @@ -220,20 +218,20 @@ public function addProperty(Property $property): self */ public function extendProperty(Property $property): self { - if (!$this->properties->contains($property)) { - $this->properties[] = $property; - } + if (!$this->properties->contains($property)) { + $this->properties[] = $property; + } - return $this; + return $this; } public function removeProperty(Property $property): self { - if ($this->properties->contains($property)) { - $this->properties->removeElement($property); + if ($this->properties->contains($property)) { + $this->properties->removeElement($property); // set the owning side to null (unless already changed) - if ($property->getRequestType() === $this) { - $property->setRequestType(null); + if ($property->getRequestType() === $this) { + $property->setRequestType(null); } } @@ -307,42 +305,40 @@ public function setAvailableUntil(?\DateTimeInterface $availableUntil): self return $this; } - public function getStages() { - $stages = []; - $stage = $this->getFirstStage(); - while ($stage){ - - $array = [ - "id"=>$stage->getId(), - "name"=>$stage->getName(), - "description"=>$stage->getDescription(), - "icon"=>$stage->getIcon(), - "slug"=>$stage->getSlug() - ]; - - if($stage->getNext()){ - $array["next"] = $stage->getNext()->getSlug(); - } + $stages = []; + $stage = $this->getFirstStage(); + while ($stage) { + $array = [ + 'id' => $stage->getId(), + 'name' => $stage->getName(), + 'description'=> $stage->getDescription(), + 'icon' => $stage->getIcon(), + 'slug' => $stage->getSlug(), + ]; + + if ($stage->getNext()) { + $array['next'] = $stage->getNext()->getSlug(); + } - if($stage->getPrevious()->first()){ - $array["previous"] = $stage->getPrevious()->first()->getSlug(); - } + if ($stage->getPrevious()->first()) { + $array['previous'] = $stage->getPrevious()->first()->getSlug(); + } - $stages[] = $array; + $stages[] = $array; - $stage = $stage->getNext(); - } + $stage = $stage->getNext(); + } - return $stages; + return $stages; } public function getFirstStage() { - $criteria = Criteria::create() - ->andWhere(Criteria::expr()->eq('start', true)); + $criteria = Criteria::create() + ->andWhere(Criteria::expr()->eq('start', true)); - return $this->getProperties()->matching($criteria)->first(); + return $this->getProperties()->matching($criteria)->first(); } } diff --git a/api/src/Filter/LikeFilter.php b/api/src/Filter/LikeFilter.php index 029c73e9..0bff7b42 100644 --- a/api/src/Filter/LikeFilter.php +++ b/api/src/Filter/LikeFilter.php @@ -36,14 +36,14 @@ public function getDescription(string $resourceClass): array $description = []; foreach ($this->properties as $property => $strategy) { $description["like_$property"] = [ - 'property' => $property, - 'type' => 'string', - 'required' => false, - 'swagger' => [ - 'description' => 'This filter narows your result using the * and _ wildcards, where * is assumed to be one or more characters and _ is assumed to be a single character', - 'name' => $property, - 'type' => 'string', - ], + 'property' => $property, + 'type' => 'string', + 'required' => false, + 'swagger' => [ + 'description' => 'This filter narows your result using the * and _ wildcards, where * is assumed to be one or more characters and _ is assumed to be a single character', + 'name' => $property, + 'type' => 'string', + ], ]; } diff --git a/api/src/Filter/RegexpFilter.php b/api/src/Filter/RegexpFilter.php index da1f747e..257b8f7b 100644 --- a/api/src/Filter/RegexpFilter.php +++ b/api/src/Filter/RegexpFilter.php @@ -36,14 +36,14 @@ public function getDescription(string $resourceClass): array $description = []; foreach ($this->properties as $property => $strategy) { $description["regexp_$property"] = [ - 'property' => $property, - 'type' => 'string', - 'required' => false, - 'swagger' => [ - 'description' => 'Filter for an exact match using a [Regular expression](https://en.wikipedia.org/wiki/Regular_expression).', - 'name' => $property, - 'type' => 'string', - ], + 'property' => $property, + 'type' => 'string', + 'required' => false, + 'swagger' => [ + 'description' => 'Filter for an exact match using a [Regular expression](https://en.wikipedia.org/wiki/Regular_expression).', + 'name' => $property, + 'type' => 'string', + ], ]; } diff --git a/api/src/Repository/NLXRequestLogRepository.php b/api/src/Repository/NLXRequestLogRepository.php index 69add53c..33986f87 100644 --- a/api/src/Repository/NLXRequestLogRepository.php +++ b/api/src/Repository/NLXRequestLogRepository.php @@ -6,7 +6,6 @@ use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Common\Persistence\ManagerRegistry; - /** * @method NLXRequestLog|null find($id, $lockMode = null, $lockVersion = null) * @method NLXRequestLog|null findOneBy(array $criteria, array $orderBy = null) @@ -15,10 +14,10 @@ */ class NLXRequestLogRepository extends ServiceEntityRepository { - public function __construct(ManagerRegistry $registry) - { - parent::__construct($registry, ExampleEntity::class); - } + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, ExampleEntity::class); + } /** * @return NLXRequestLog[] Returns an array of NLXRequestLog objects diff --git a/api/src/Repository/PropertyRepository.php b/api/src/Repository/PropertyRepository.php index d1d281fa..4d0139f1 100644 --- a/api/src/Repository/PropertyRepository.php +++ b/api/src/Repository/PropertyRepository.php @@ -16,7 +16,7 @@ class PropertyRepository extends ServiceEntityRepository { public function __construct(ManagerRegistry $registry) { - parent::__construct($registry, Property::class); + parent::__construct($registry, Property::class); } // /** diff --git a/api/src/Repository/RequestTypeRepository.php b/api/src/Repository/RequestTypeRepository.php index 2bdc2580..0adf35d5 100644 --- a/api/src/Repository/RequestTypeRepository.php +++ b/api/src/Repository/RequestTypeRepository.php @@ -14,10 +14,9 @@ */ class RequestTypeRepository extends ServiceEntityRepository { - - public function __construct(ManagerRegistry $registry) + public function __construct(ManagerRegistry $registry) { - parent::__construct($registry, RequestType::class); + parent::__construct($registry, RequestType::class); } // /** diff --git a/api/src/Service/RequestTypeService.php b/api/src/Service/RequestTypeService.php index 62e97045..45993111 100644 --- a/api/src/Service/RequestTypeService.php +++ b/api/src/Service/RequestTypeService.php @@ -1,4 +1,5 @@ em = $em; - } - - public function extendRequestType(RequestType $requestType) - { - $requestTypesProcessed = [(string) $requestType->getId()]; - $extendedRequest = $requestType->getExtends(); - $propertiesTitles = []; - // Let loop this for as long as we can extend requests - while($extendedRequest){ - // But kill it the moment we spot an invinate loop - if(in_array((string) $extendedRequest->getId(), $requestTypesProcessed)){ - throw new \Exception('Request type '.$extendedRequest->getName().'(id:'.(string) $extendedRequest->getId().') has been referenced more then once in this extention, posible loop detected'); - } - - // lets add the id to the check array, so that we can prefend loops - $requestTypesProcessed[(string) $extendedRequest->getId()] = true; - - // Then we need to do the actual extending - foreach ($extendedRequest->getProperties() as $property){ - - /* @todo we should als check on dubble property titles - if(in_array($property->getTitle(), $propertiesTitles)){ - throw new \Exception('There is more then one property titled '.$property->getTitle().' in this extention'); - }*/ - - $propertiesTitles[$property->getTitle()] = true; - $requestType->extendProperty($property); - } - - $extendedRequest = $extendedRequest->getExtends(); - } - - return $requestType; - } - + private $em; + + public function __construct(EntityManagerInterface $em) + { + $this->em = $em; + } + + public function extendRequestType(RequestType $requestType) + { + $requestTypesProcessed = [(string) $requestType->getId()]; + $extendedRequest = $requestType->getExtends(); + $propertiesTitles = []; + // Let loop this for as long as we can extend requests + while ($extendedRequest) { + // But kill it the moment we spot an invinate loop + if (in_array((string) $extendedRequest->getId(), $requestTypesProcessed)) { + throw new \Exception('Request type '.$extendedRequest->getName().'(id:'.(string) $extendedRequest->getId().') has been referenced more then once in this extention, posible loop detected'); + } + + // lets add the id to the check array, so that we can prefend loops + $requestTypesProcessed[(string) $extendedRequest->getId()] = true; + + // Then we need to do the actual extending + foreach ($extendedRequest->getProperties() as $property) { + + /* @todo we should als check on dubble property titles + if(in_array($property->getTitle(), $propertiesTitles)){ + throw new \Exception('There is more then one property titled '.$property->getTitle().' in this extention'); + }*/ + + $propertiesTitles[$property->getTitle()] = true; + $requestType->extendProperty($property); + } + + $extendedRequest = $extendedRequest->getExtends(); + } + + return $requestType; + } } diff --git a/api/src/Subscriber/FieldsAndExtendSubscriber.php b/api/src/Subscriber/FieldsAndExtendSubscriber.php index d50440c7..e4e45b7a 100644 --- a/api/src/Subscriber/FieldsAndExtendSubscriber.php +++ b/api/src/Subscriber/FieldsAndExtendSubscriber.php @@ -8,8 +8,8 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent; use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\Serializer\SerializerInterface; use Symfony\Component\PropertyAccess\PropertyAccess; +use Symfony\Component\Serializer\SerializerInterface; class FieldsAndExtendSubscriber implements EventSubscriberInterface { @@ -27,13 +27,13 @@ public function __construct(ParameterBagInterface $params, SerializerInterface $ public static function getSubscribedEvents() { return [ - KernelEvents::VIEW => ['FilterFields', EventPriorities::PRE_SERIALIZE], + KernelEvents::VIEW => ['FilterFields', EventPriorities::PRE_SERIALIZE], ]; } public function FilterFields(GetResponseForControllerResultEvent $event) { - /* @todo Contains a bug + /* @todo Contains a bug $result = $event->getControllerResult(); $fields = $event->getRequest()->query->get('fields'); $extends = $event->getRequest()->query->get('extend'); @@ -42,14 +42,14 @@ public function FilterFields(GetResponseForControllerResultEvent $event) $contentType= $event->getRequest()->headers->get('Accept'); } - + // Only do somthing if fields is query supplied if (!$fields && !$extends) { return $result; } - + // This needs to be bassed on the content-type - + // Lets set a return content type switch ($contentType) { case 'application/json': @@ -73,15 +73,15 @@ public function FilterFields(GetResponseForControllerResultEvent $event) if (!is_array($extends)) { $extends= explode(',', $extends); } - + // Its possible to nest fields for filterins foreach($fields as $key=>$value){ // Lets check if the fields contain one or more .'s if (strpos($value, '.') !== false) { - // This is where it gets complicated couse it could go on indevinitly + // This is where it gets complicated couse it could go on indevinitly } } - + // Overwrite maxdepth for extended properties // we always need to return an id and links (in order not to break stuff) @@ -95,18 +95,18 @@ public function FilterFields(GetResponseForControllerResultEvent $event) // now we need to overide the normal subscriber $json = $this->serializer->serialize( $result, - $renderType, - ['enable_max_depth' => true, + $renderType, + ['enable_max_depth' => true, 'attributes'=> $fields] ); - - + + $jsonArray = json_decode($json, true); - - + + // The we want to extend properties from the extend query foreach($extends as $extend){ - // @todo add security checks + // @todo add security checks // Get new object for the extend $extendObject = $this->propertyAccessor->getValue($result, $extend); // turn to json @@ -115,12 +115,12 @@ public function FilterFields(GetResponseForControllerResultEvent $event) $type, ['enable_max_depth' => true, 'attributes'=> $fields] - ); + ); // add to the array $jsonArray[$extend] = json_decode($extendjson, true); } - - + + $json = json_encode($jsonArray); $response = new Response( diff --git a/api/src/Subscriber/NLXSubscriber.php b/api/src/Subscriber/NLXSubscriber.php index 5411001e..09cd5e55 100644 --- a/api/src/Subscriber/NLXSubscriber.php +++ b/api/src/Subscriber/NLXSubscriber.php @@ -33,8 +33,8 @@ public function __construct(ParameterBagInterface $params, EntityManagerInterfac public static function getSubscribedEvents() { return [ - KernelEvents::VIEW => ['NLXLog', EventPriorities::PRE_VALIDATE], - KernelEvents::VIEW => ['NLXAudit', EventPriorities::PRE_SERIALIZE], + KernelEvents::VIEW => ['NLXLog', EventPriorities::PRE_VALIDATE], + KernelEvents::VIEW => ['NLXAudit', EventPriorities::PRE_SERIALIZE], ]; } diff --git a/api/src/Subscriber/RequestTypeSubscriber.php b/api/src/Subscriber/RequestTypeSubscriber.php index caff0d71..cdff5a16 100644 --- a/api/src/Subscriber/RequestTypeSubscriber.php +++ b/api/src/Subscriber/RequestTypeSubscriber.php @@ -2,57 +2,51 @@ namespace App\Subscriber; -use ApiPlatform\Core\Exception\InvalidArgumentException; use ApiPlatform\Core\EventListener\EventPriorities; +use App\Service\RequestTypeService; +use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent; use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\Serializer\SerializerInterface; -use Doctrine\ORM\EntityManagerInterface; -use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; - -use App\Service\RequestTypeService; class RequestTypeSubscriber implements EventSubscriberInterface { - private $params; - private $requestTypeService; - private $serializer; - - public function __construct(ParameterBagInterface $params, RequestTypeService $requestTypeService, SerializerInterface $serializer) - { - $this->params = $params; - $this->requestTypeService= $requestTypeService; - $this->serializer= $serializer; - } - - public static function getSubscribedEvents() - { - return [ - KernelEvents::VIEW => ['getRequestType', EventPriorities::PRE_VALIDATE], - ]; - - } - - public function getRequestType(GetResponseForControllerResultEvent $event) - { - $requestType = $event->getControllerResult(); - $route = $event->getRequest()->get('_route'); - $method = $event->getRequest()->getMethod(); - $extend = $event->getRequest()->query->get('extend'); - - //!$requestType instanceof RequestType || Request::METHOD_GET !== $method || - if ( $extend != "true" || $route !='api_request_types_get_item') { - return $requestType; - } - - //var_dump($method); - - $requestType = $this->requestTypeService->extendRequestType($requestType); - - return $requestType; - } + private $params; + private $requestTypeService; + private $serializer; + + public function __construct(ParameterBagInterface $params, RequestTypeService $requestTypeService, SerializerInterface $serializer) + { + $this->params = $params; + $this->requestTypeService = $requestTypeService; + $this->serializer = $serializer; + } + + public static function getSubscribedEvents() + { + return [ + KernelEvents::VIEW => ['getRequestType', EventPriorities::PRE_VALIDATE], + ]; + } + + public function getRequestType(GetResponseForControllerResultEvent $event) + { + $requestType = $event->getControllerResult(); + $route = $event->getRequest()->get('_route'); + $method = $event->getRequest()->getMethod(); + $extend = $event->getRequest()->query->get('extend'); + + //!$requestType instanceof RequestType || Request::METHOD_GET !== $method || + if ($extend != 'true' || $route != 'api_request_types_get_item') { + return $requestType; + } + + //var_dump($method); + + $requestType = $this->requestTypeService->extendRequestType($requestType); + + return $requestType; + } } diff --git a/api/src/Subscriber/ValidOnSubscriber.php b/api/src/Subscriber/ValidOnSubscriber.php index 4aac9f15..dd237ae9 100644 --- a/api/src/Subscriber/ValidOnSubscriber.php +++ b/api/src/Subscriber/ValidOnSubscriber.php @@ -29,7 +29,7 @@ public function __construct(ParameterBagInterface $params, EntityManagerInterfac public static function getSubscribedEvents() { return [ - KernelEvents::VIEW => ['validOn', EventPriorities::PRE_SERIALIZE], + KernelEvents::VIEW => ['validOn', EventPriorities::PRE_SERIALIZE], ]; } diff --git a/api/src/Swagger/SwaggerDecorator.php b/api/src/Swagger/SwaggerDecorator.php index acb8988e..e0883841 100644 --- a/api/src/Swagger/SwaggerDecorator.php +++ b/api/src/Swagger/SwaggerDecorator.php @@ -114,7 +114,7 @@ public function normalize($object, $format = null, array $context = []) //$additionalEntityDocs = $this->getAdditionalEntityDocs($entity); $entityDocs = $this->getAdditionalEntityDocs($entity); // Only run if we have aditional docs - if(array_key_exists('properties',$entityDocs)){ + if (array_key_exists('properties', $entityDocs)) { $additionalDocs = array_merge($additionalDocs, $entityDocs['properties']); } @@ -418,7 +418,6 @@ private function getAdditionalEntityDocs($entity) $atributes = []; $groups = []; - foreach ($tags as $tag) { $name = $tag->getName(); $description = $tag->getDescription(); @@ -445,47 +444,47 @@ private function getAdditionalEntityDocs($entity) // Constrainds (Validation) case "Assert\Date": - $atributes['type'] = "string"; + $atributes['type'] = 'string'; $atributes['format'] = 'date'; $atributes['example'] = \date('Y-m-d'); break; case "Assert\DateTime": - $atributes['type'] = "string"; + $atributes['type'] = 'string'; $atributes['format'] = 'date-time'; $atributes['example'] = \date('Y-m-d H:i:s'); break; case "Assert\Time": - $atributes['type'] = "string"; + $atributes['type'] = 'string'; $atributes['format'] = 'time'; $atributes['example'] = \date('H:i:s'); break; case "Assert\Timezone": - $atributes['type'] = "string"; + $atributes['type'] = 'string'; $atributes['format'] = 'timezone'; $atributes['example'] = 'America/New_York'; break; case "Assert\Uuid": - $atributes['type'] = "string"; + $atributes['type'] = 'string'; $atributes['format'] = 'uuid'; break; case "Assert\Email": - $atributes['type'] = "string"; + $atributes['type'] = 'string'; $atributes['format'] = 'email'; break; case "Assert\Url": - $atributes['type'] = "string"; + $atributes['type'] = 'string'; $atributes['format'] = 'url'; break; case "Assert\Regex": - $atributes['type'] = "string"; + $atributes['type'] = 'string'; $atributes['format'] = 'regex'; break; case "Assert\Ip": - $atributes['type'] = "string"; + $atributes['type'] = 'string'; $atributes['format'] = 'ip'; break; case "Assert\Json": - $atributes['type'] = "string"; + $atributes['type'] = 'string'; $atributes['format'] = 'json'; break; case "Assert\Choice":