|
- <?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;
- }
-
-
- }
|