diff --git a/README.md b/README.md index ef8b1fe..012d12f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,10 @@ ``` symfony server:start symfony console list make + symfony console make:migration symfony console doctrine:migrations:migrate +symfony console doctrine:migrations:up-to-date + symfony console doctrine:fixtures:load ``` \ No newline at end of file diff --git a/migrations/Version20220523093709.php b/migrations/Version20220523093709.php new file mode 100644 index 0000000..11133c9 --- /dev/null +++ b/migrations/Version20220523093709.php @@ -0,0 +1,49 @@ +addSql('CREATE TABLE mer_service (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, mcc_mnc INTEGER DEFAULT NULL, metadata CLOB DEFAULT NULL --(DC2Type:json) + , discr VARCHAR(255) NOT NULL, product_code VARCHAR(255) DEFAULT NULL, offer_id INTEGER DEFAULT NULL, api_key VARCHAR(255) DEFAULT NULL, service_id VARCHAR(255) DEFAULT NULL)'); + $this->addSql('DROP TABLE employee1'); + $this->addSql('DROP TABLE employee3'); + $this->addSql('DROP TABLE person2'); + $this->addSql('DROP TABLE person3'); + $this->addSql('DROP TABLE toothbrush1'); + $this->addSql('DROP TABLE toothbrush2'); + $this->addSql('DROP TABLE toothbrush3'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('CREATE TABLE employee1 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, toothbrush1_id INTEGER DEFAULT NULL, job VARCHAR(255) NOT NULL COLLATE BINARY, age INTEGER NOT NULL, name VARCHAR(255) NOT NULL COLLATE BINARY)'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_2250E3BCA25DC38 ON employee1 (toothbrush1_id)'); + $this->addSql('CREATE TABLE employee3 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, job VARCHAR(255) NOT NULL COLLATE BINARY)'); + $this->addSql('CREATE TABLE person2 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, toothbrush2_id INTEGER DEFAULT NULL, age INTEGER NOT NULL, name VARCHAR(255) NOT NULL COLLATE BINARY, discr VARCHAR(255) NOT NULL COLLATE BINARY, job VARCHAR(255) DEFAULT NULL COLLATE BINARY)'); + $this->addSql('CREATE INDEX IDX_A387B6D5189073D6 ON person2 (toothbrush2_id)'); + $this->addSql('CREATE TABLE person3 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, toothbrush3_id INTEGER DEFAULT NULL, age INTEGER NOT NULL, name VARCHAR(255) NOT NULL COLLATE BINARY, discr VARCHAR(255) NOT NULL COLLATE BINARY)'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_D4808643A02C14B3 ON person3 (toothbrush3_id)'); + $this->addSql('CREATE TABLE toothbrush1 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, brand VARCHAR(255) NOT NULL COLLATE BINARY)'); + $this->addSql('CREATE TABLE toothbrush2 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, brand VARCHAR(255) NOT NULL COLLATE BINARY)'); + $this->addSql('CREATE TABLE toothbrush3 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, brand VARCHAR(255) NOT NULL COLLATE BINARY)'); + $this->addSql('DROP TABLE mer_service'); + } +} diff --git a/migrations/Version20220523110817.php b/migrations/Version20220523110817.php new file mode 100644 index 0000000..66037a0 --- /dev/null +++ b/migrations/Version20220523110817.php @@ -0,0 +1,36 @@ +addSql('ALTER TABLE mer_service ADD COLUMN activation_code VARCHAR(255) DEFAULT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('CREATE TEMPORARY TABLE __temp__mer_service AS SELECT id, mcc_mnc, metadata, discr, product_code, offer_id, api_key, service_id FROM mer_service'); + $this->addSql('DROP TABLE mer_service'); + $this->addSql('CREATE TABLE mer_service (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, mcc_mnc INTEGER DEFAULT NULL, metadata CLOB DEFAULT NULL --(DC2Type:json) + , discr VARCHAR(255) NOT NULL, product_code VARCHAR(255) DEFAULT NULL, offer_id INTEGER DEFAULT NULL, api_key VARCHAR(255) DEFAULT NULL, service_id VARCHAR(255) DEFAULT NULL)'); + $this->addSql('INSERT INTO mer_service (id, mcc_mnc, metadata, discr, product_code, offer_id, api_key, service_id) SELECT id, mcc_mnc, metadata, discr, product_code, offer_id, api_key, service_id FROM __temp__mer_service'); + $this->addSql('DROP TABLE __temp__mer_service'); + } +} diff --git a/migrations/Version20220523114408.php b/migrations/Version20220523114408.php new file mode 100644 index 0000000..caeafa6 --- /dev/null +++ b/migrations/Version20220523114408.php @@ -0,0 +1,32 @@ +addSql('CREATE TABLE mer_para_sub (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, service_id INTEGER NOT NULL, red_code VARCHAR(255) DEFAULT NULL)'); + $this->addSql('CREATE INDEX IDX_E4F82A3DED5CA9E6 ON mer_para_sub (service_id)'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('DROP TABLE mer_para_sub'); + } +} diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..59cc277 Binary files /dev/null and b/public/favicon.ico differ diff --git a/src/Controller/IndexController.php b/src/Controller/IndexController.php index cf901e0..b903c4b 100644 --- a/src/Controller/IndexController.php +++ b/src/Controller/IndexController.php @@ -2,6 +2,8 @@ namespace App\Controller; +use App\Entity\MerParaSub; +use App\Repository\MerParaSubRepository; use Doctrine\ORM\EntityManager; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Response; @@ -11,11 +13,15 @@ use App\Repository\Entity1Repository; class IndexController extends AbstractController { #[Route('/', name: 'app_index')] - public function index(Entity1Repository $repo): Response + public function index(Entity1Repository $repo, MerParaSubRepository $subRepo): Response { $sm = $repo->getSchemaManager(); $entity8 = $repo->findOneByName('entity 8'); + $sub = $subRepo->findOneById(1); + dump($sub); + dump($sub->getService()); + return $this->render('index/index.html.twig', [ 'controller_name' => 'IndexController', 'entity8' => $entity8, diff --git a/src/DataFixtures/InheritanceFixtures.php b/src/DataFixtures/InheritanceFixtures.php index 1d54a93..be4d2ba 100644 --- a/src/DataFixtures/InheritanceFixtures.php +++ b/src/DataFixtures/InheritanceFixtures.php @@ -11,7 +11,7 @@ use App\Entity\Toothbrush3; use Doctrine\Bundle\FixturesBundle\Fixture; use Doctrine\Persistence\ObjectManager; -class InheritanceFixtures extends Fixture +class InheritanceFixtures //extends Fixture { public function load(ObjectManager $manager): void { diff --git a/src/DataFixtures/MerFixtures.php b/src/DataFixtures/MerFixtures.php new file mode 100644 index 0000000..f1ea7a0 --- /dev/null +++ b/src/DataFixtures/MerFixtures.php @@ -0,0 +1,44 @@ +setMccMnc(12345)->setOfferId(223)->setProductCode('code2'); + $manager->persist($tmp); + + $tmp = new MerParaDT(); + $tmp->setMccMnc(12345)->setServiceId('ser-vi-ce1')->setApiKey('api1'); + $manager->persist($tmp); + + $tmp = new MerParaDT(); + $tmp->setMccMnc(12341)->setServiceId('ser-vi-ce2')->setApiKey('api2'); + $manager->persist($tmp); + + $tmp = new MerBeDM(); + $tmp->setMccMnc(12341)->setOfferId(112)->setActivationCode('active1'); + $manager->persist($tmp); + + $tmp = new MerParaDM(); + $tmp->setMccMnc(12345)->setOfferId(221)->setProductCode('code1'); + $manager->persist($tmp); + + $sub = new MerParaSub(); + $sub->setService($tmp)->setRedCode('redcode1'); + $manager->persist($sub); + + $manager->flush(); + } +} + +// symfony console doctrine:fixtures:load diff --git a/src/Entity/Employee1.php b/src/Entity/Employee1.php index dbfd745..b8da323 100644 --- a/src/Entity/Employee1.php +++ b/src/Entity/Employee1.php @@ -4,7 +4,7 @@ namespace App\Entity; use Doctrine\ORM\Mapping as ORM; -#[ORM\Entity] +////#[ORM\Entity] class Employee1 extends Person1 { #[ORM\Id] diff --git a/src/Entity/Employee2.php b/src/Entity/Employee2.php index 5a22219..dcfcee4 100644 --- a/src/Entity/Employee2.php +++ b/src/Entity/Employee2.php @@ -4,7 +4,7 @@ namespace App\Entity; use Doctrine\ORM\Mapping as ORM; -#[ORM\Entity] +////#[ORM\Entity] class Employee2 extends Person2 { #[ORM\Id] diff --git a/src/Entity/Employee3.php b/src/Entity/Employee3.php index e5dff6e..49264ff 100644 --- a/src/Entity/Employee3.php +++ b/src/Entity/Employee3.php @@ -4,7 +4,7 @@ namespace App\Entity; use Doctrine\ORM\Mapping as ORM; -#[ORM\Entity] +////#[ORM\Entity] class Employee3 extends Person3 { #[ORM\Id] diff --git a/src/Entity/MerBeDM.php b/src/Entity/MerBeDM.php new file mode 100644 index 0000000..2240e3b --- /dev/null +++ b/src/Entity/MerBeDM.php @@ -0,0 +1,37 @@ +id; +// } + + public function getActivationCode(): ?string + { + return $this->activationCode; + } + + public function setActivationCode(string $activationCode): self + { + $this->activationCode = $activationCode; + + return $this; + } +} diff --git a/src/Entity/MerDM.php b/src/Entity/MerDM.php new file mode 100644 index 0000000..b4854b4 --- /dev/null +++ b/src/Entity/MerDM.php @@ -0,0 +1,35 @@ +id; +// } + + public function getOfferId(): ?int + { + return $this->offerId; + } + + public function setOfferId(int $offerId): self + { + $this->offerId = $offerId; + + return $this; + } +} diff --git a/src/Entity/MerDT.php b/src/Entity/MerDT.php new file mode 100644 index 0000000..d581761 --- /dev/null +++ b/src/Entity/MerDT.php @@ -0,0 +1,35 @@ +id; +// } + + public function getServiceId(): ?string + { + return $this->serviceId; + } + + public function setServiceId(string $serviceId): self + { + $this->serviceId = $serviceId; + + return $this; + } +} diff --git a/src/Entity/MerParaDM.php b/src/Entity/MerParaDM.php new file mode 100644 index 0000000..207b9bb --- /dev/null +++ b/src/Entity/MerParaDM.php @@ -0,0 +1,37 @@ +id; +// } + + public function getProductCode(): ?string + { + return $this->productCode; + } + + public function setProductCode(string $productCode): self + { + $this->productCode = $productCode; + + return $this; + } +} diff --git a/src/Entity/MerParaDT.php b/src/Entity/MerParaDT.php new file mode 100644 index 0000000..d545e6e --- /dev/null +++ b/src/Entity/MerParaDT.php @@ -0,0 +1,37 @@ +id; +// } + + public function getApiKey(): ?string + { + return $this->apiKey; + } + + public function setApiKey(string $apiKey): self + { + $this->apiKey = $apiKey; + + return $this; + } +} diff --git a/src/Entity/MerParaSub.php b/src/Entity/MerParaSub.php new file mode 100644 index 0000000..416ae56 --- /dev/null +++ b/src/Entity/MerParaSub.php @@ -0,0 +1,51 @@ +id; + } + + public function getRedCode(): ?string + { + return $this->redCode; + } + + public function setRedCode(?string $redCode): self + { + $this->redCode = $redCode; + + return $this; + } + + public function getService(): ?MerService + { + return $this->service; + } + + public function setService(?MerService $service): self + { + $this->service = $service; + + return $this; + } +} diff --git a/src/Entity/MerService.php b/src/Entity/MerService.php new file mode 100644 index 0000000..9386ea4 --- /dev/null +++ b/src/Entity/MerService.php @@ -0,0 +1,57 @@ + MerParaDM::class, + 'para_dt' => MerParaDT::class, + 'be_dm' => MerBeDM::class +])] +#[ORM\Entity(repositoryClass: MerServiceRepository::class)] +abstract class MerService +{ + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: 'integer')] + private $id; + + #[ORM\Column(type: 'integer', nullable: true)] + private $mcc_mnc; + + #[ORM\Column(type: 'json', nullable: true)] + private $metadata = []; + + public function getId(): ?int + { + return $this->id; + } + + public function getMccMnc(): ?int + { + return $this->mcc_mnc; + } + + public function setMccMnc(?int $mcc_mnc): self + { + $this->mcc_mnc = $mcc_mnc; + + return $this; + } + + public function getMetadata(): ?array + { + return $this->metadata; + } + + public function setMetadata(?array $metadata): self + { + $this->metadata = $metadata; + + return $this; + } +} diff --git a/src/Entity/Person1.php b/src/Entity/Person1.php index bc5fdc2..9d5209f 100644 --- a/src/Entity/Person1.php +++ b/src/Entity/Person1.php @@ -4,7 +4,7 @@ namespace App\Entity; use Doctrine\ORM\Mapping as ORM; -#[ORM\MappedSuperclass] +////#[ORM\MappedSuperclass] class Person1 { #[ORM\Column(type: 'integer')] diff --git a/src/Entity/Person2.php b/src/Entity/Person2.php index 83b5fa6..adc8dc1 100644 --- a/src/Entity/Person2.php +++ b/src/Entity/Person2.php @@ -4,7 +4,7 @@ namespace App\Entity; use Doctrine\ORM\Mapping as ORM; -#[ORM\Entity] +////#[ORM\Entity] #[ORM\InheritanceType('SINGLE_TABLE')] #[ORM\DiscriminatorColumn(name: 'discr', type: 'string')] #[ORM\DiscriminatorMap(['person2' => 'Person2', 'employee2' => 'Employee2'])] diff --git a/src/Entity/Person3.php b/src/Entity/Person3.php index 314ab0a..c8e1bab 100644 --- a/src/Entity/Person3.php +++ b/src/Entity/Person3.php @@ -4,7 +4,7 @@ namespace App\Entity; use Doctrine\ORM\Mapping as ORM; -#[ORM\Entity] +////#[ORM\Entity] #[ORM\InheritanceType('JOINED')] #[ORM\DiscriminatorColumn(name: 'discr', type: 'string')] #[ORM\DiscriminatorMap(['person3' => 'Person3', 'employee3' => 'Employee3'])] diff --git a/src/Entity/Toothbrush1.php b/src/Entity/Toothbrush1.php index bcf4488..9ca0c2d 100644 --- a/src/Entity/Toothbrush1.php +++ b/src/Entity/Toothbrush1.php @@ -4,7 +4,7 @@ namespace App\Entity; use Doctrine\ORM\Mapping as ORM; -#[ORM\Entity] +////#[ORM\Entity] class Toothbrush1 { #[ORM\Id] diff --git a/src/Entity/Toothbrush2.php b/src/Entity/Toothbrush2.php index 33b8ef6..90b65e4 100644 --- a/src/Entity/Toothbrush2.php +++ b/src/Entity/Toothbrush2.php @@ -4,7 +4,7 @@ namespace App\Entity; use Doctrine\ORM\Mapping as ORM; -#[ORM\Entity] +////#[ORM\Entity] class Toothbrush2 { #[ORM\Id] diff --git a/src/Entity/Toothbrush3.php b/src/Entity/Toothbrush3.php index 348e14b..4dd57a2 100644 --- a/src/Entity/Toothbrush3.php +++ b/src/Entity/Toothbrush3.php @@ -4,7 +4,7 @@ namespace App\Entity; use Doctrine\ORM\Mapping as ORM; -#[ORM\Entity] +////#[ORM\Entity] class Toothbrush3 { #[ORM\Id] diff --git a/src/Repository/MerBeDMRepository.php b/src/Repository/MerBeDMRepository.php new file mode 100644 index 0000000..36eaa3b --- /dev/null +++ b/src/Repository/MerBeDMRepository.php @@ -0,0 +1,65 @@ + + * @method MerBeDM|null find($id, $lockMode = null, $lockVersion = null) + * @method MerBeDM|null findOneBy(array $criteria, array $orderBy = null) + * @method MerBeDM[] findAll() + * @method MerBeDM[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class MerBeDMRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, MerBeDM::class); + } + + public function add(MerBeDM $entity, bool $flush = false): void + { + $this->getEntityManager()->persist($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } + + public function remove(MerBeDM $entity, bool $flush = false): void + { + $this->getEntityManager()->remove($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } + +// /** +// * @return MerBeDM[] Returns an array of MerBeDM objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('m') +// ->andWhere('m.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('m.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?MerBeDM +// { +// return $this->createQueryBuilder('m') +// ->andWhere('m.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/src/Repository/MerDMRepository.php b/src/Repository/MerDMRepository.php new file mode 100644 index 0000000..682bdad --- /dev/null +++ b/src/Repository/MerDMRepository.php @@ -0,0 +1,65 @@ + + * @method MerDM|null find($id, $lockMode = null, $lockVersion = null) + * @method MerDM|null findOneBy(array $criteria, array $orderBy = null) + * @method MerDM[] findAll() + * @method MerDM[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class MerDMRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, MerDM::class); + } + + public function add(MerDM $entity, bool $flush = false): void + { + $this->getEntityManager()->persist($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } + + public function remove(MerDM $entity, bool $flush = false): void + { + $this->getEntityManager()->remove($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } + +// /** +// * @return MerDM[] Returns an array of MerDM objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('m') +// ->andWhere('m.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('m.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?MerDM +// { +// return $this->createQueryBuilder('m') +// ->andWhere('m.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/src/Repository/MerDTRepository.php b/src/Repository/MerDTRepository.php new file mode 100644 index 0000000..11fc067 --- /dev/null +++ b/src/Repository/MerDTRepository.php @@ -0,0 +1,65 @@ + + * @method MerDT|null find($id, $lockMode = null, $lockVersion = null) + * @method MerDT|null findOneBy(array $criteria, array $orderBy = null) + * @method MerDT[] findAll() + * @method MerDT[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class MerDTRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, MerDT::class); + } + + public function add(MerDT $entity, bool $flush = false): void + { + $this->getEntityManager()->persist($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } + + public function remove(MerDT $entity, bool $flush = false): void + { + $this->getEntityManager()->remove($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } + +// /** +// * @return MerDT[] Returns an array of MerDT objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('m') +// ->andWhere('m.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('m.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?MerDT +// { +// return $this->createQueryBuilder('m') +// ->andWhere('m.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/src/Repository/MerParaDMRepository.php b/src/Repository/MerParaDMRepository.php new file mode 100644 index 0000000..24bcd10 --- /dev/null +++ b/src/Repository/MerParaDMRepository.php @@ -0,0 +1,65 @@ + + * @method MerParaDM|null find($id, $lockMode = null, $lockVersion = null) + * @method MerParaDM|null findOneBy(array $criteria, array $orderBy = null) + * @method MerParaDM[] findAll() + * @method MerParaDM[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class MerParaDMRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, MerParaDM::class); + } + + public function add(MerParaDM $entity, bool $flush = false): void + { + $this->getEntityManager()->persist($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } + + public function remove(MerParaDM $entity, bool $flush = false): void + { + $this->getEntityManager()->remove($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } + +// /** +// * @return MerParaDM[] Returns an array of MerParaDM objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('m') +// ->andWhere('m.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('m.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?MerParaDM +// { +// return $this->createQueryBuilder('m') +// ->andWhere('m.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/src/Repository/MerParaDTRepository.php b/src/Repository/MerParaDTRepository.php new file mode 100644 index 0000000..f30b8b4 --- /dev/null +++ b/src/Repository/MerParaDTRepository.php @@ -0,0 +1,65 @@ + + * @method MerParaDT|null find($id, $lockMode = null, $lockVersion = null) + * @method MerParaDT|null findOneBy(array $criteria, array $orderBy = null) + * @method MerParaDT[] findAll() + * @method MerParaDT[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class MerParaDTRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, MerParaDT::class); + } + + public function add(MerParaDT $entity, bool $flush = false): void + { + $this->getEntityManager()->persist($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } + + public function remove(MerParaDT $entity, bool $flush = false): void + { + $this->getEntityManager()->remove($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } + +// /** +// * @return MerParaDT[] Returns an array of MerParaDT objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('m') +// ->andWhere('m.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('m.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?MerParaDT +// { +// return $this->createQueryBuilder('m') +// ->andWhere('m.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/src/Repository/MerParaSubRepository.php b/src/Repository/MerParaSubRepository.php new file mode 100644 index 0000000..895f628 --- /dev/null +++ b/src/Repository/MerParaSubRepository.php @@ -0,0 +1,66 @@ + + * + * @method MerParaSub|null find($id, $lockMode = null, $lockVersion = null) + * @method MerParaSub|null findOneBy(array $criteria, array $orderBy = null) + * @method MerParaSub[] findAll() + * @method MerParaSub[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class MerParaSubRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, MerParaSub::class); + } + + public function add(MerParaSub $entity, bool $flush = false): void + { + $this->getEntityManager()->persist($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } + + public function remove(MerParaSub $entity, bool $flush = false): void + { + $this->getEntityManager()->remove($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } + +// /** +// * @return MerParaSub[] Returns an array of MerParaSub objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('m') +// ->andWhere('m.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('m.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + + public function findOneById(int $id): ?MerParaSub + { + return $this->createQueryBuilder('m') + ->andWhere('m.id = :val') + ->setParameter('val', $id) + ->getQuery() + ->getOneOrNullResult() + ; + } +} diff --git a/src/Repository/MerServiceRepository.php b/src/Repository/MerServiceRepository.php new file mode 100644 index 0000000..aba062d --- /dev/null +++ b/src/Repository/MerServiceRepository.php @@ -0,0 +1,65 @@ + + * @method MerService|null find($id, $lockMode = null, $lockVersion = null) + * @method MerService|null findOneBy(array $criteria, array $orderBy = null) + * @method MerService[] findAll() + * @method MerService[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + */ +class MerServiceRepository extends ServiceEntityRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, MerService::class); + } + + public function add(MerService $entity, bool $flush = false): void + { + $this->getEntityManager()->persist($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } + + public function remove(MerService $entity, bool $flush = false): void + { + $this->getEntityManager()->remove($entity); + + if ($flush) { + $this->getEntityManager()->flush(); + } + } + +// /** +// * @return MerService[] Returns an array of MerService objects +// */ +// public function findByExampleField($value): array +// { +// return $this->createQueryBuilder('m') +// ->andWhere('m.exampleField = :val') +// ->setParameter('val', $value) +// ->orderBy('m.id', 'ASC') +// ->setMaxResults(10) +// ->getQuery() +// ->getResult() +// ; +// } + +// public function findOneBySomeField($value): ?MerService +// { +// return $this->createQueryBuilder('m') +// ->andWhere('m.exampleField = :val') +// ->setParameter('val', $value) +// ->getQuery() +// ->getOneOrNullResult() +// ; +// } +} diff --git a/templates/base.html.twig b/templates/base.html.twig index 0b851f3..8578144 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -3,7 +3,7 @@ {% block title %}Welcome!{% endblock %} - +{# #} {# Run `composer require symfony/webpack-encore-bundle` to start using Symfony UX #} {% block stylesheets %} {{ encore_entry_link_tags('app') }}