|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
-
- namespace Lc\SovBundle\Model\User;
-
- use Doctrine\ORM\Mapping as ORM;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- use Lc\SovBundle\Doctrine\EntityInterface;
- use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;
-
- /**
- * @ORM\MappedSuperclass()
- */
- abstract class GroupUserModel extends AbstractLightEntity implements GroupUserInterface, EntityInterface
- {
-
- /**
- * @ORM\Column(type="string", length=255)
- */
- protected $title;
-
- /**
- * @ORM\ManyToMany(targetEntity="Lc\SovBundle\Model\User\UserInterface", mappedBy="groupUsers")
- */
- protected $users;
-
-
- public function __toString()
- {
- return $this->getTitle();
- }
-
-
- public function __construct()
- {
- $this->users = new ArrayCollection();
- }
-
- public function getTitle(): ?string
- {
- return $this->title;
- }
-
- public function setTitle(string $title): self
- {
- $this->title = $title;
-
- return $this;
- }
-
-
- public function addUser(UserInterface $user): self
- {
- if (!$this->users->contains($user)) {
- $this->users[] = $user;
- }
-
- return $this;
- }
-
- /**
- * @return Collection|UserInterface[]
- */
- public function getUsers(): Collection
- {
- return $this->users;
- }
-
- public function removeUser(UserInterface $user): self
- {
- if ($this->users->contains($user)) {
- $this->users->removeElement($user);
- }
-
- return $this;
- }
-
-
- }
|