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