|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- <?php
-
- namespace Lc\CaracoleBundle\Model\Reduction;
-
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- use Doctrine\ORM\Mapping as ORM;
- use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface;
- use Lc\CaracoleBundle\Doctrine\Extension\ReductionInterface;
- use Lc\CaracoleBundle\Doctrine\Extension\ReductionTrait;
- use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
- use Lc\SovBundle\Doctrine\Extension\StatusInterface;
- use Lc\SovBundle\Doctrine\Extension\StatusTrait;
- use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;
- use Lc\SovBundle\Model\User\UserInterface;
-
- /**
- * @ORM\MappedSuperclass()
- */
- abstract class ReductionCreditModel extends AbstractLightEntity implements ReductionInterface, FilterMerchantInterface,
- StatusInterface
- {
- const TYPE_CREDIT = 'credit';
- const TYPE_GIFT = 'gift';
-
-
- use ReductionTrait;
- use StatusTrait;
-
-
- /**
- * @ORM\Column(type="string", length=255)
- */
- protected $title;
-
- /**
- * @ORM\ManyToMany(targetEntity="Lc\SovBundle\Model\User\UserInterface", inversedBy="reductionCredits")
- */
- protected $users;
-
-
- /**
- * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface")
- * @ORM\JoinColumn(nullable=false)
- */
- protected $merchant;
-
- /**
- * @ORM\Column(type="string", length=255)
- */
- protected $type;
-
- /**
- * @ORM\Column(type="boolean", nullable=true)
- */
- protected $sended;
-
- /**
- * @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface")
- */
- protected $owner;
-
- 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(): ?MerchantInterface
- {
- return $this->merchant;
- }
-
- public function setMerchant(?MerchantInterface $merchant): self
- {
- $this->merchant = $merchant;
-
- return $this;
- }
-
-
- public function getType(): ?string
- {
- return $this->type;
- }
-
- public function setType(string $type): self
- {
- $this->type = $type;
-
- return $this;
- }
-
- /**
- * @return Collection|UserInterface[]
- */
- public function getUsers(): Collection
- {
- return $this->users;
- }
-
- public function addUser(UserInterface $user): self
- {
- if (!$this->users->contains($user)) {
- $this->users[] = $user;
- }
-
- return $this;
- }
-
- public function removeUser(UserInterface $user): self
- {
- if ($this->users->contains($user)) {
- $this->users->removeElement($user);
- }
-
- return $this;
- }
-
-
- public function getSended(): ?bool
- {
- return $this->sended;
- }
-
- public function setSended(?bool $sended): self
- {
- $this->sended = $sended;
-
- return $this;
- }
-
-
- public function getOwner(): ?UserInterface
- {
- return $this->owner;
- }
-
- public function setOwner(?UserInterface $owner): self
- {
- $this->owner = $owner;
-
- return $this;
- }
- }
|