|
- <?php
-
- namespace Lc\ShopBundle\Model;
-
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- use Doctrine\ORM\Mapping as ORM;
- use Lc\ShopBundle\Context\FilterMerchantInterface;
- use Lc\ShopBundle\Context\ReductionInterface;
- use Lc\ShopBundle\Context\ReductionPropertyInterface;
- use Lc\ShopBundle\Context\StatusInterface;
-
- /**
- * @ORM\MappedSuperclass()
- */
- abstract class ReductionCredit extends AbstractEntity implements ReductionInterface, FilterMerchantInterface, StatusInterface
- {
- use ReductionTrait;
- use StatusTrait;
-
-
- /**
- * @ORM\Column(type="string", length=255)
- */
- protected $title;
-
- /**
- * @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\UserInterface")
- */
- protected $users;
-
- /**
- * @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface")
- * @ORM\JoinColumn(nullable=false)
- */
- protected $merchant;
-
-
-
- public function __construct()
- {
- $this->users = new ArrayCollection();
- $this->unit = 'amount';
- }
-
- public function __toString()
- {
- return $this->title;
- }
-
- public function getTitle(): ?string
- {
- return $this->title;
- }
-
- public function setTitle(string $title): self
- {
- $this->title = $title;
-
- return $this;
- }
-
-
- public function getMerchant(): ?Merchant
- {
- return $this->merchant;
- }
-
- public function setMerchant(?Merchant $merchant): self
- {
- $this->merchant = $merchant;
-
- return $this;
- }
-
- /**
- * @return Collection|User[]
- */
- public function getUsers(): Collection
- {
- return $this->users;
- }
-
- public function addUser(User $user): self
- {
- if (!$this->users->contains($user)) {
- $this->users[] = $user;
- }
-
- return $this;
- }
-
- public function removeUser(User $user): self
- {
- if ($this->users->contains($user)) {
- $this->users->removeElement($user);
- }
-
- return $this;
- }
- }
|