'AccessIntangible', 'educationalproject' => 'EducationalProjectIntangible'])] abstract class AbstractBillingIntangible { use TimestampableEntity; use CreatorUpdaterEntity; use ActivityPeriodTrait; use BillingRuleTrait; /** * @var int */ #[ORM\Column(type: 'integer')] #[ORM\Id] #[ORM\GeneratedValue(strategy: 'AUTO')] #[Groups(['accessintangible', 'educationalprojectintangible', 'access_details', 'student_registration', 'educationalproject_details', 'accessbilling_edit'])] private $id; /** * @var Intangible */ #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Product\Intangible', inversedBy: 'accessIntangibles')] #[ORM\JoinColumn(nullable: false)] #[Assert\NotNull] #[Groups(['accessintangible', 'accessintangible_intangible', 'educationalprojectintangible', 'access_details_accessintangibles', 'student_registration_accessintangibles', 'educationalproject_details_educationalprojectintangibles', 'accessbilling_edit_accessintangibles', 'access_intangible_list'])] private $intangible; /** * @var string * * @Iri("https://schema.org/description") */ #[ORM\Column(type: 'text', nullable: true)] #[Assert\Type(type: 'string')] #[Groups(['accessintangible', 'educationalprojectintangible', 'student_registration_accessintangibles', 'accessbilling_edit_accessintangibles', 'access_intangible_list'])] private $customDescription; /** * @var int */ #[ORM\Column(type: 'integer', nullable: true)] #[Assert\Type(type: 'integer', message: 'invalid-integer')] #[Groups(['accessintangible', 'educationalprojectintangible', 'student_registration_accessintangibles', 'accessbilling_edit_accessintangibles'])] private $quantity; /** * @var float */ #[ORM\Column(type: 'float', nullable: true)] #[Assert\Type(type: 'float')] #[Groups(['accessintangible', 'educationalprojectintangible', 'student_registration_accessintangibles', 'accessbilling_edit_accessintangibles'])] private $forcedAmount; /** * @var bool */ #[ORM\Column(type: 'boolean', options: ['default' => false])] #[Assert\Type(type: 'boolean')] #[Assert\NotNull] #[Groups(['accessintangible', 'educationalprojectintangible', 'student_registration_accessintangibles', 'accessbilling_edit_accessintangibles'])] private $isForcedAmount = false; /** * @var ArrayCollection */ #[ORM\ManyToMany(targetEntity: 'AppBundle\Entity\Core\Tagg', cascade: ['persist'], inversedBy: 'billingIntangibles')] #[Assert\Valid] #[ORM\JoinTable(name: 'tag_billingIntangible', joinColumns: [], inverseJoinColumns: [])] #[ORM\JoinColumn(name: 'billingIntangible_id', referencedColumnName: 'id')] #[ORM\JoinColumn(name: 'tag_id', referencedColumnName: 'id')] #[Groups(['billingintangible_tags', 'manage_tags', 'access_intangible_list'])] private $tags; /** * The constructor */ public function __construct() { $this->tags= new ArrayCollection(); } /** * Sets id. * * @param int $id * * @return $this */ public function setId($id) { $this->id = $id; return $this; } /** * Gets id. * * @return int */ public function getId() { return $this->id; } /** * Set customDescription * * @param string $customDescription * * @return AbstractBillingIntangible */ public function setCustomDescription($customDescription) { $this->customDescription = $customDescription; return $this; } /** * Get customDescription * * @return string */ public function getCustomDescription() { return $this->customDescription; } /** * Set quantity * * @param integer $quantity * * @return AbstractBillingIntangible */ public function setQuantity($quantity) { $this->quantity = $quantity; return $this; } /** * Get quantity * * @return integer */ public function getQuantity() { return $this->quantity; } /** * Set forcedAmount * * @param float $forcedAmount * * @return AbstractBillingIntangible */ public function setForcedAmount($forcedAmount) { $this->forcedAmount = floatval($forcedAmount); return $this; } /** * Get forcedAmount * * @return float */ public function getForcedAmount() { return $this->forcedAmount; } /** * Set isForcedAmount * * @param boolean $isForcedAmount * * @return AbstractBillingIntangible */ public function setIsForcedAmount($isForcedAmount) { $this->isForcedAmount = $isForcedAmount; return $this; } /** * Get isForcedAmount * * @return boolean */ public function getIsForcedAmount() { return $this->isForcedAmount; } /** * Set intangible * * @param \AppBundle\Entity\Product\Intangible $intangible * * @return AbstractBillingIntangible */ public function setIntangible(\AppBundle\Entity\Product\Intangible $intangible) { $this->intangible = $intangible; return $this; } /** * Get intangible * * @return \AppBundle\Entity\Product\Intangible */ public function getIntangible() { return $this->intangible; } /** * Add tag * * @param \AppBundle\Entity\Core\Tagg $tag * * @return AbstractBillingIntangible */ public function addTag(\AppBundle\Entity\Core\Tagg $tag) { $this->tags[] = $tag; return $this; } /** * Remove tag * * @param \AppBundle\Entity\Core\Tagg $tag */ public function removeTag(\AppBundle\Entity\Core\Tagg $tag) { $this->tags->removeElement($tag); } /** * Get tags * * @return \Doctrine\Common\Collections\Collection */ public function getTags() { return $this->tags; } /** * Sets start date * * @param \DateTime $startDate * @return $this */ public function setStartDate(\DateTime $startDate = null) { if($startDate == null) $startDate = new \DateTime(); $this->startDate = $startDate; if(!empty($this->getIntangible()) && $this->getIntangible()->getBillingPeriodicityType() === PeriodicityTypeEnum::PUNCTUAL){ $this->setEndDate($startDate); } return $this; } public function setEndDate(\DateTime $endDate = null) { if(empty($endDate) && !empty($this->getIntangible()) && $this->getIntangible()->getBillingPeriodicityType() === PeriodicityTypeEnum::PUNCTUAL){ return $this; } $this->endDate = $endDate; return $this; } }