47 search results

…https://knpuniversity.com/screencast/collections/synchronizing-mapping-inverse https://knpuniversity.com/screencast/collections/collection-delete-orphan-removal From my point of view generated code could not save us from the error. And Maker Bundle should explicitly set orphanRemoval to true because of a DB-state…
toporovvv
toporovvv
Read Full Comment
…be a bit tricky, as you need to make sure you "unlink" the relationship in the removeXX method and also probably need to use the orphanRemoval option so that Doctrine fully deletes the removed Creditcards (not just unlink them from the Survey). Your way is…
weaverryan
weaverryan
Read Full Comment
…so when you remove an answer, you do so by setting its `question` field to `null`, and that is where the "orphan removal" feature of Doctrine kicks in. It will detect those cases and remove the record entirely. I hope it is more clear now :)
MolloKhan
MolloKhan
Read Full Comment
…be deleted instead? Because of `orphanRemoval`: https://symfonycasts.com/screencast/api-platform/collections-remove-item. With that in place, if the `owner` of a `DragonTreasure` is set to `null`, instead of saving that, Doctrine deletes the `DragonTreasure` entirely. So perhaps `orphanRemoval` is missing. Or some…
weaverryan
weaverryan
Read Full Comment
…groups: ['read:User'])] private ?string $lastName = null; #[ORM\OneToMany(mappedBy: 'username', targetEntity: UserRole::class, cascade: ['all'], orphanRemoval: true)] #[Groups(groups: ['read:User'])] private Collection $userRoles; #[ORM\Column(length: 2000, nullable: true)] private ?string $password = null; public function __construct() { $this->userRoles = new ArrayCollection(); } …
…isCascadeDetach' => false, 'sourceToTargetKeyColumns' => array('product_id' => 'id'), 'joinColumnFieldNames' => array('product_id' => 'product_id'), 'targetToSourceKeyColumns' => array('id' => 'product_id'), 'orphanRemoval' => false), object(Product)), array(array('fieldName' => 'product', 'joinColumns' => array(array('name' => 'product_id', 'unique' =>…
… Hmm, good catch. I would probably use orphan removal for this. This would go on the Question.questionTags property (if I'm thinking straight at the moment). It basically says "if a QuestionTag gets orphaned from a Question (which would happen when setting QuestionTag.question…
weaverryan
weaverryan
Read Full Comment