-
-
Save cod1ingcoding/0b71a0558fb5a05bb3c7915c9cfdea5c to your computer and use it in GitHub Desktop.
Revisions
-
Ocramius revised this gist
Mar 30, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,7 +20,7 @@ class UserGroup /** * @var \Doctrine\Common\Collections\Collection|User[] * * @ORM\ManyToMany(targetEntity="User", mappedBy="userGroups") */ protected $users; -
Ocramius revised this gist
Aug 18, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -31,7 +31,7 @@ class User * } * ) */ protected $userGroups; /** * Default constructor, initializes collections -
Ocramius revised this gist
Feb 19, 2013 . 2 changed files with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,7 +20,7 @@ class User /** * @var \Doctrine\Common\Collections\Collection|UserGroup[] * * @ORM\ManyToMany(targetEntity="UserGroup", inversedBy="users") * @ORM\JoinTable( * name="user_usergroup", * joinColumns={ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,7 +20,7 @@ class UserGroup /** * @var \Doctrine\Common\Collections\Collection|User[] * * @ORM\ManyToMany(targetEntity="User", mappedBy="groups") */ protected $users; -
Ocramius revised this gist
Aug 9, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -48,7 +48,7 @@ public function addUser(User $user) /** * @param User $user */ public function removeUser(User $user) { if (!$this->users->contains($user)) { return; -
Ocramius created this gist
Jul 16, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,69 @@ <?php use Doctrine\ORM\Mapping as ORM; use Doctrine\Common\Collections\ArrayCollection; /** * @ORM\Entity() * @ORM\Table(name="user") */ class User { /** * @var int|null * @ORM\Id() * @ORM\GeneratedValue(strategy="AUTO") * @ORM\Column(type="integer", name="id") */ protected $id; /** * @var \Doctrine\Common\Collections\Collection|UserGroup[] * * @ORM\ManyToMany(targetEntity="UserGroup", inversedBy="blocks") * @ORM\JoinTable( * name="user_usergroup", * joinColumns={ * @ORM\JoinColumn(name="user_id", referencedColumnName="id") * }, * inverseJoinColumns={ * @ORM\JoinColumn(name="usergroup_id", referencedColumnName="id") * } * ) */ protected $groups; /** * Default constructor, initializes collections */ public function __construct() { $this->userGroups = new ArrayCollection(); } /** * @param UserGroup $userGroup */ public function addUserGroup(UserGroup $userGroup) { if ($this->userGroups->contains($userGroup)) { return; } $this->userGroups->add($userGroup); $userGroup->addUser($this); } /** * @param UserGroup $userGroup */ public function removeUserGroup(UserGroup $userGroup) { if (!$this->userGroups->contains($userGroup)) { return; } $this->userGroups->removeElement($userGroup); $userGroup->removeUser($this); } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,60 @@ <?php use Doctrine\ORM\Mapping as ORM; use Doctrine\Common\Collections\ArrayCollection; /** * @ORM\Entity() * @ORM\Table(name="usergroup") */ class UserGroup { /** * @var int|null * @ORM\Id() * @ORM\GeneratedValue(strategy="AUTO") * @ORM\Column(type="integer", name="id") */ protected $id; /** * @var \Doctrine\Common\Collections\Collection|User[] * * @ORM\ManyToMany(targetEntity="User", mappedBy="blocks") */ protected $users; /** * Default constructor, initializes collections */ public function __construct() { $this->users = new ArrayCollection(); } /** * @param User $user */ public function addUser(User $user) { if ($this->users->contains($user)) { return; } $this->users->add($user); $user->addUserGroup($this); } /** * @param User $user */ public function removeUserGroup(User $user) { if (!$this->users->contains($user)) { return; } $this->users->removeElement($user); $user->removeUserGroup($this); } }