* @return Dance
*/
public function addUser(User $user): Dance {
+ //Add from owning side
+ $user->addDance($this);
+
$this->users[] = $user;
return $this;
* @return bool
*/
public function removeUser(User $user): bool {
+ if (!$this->dances->contains($user)) {
+ return true;
+ }
+
+ //Remove from owning side
+ $user->removeDance($this);
+
return $this->users->removeElement($user);
}
*/
public function preUpdate(PreUpdateEventArgs $eventArgs) {
//Check that we have a dance instance
- if (($dance = $eventArgs->getEntity()) instanceof Dance) {
+ if (($dance = $eventArgs->getObject()) instanceof Dance) {
//Set updated value
$dance->setUpdated(new \DateTime('now'));
}