platform dupped

This commit is contained in:
Sergio Álvarez 2022-05-25 12:05:39 +02:00
parent 258c79b954
commit 2a5ee7b16b
No known key found for this signature in database
GPG Key ID: 622780889DFDBDA5
9 changed files with 58 additions and 25 deletions

View File

@ -10,7 +10,7 @@ use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20220524155905 extends AbstractMigration
final class Version20220525093052 extends AbstractMigration
{
public function getDescription(): string
{
@ -34,7 +34,8 @@ final class Version20220524155905 extends AbstractMigration
)');
$this->addSql('CREATE INDEX IDX_E4F82A3DED5CA9E6 ON mer_para_sub (service_id)');
$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, api_key VARCHAR(255) DEFAULT NULL, activation_code VARCHAR(255) DEFAULT NULL)');
, discr VARCHAR(255) NOT NULL, product_code VARCHAR(255) DEFAULT NULL, platform_id INTEGER DEFAULT NULL, api_key VARCHAR(255) DEFAULT NULL, activation_code VARCHAR(255) DEFAULT NULL)');
$this->addSql('CREATE INDEX IDX_E9ABEA72FFE6496F ON mer_service (platform_id)');
}
public function down(Schema $schema): void

View File

@ -49,7 +49,7 @@ class IndexController extends AbstractController
{
return $this->render('index/notificationDm.html.twig', [
'serviceRepo' => $repo->findByOfferId($request->query->get('offer_id')),
'beDmRepo' => $repoDm->findByOfferId($request->query->get('offer_id'))
//'beDmRepo' => $repoDm->findByOfferId($request->query->get('offer_id'))
]);
}
}

View File

@ -19,27 +19,27 @@ class MerFixtures extends Fixture
{
$ser1 = new MerParaDM();
$ser1->setMccMnc(12345)
->setPlatform((new MerDM())->setOfferId(221)->setPlatform($ser1))
->setPlatform((new MerDM())->setOfferId(221))
->setProductCode('code1');
$ser2 = new MerParaDM();
$ser2->setMccMnc(12345)
->setPlatform((new MerDM())->setOfferId(223)->setPlatform($ser2))
->setPlatform((new MerDM())->setOfferId(223))
->setProductCode('code2');
$ser3 = new MerParaDT();
$ser3->setMccMnc(12345)
->setPlatform((new MerDT())->setServiceId('ser-vi-ce1')->setPlatform($ser3))
->setPlatform((new MerDT())->setServiceId('ser-vi-ce1'))
->setApiKey('api1');
$ser4 = new MerParaDT();
$ser4->setMccMnc(12341)
->setPlatform((new MerDT())->setServiceId('ser-vi-ce2')->setPlatform($ser4))
->setPlatform((new MerDT())->setServiceId('ser-vi-ce2'))
->setApiKey('api2');
$ser5 = new MerBeDM();
$ser5->setMccMnc(12341)
->setPlatform((new MerDM())->setOfferId(112)->setPlatform($ser5))
->setPlatform((new MerDM())->setOfferId(112))
->setActivationCode('active1');
$sub1 = new MerParaSub();

View File

@ -16,6 +16,9 @@ class MerBeDM extends MerService implements OttInterface
#[ORM\Column(type: 'string', length: 255)]
private $activation_code;
#[ORM\OneToOne(targetEntity: MerDM::class, cascade: ['persist'])]
private MerDM $platform;
// public function getId(): ?int
// {
// return $this->id;
@ -32,4 +35,16 @@ class MerBeDM extends MerService implements OttInterface
return $this;
}
public function getPlatform(): ?MerDM
{
return $this->platform;
}
public function setPlatform(?MerDM $platform): self
{
$this->platform = $platform;
return $this;
}
}

View File

@ -16,6 +16,9 @@ class MerParaDM extends MerService implements OttInterface
#[ORM\Column(type: 'string', length: 255)]
private $product_code;
#[ORM\OneToOne(targetEntity: MerDM::class, cascade: ['persist'])]
private MerDM $platform;
// public function getId(): ?int
// {
// return $this->id;
@ -32,4 +35,16 @@ class MerParaDM extends MerService implements OttInterface
return $this;
}
public function getPlatform(): ?MerDM
{
return $this->platform;
}
public function setPlatform(?MerDM $platform): self
{
$this->platform = $platform;
return $this;
}
}

View File

@ -16,6 +16,9 @@ class MerParaDT extends MerService implements OttInterface
#[ORM\Column(type: 'string', length: 255)]
private $api_key;
#[ORM\OneToOne(targetEntity: MerDT::class, cascade: ['persist'])]
private MerDT $platform;
// public function getId(): ?int
// {
// return $this->id;
@ -32,4 +35,16 @@ class MerParaDT extends MerService implements OttInterface
return $this;
}
public function getPlatform(): ?MerDT
{
return $this->platform;
}
public function setPlatform(?MerDT $platform): self
{
$this->platform = $platform;
return $this;
}
}

View File

@ -27,9 +27,6 @@ abstract class MerService
#[ORM\Column(type: 'json', nullable: true)]
private $metadata = [];
#[ORM\OneToOne(targetEntity: Platform::class, cascade: ['persist'], mappedBy: 'ott')]
private Platform $platform;
public function getId(): ?int
{
return $this->id;
@ -58,16 +55,4 @@ abstract class MerService
return $this;
}
public function getPlatform(): ?Platform
{
return $this->platform;
}
public function setPlatform(?Platform $platform): self
{
$this->platform = $platform;
return $this;
}
}

View File

@ -2,6 +2,7 @@
namespace App\Repository;
use App\Entity\MerDM;
use App\Entity\MerService;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\ORM\Query;
@ -99,8 +100,9 @@ class MerServiceRepository extends ServiceEntityRepository
// return $res;
return $this->createQueryBuilder('s')
->leftJoin('s.platform_id', 'p')
->innerJoin(MerDM::class, 'p', )
->andWhere('p.offer_id = :offer_id')
->andWhere('p.offer_id IS NOT NULL')
->setParameter('offer_id', $offerId)
->getQuery()
->getResult()

View File

@ -9,5 +9,5 @@
{{ dump(serviceRepo) }}
<h1>MerBeDMRepository->findByOfferId</h1>
{{ dump(beDmRepo) }}
{# {{ dump(beDmRepo) }}#}
{% endblock %}