simulation model

This commit is contained in:
Sergio Álvarez 2022-05-23 15:22:36 +02:00
parent c8545e4cc7
commit f251e6eb0d
No known key found for this signature in database
GPG Key ID: 622780889DFDBDA5
32 changed files with 927 additions and 12 deletions

View File

@ -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
```

View File

@ -0,0 +1,49 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20220523093709 extends AbstractMigration
{
public function getDescription(): string
{
return 'Mer* simulation and cleanup';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$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('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');
}
}

View File

@ -0,0 +1,36 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20220523110817 extends AbstractMigration
{
public function getDescription(): string
{
return 'Be* added';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->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');
}
}

View File

@ -0,0 +1,32 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20220523114408 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->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');
}
}

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -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,

View File

@ -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
{

View File

@ -0,0 +1,44 @@
<?php
namespace App\DataFixtures;
use App\Entity\MerBeDM;
use App\Entity\MerParaDM;
use App\Entity\MerParaDT;
use App\Entity\MerParaSub;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Persistence\ObjectManager;
class MerFixtures extends Fixture
{
public function load(ObjectManager $manager): void
{
$tmp = new MerParaDM();
$tmp->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

View File

@ -4,7 +4,7 @@ namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity]
////#[ORM\Entity]
class Employee1 extends Person1
{
#[ORM\Id]

View File

@ -4,7 +4,7 @@ namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity]
////#[ORM\Entity]
class Employee2 extends Person2
{
#[ORM\Id]

View File

@ -4,7 +4,7 @@ namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity]
////#[ORM\Entity]
class Employee3 extends Person3
{
#[ORM\Id]

37
src/Entity/MerBeDM.php Normal file
View File

@ -0,0 +1,37 @@
<?php
namespace App\Entity;
use App\Repository\MerBeDMRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: MerBeDMRepository::class)]
class MerBeDM extends MerService
{
use MerDM;
// #[ORM\Id]
// #[ORM\GeneratedValue]
// #[ORM\Column(type: 'integer')]
// private $id;
#[ORM\Column(type: 'string', length: 255)]
private $activationCode;
// public function getId(): ?int
// {
// return $this->id;
// }
public function getActivationCode(): ?string
{
return $this->activationCode;
}
public function setActivationCode(string $activationCode): self
{
$this->activationCode = $activationCode;
return $this;
}
}

35
src/Entity/MerDM.php Normal file
View File

@ -0,0 +1,35 @@
<?php
namespace App\Entity;
use App\Repository\MerDMRepository;
use Doctrine\ORM\Mapping as ORM;
//#[ORM\Entity(repositoryClass: MerDMRepository::class)]
trait MerDM
{
// #[ORM\Id]
// #[ORM\GeneratedValue]
// #[ORM\Column(type: 'integer')]
// private $id;
#[ORM\Column(type: 'integer')]
private $offerId;
// public function getId(): ?int
// {
// return $this->id;
// }
public function getOfferId(): ?int
{
return $this->offerId;
}
public function setOfferId(int $offerId): self
{
$this->offerId = $offerId;
return $this;
}
}

35
src/Entity/MerDT.php Normal file
View File

@ -0,0 +1,35 @@
<?php
namespace App\Entity;
use App\Repository\MerDTRepository;
use Doctrine\ORM\Mapping as ORM;
//#[ORM\Entity(repositoryClass: MerDTRepository::class)]
trait MerDT
{
// #[ORM\Id]
// #[ORM\GeneratedValue]
// #[ORM\Column(type: 'integer')]
// private $id;
#[ORM\Column(type: 'string', length: 255)]
private $serviceId;
// public function getId(): ?int
// {
// return $this->id;
// }
public function getServiceId(): ?string
{
return $this->serviceId;
}
public function setServiceId(string $serviceId): self
{
$this->serviceId = $serviceId;
return $this;
}
}

37
src/Entity/MerParaDM.php Normal file
View File

@ -0,0 +1,37 @@
<?php
namespace App\Entity;
use App\Repository\MerParaDMRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: MerParaDMRepository::class)]
class MerParaDM extends MerService
{
use MerDM;
// #[ORM\Id]
// #[ORM\GeneratedValue]
// #[ORM\Column(type: 'integer')]
// private $id;
#[ORM\Column(type: 'string', length: 255)]
private $productCode;
// public function getId(): ?int
// {
// return $this->id;
// }
public function getProductCode(): ?string
{
return $this->productCode;
}
public function setProductCode(string $productCode): self
{
$this->productCode = $productCode;
return $this;
}
}

37
src/Entity/MerParaDT.php Normal file
View File

@ -0,0 +1,37 @@
<?php
namespace App\Entity;
use App\Repository\MerParaDTRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: MerParaDTRepository::class)]
class MerParaDT extends MerService
{
use MerDT;
// #[ORM\Id]
// #[ORM\GeneratedValue]
// #[ORM\Column(type: 'integer')]
// private $id;
#[ORM\Column(type: 'string', length: 255)]
private $apiKey;
// public function getId(): ?int
// {
// return $this->id;
// }
public function getApiKey(): ?string
{
return $this->apiKey;
}
public function setApiKey(string $apiKey): self
{
$this->apiKey = $apiKey;
return $this;
}
}

51
src/Entity/MerParaSub.php Normal file
View File

@ -0,0 +1,51 @@
<?php
namespace App\Entity;
use App\Repository\MerParaSubRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: MerParaSubRepository::class)]
class MerParaSub
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $redCode;
#[ORM\ManyToOne(targetEntity: MerService::class)]
#[ORM\JoinColumn(nullable: false)]
private MerService $service;
public function getId(): ?int
{
return $this->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;
}
}

57
src/Entity/MerService.php Normal file
View File

@ -0,0 +1,57 @@
<?php
namespace App\Entity;
use App\Repository\MerServiceRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\InheritanceType('SINGLE_TABLE')]
#[ORM\DiscriminatorColumn(name: 'discr', type: 'string')]
#[ORM\DiscriminatorMap([
'para_dm' => 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;
}
}

View File

@ -4,7 +4,7 @@ namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
#[ORM\MappedSuperclass]
////#[ORM\MappedSuperclass]
class Person1
{
#[ORM\Column(type: 'integer')]

View File

@ -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'])]

View File

@ -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'])]

View File

@ -4,7 +4,7 @@ namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity]
////#[ORM\Entity]
class Toothbrush1
{
#[ORM\Id]

View File

@ -4,7 +4,7 @@ namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity]
////#[ORM\Entity]
class Toothbrush2
{
#[ORM\Id]

View File

@ -4,7 +4,7 @@ namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity]
////#[ORM\Entity]
class Toothbrush3
{
#[ORM\Id]

View File

@ -0,0 +1,65 @@
<?php
namespace App\Repository;
use App\Entity\MerBeDM;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<MerBeDM>
* @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()
// ;
// }
}

View File

@ -0,0 +1,65 @@
<?php
namespace App\Repository;
use App\Entity\MerDM;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<MerDM>
* @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()
// ;
// }
}

View File

@ -0,0 +1,65 @@
<?php
namespace App\Repository;
use App\Entity\MerDT;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<MerDT>
* @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()
// ;
// }
}

View File

@ -0,0 +1,65 @@
<?php
namespace App\Repository;
use App\Entity\MerParaDM;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<MerParaDM>
* @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()
// ;
// }
}

View File

@ -0,0 +1,65 @@
<?php
namespace App\Repository;
use App\Entity\MerParaDT;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<MerParaDT>
* @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()
// ;
// }
}

View File

@ -0,0 +1,66 @@
<?php
namespace App\Repository;
use App\Entity\MerParaSub;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<MerParaSub>
*
* @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()
;
}
}

View File

@ -0,0 +1,65 @@
<?php
namespace App\Repository;
use App\Entity\MerService;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<MerService>
* @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()
// ;
// }
}

View File

@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<title>{% block title %}Welcome!{% endblock %}</title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text></svg>">
{# <link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text></svg>">#}
{# Run `composer require symfony/webpack-encore-bundle` to start using Symfony UX #}
{% block stylesheets %}
{{ encore_entry_link_tags('app') }}