Hello
Related #7600
Describe the bug
After #7600 on my project I got a bug - createEntity called unexpectly while editing entries.
To Reproduce
class CrossSell
{
__construct(
#[ORM\ManyToOne(targetEntity: CrossSellCampaign::class, inversedBy: 'crossSells')]
#[ORM\JoinColumn(name: 'campaign_id', nullable: false)]
private CrossSellCampaign $campaign,
)
{
$this->campaign->addCrossSell($this); // this needed to consistent two-way relations (Symfony way)
}
}
class CrossSellCrudController extends AbstractCrudController
{
public function createEntity(string $entityFqcn): CrossSell
{
$campaign = $this->em->getRepository(CrossSellCampaign::class)->findOneBy([]);
assert($campaign instanceof CrossSellCampaign);
$po = $this->em->getRepository(PriceOption::class)->findOneBy([]);
assert($po instanceof PriceOption);
$entity = new CrossSell(
$campaign,
$po,
position: 0,
placement: PlacementEnum::PROMO_BLOCK,
actionType: ActionTypeEnum::ADD,
);
return $entity;
}
}
After edit form opened a new random element is added to Campaign since createEntity is called unexpectedly.
Hello
Related #7600
Describe the bug
After #7600 on my project I got a bug - createEntity called unexpectly while editing entries.
To Reproduce
After edit form opened a new random element is added to Campaign since createEntity is called unexpectedly.