setPaidDays() public method

Set paid days
public setPaidDays ( integer $paidDays ) : Newscoop\Entity\SubscriptionSection
$paidDays integer
return Newscoop\Entity\SubscriptionSection
 public function setPaidDays($paidDays)
 {
     $this->__load();
     return parent::setPaidDays($paidDays);
 }
Ejemplo n.º 2
0
 /**
  * Add sections
  *
  * @param array $values
  * @param Newscoop\Entity\Publication $publication
  * @return void
  */
 public function addSections(array $values, \Newscoop\Entity\Publication $publication)
 {
     $languages = array();
     if (!empty($values['individual_languages']) && $values['individual_languages']) {
         $languages = $values['languages'];
         if (empty($languages)) {
             throw new \InvalidArgumentException("No languages set for individual languages");
         }
     }
     foreach ($publication->getIssues() as $issue) {
         if (!empty($languages) && !in_array($issue->getLanguageId(), $languages)) {
             continue;
         }
         foreach ($issue->getSections() as $section) {
             if ($this->hasSection($section, $languages)) {
                 continue;
             }
             $subSection = new Section($this, $section->getNumber());
             $subSection->setStartDate(new \DateTime($values['start_date']));
             $subSection->setDays($values['days']);
             if ($this->isTrial() || $values['type'] === self::TYPE_PAID_NOW) {
                 $subSection->setPaidDays($values['days']);
             }
             if (!empty($languages)) {
                 $subSection->setLanguage($issue->getLanguage());
             }
         }
     }
 }