Rapsys Git
/
airbundle
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Force cast of simple xml element to string
[airbundle]
/
Entity
/
Location.php
diff --git
a/Entity/Location.php
b/Entity/Location.php
index c379b560c8a614805d013845a31359e58553fb9b..85283df046b4db3323b5396b9d86d07c4eafa922 100644
(file)
--- a/
Entity/Location.php
+++ b/
Entity/Location.php
@@
-429,6
+429,9
@@
class Location {
* @return Location
*/
public function addUser(User $user): Location {
* @return Location
*/
public function addUser(User $user): Location {
+ //Add from owning side
+ $user->addLocation($this);
+
$this->users[] = $user;
return $this;
$this->users[] = $user;
return $this;
@@
-441,6
+444,13
@@
class Location {
* @return bool
*/
public function removeUser(User $user): bool {
* @return bool
*/
public function removeUser(User $user): bool {
+ if (!$this->locations->contains($user)) {
+ return true;
+ }
+
+ //Remove from owning side
+ $user->removeLocation($this);
+
return $this->users->removeElement($user);
}
return $this->users->removeElement($user);
}
@@
-458,7
+468,7
@@
class Location {
*/
public function preUpdate(PreUpdateEventArgs $eventArgs) {
//Check that we have a location instance
*/
public function preUpdate(PreUpdateEventArgs $eventArgs) {
//Check that we have a location instance
- if (($location = $eventArgs->get
Entity
()) instanceof Location) {
+ if (($location = $eventArgs->get
Object
()) instanceof Location) {
//Set updated value
$location->setUpdated(new \DateTime('now'));
}
//Set updated value
$location->setUpdated(new \DateTime('now'));
}