Skip to content

Commit

Permalink
Merge pull request #72 from monarc-project/fix-objects-disappearing
Browse files Browse the repository at this point in the history
Update MonarcObject.php
  • Loading branch information
ruslanbaidan authored May 14, 2024
2 parents 877c088 + 99e6c06 commit ee41bf5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Model/Entity/MonarcObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* @ORM\Index(name="rolf_tag_id", columns={"rolf_tag_id"})
* })
* @ORM\Entity
* @ORM\HasLifecycleCallbacks()
*/
class MonarcObject extends ObjectSuperClass
{
Expand Down Expand Up @@ -59,4 +60,16 @@ class MonarcObject extends ObjectSuperClass
* })
*/
protected $asset;

/**
* @ORM\PreUpdate
*/
public function validateAndSetMissingAnrLink(): self
{
if (!$this->anrs->contains($this->anr)) {
$this->anrs->add($this->anr);
}

return $this;
}
}

0 comments on commit ee41bf5

Please sign in to comment.