Exemplo n.º 1
0
 /**
  * Save language
  *
  * @param Newscoop\Entity\Language $language
  * @param array $values
  * @return void
  */
 public function save(Language $language, array $values)
 {
     $em = $this->getEntityManager();
     $language->setName($values['name'])->setNativeName($values['native_name'])->setCodePage($values['code_page'])->setCode($values['code'])->setMonth1($values['month1'])->setMonth2($values['month2'])->setMonth3($values['month3'])->setMonth4($values['month4'])->setMonth5($values['month5'])->setMonth6($values['month6'])->setMonth7($values['month7'])->setMonth8($values['month8'])->setMonth9($values['month9'])->setMonth10($values['month10'])->setMonth11($values['month11'])->setMonth12($values['month12'])->setShortMonth1($values['short_month1'])->setShortMonth2($values['short_month2'])->setShortMonth3($values['short_month3'])->setShortMonth4($values['short_month4'])->setShortMonth5($values['short_month5'])->setShortMonth6($values['short_month6'])->setShortMonth7($values['short_month7'])->setShortMonth8($values['short_month8'])->setShortMonth9($values['short_month9'])->setShortMonth10($values['short_month10'])->setShortMonth11($values['short_month11'])->setShortMonth12($values['short_month12'])->setDay1($values['day1'])->setDay2($values['day2'])->setDay3($values['day3'])->setDay4($values['day4'])->setDay5($values['day5'])->setDay6($values['day6'])->setDay7($values['day7'])->setShortDay1($values['short_day1'])->setShortDay2($values['short_day2'])->setShortDay3($values['short_day3'])->setShortDay4($values['short_day4'])->setShortDay5($values['short_day5'])->setShortDay6($values['short_day6'])->setShortDay7($values['short_day7']);
     $em->persist($language);
     $em->flush();
 }
Exemplo n.º 2
0
 public function it_resolves_issue_from_request_data(Request $request, Issue $issue, ParameterBag $attributes)
 {
     $request->getRequestUri()->willReturn('/en/may2014/60/test-article.htm');
     $issue->getId()->willReturn(1);
     $issue->getNumber()->willReturn(10);
     $issue->getName()->willReturn("May 2014");
     $issue->getShortName()->willReturn("may2014");
     $language = new Language();
     $language->setId(1);
     $language->setCode("en");
     $issue->getLanguage()->willReturn($language);
     $issue->getLanguageId()->willReturn("1");
     $request->attributes = $attributes;
     $this->issueResolver($request)->shouldReturn($issue);
     $this->getIssueMetadata()->shouldBeLike(array("id" => 1, "number" => 10, "name" => "May 2014", "shortName" => "may2014", "code_default_language" => "en", "id_default_language" => "1"));
 }
Exemplo n.º 3
0
 public function it_resolves_issue_from_request_data(Request $request, Issue $issue, ParameterBag $attributes, $repository, $publication, $query)
 {
     $repository->findOneBy(array('publication' => $publication, 'shortName' => 'may2014'))->willReturn($issue);
     $repository->getIssue('en', $publication, 'may2014')->willReturn($query);
     $query->getOneOrNullResult()->willReturn($issue);
     $request->getRequestUri()->willReturn('/en/may2014/60/test-article.htm');
     $issue->getId()->willReturn(1);
     $issue->getNumber()->willReturn(10);
     $issue->getName()->willReturn("May 2014");
     $issue->getShortName()->willReturn("may2014");
     $language = new Language();
     $language->setId(1);
     $language->setCode("en");
     $issue->getLanguage()->willReturn($language);
     $issue->getLanguageId()->willReturn("1");
     $request->attributes = $attributes;
     $this->issueResolver($request)->shouldReturn($issue);
     $this->getIssueMetadata()->shouldBeLike(array("id" => 1, "number" => 10, "name" => "May 2014", "shortName" => "may2014", "code_default_language" => "en", "id_default_language" => "1"));
 }
Exemplo n.º 4
0
 /**
  * Set default values by entity
  *
  * @param Newscoop\Entity\Language $language
  * @return void
  */
 public function setDefaultsFromEntity(Language $language)
 {
     $this->setDefaults(array('name' => $language->getName(), 'native_name' => $language->getNativeName(), 'code_page' => $language->getCodePage(), 'code' => $language->getCode(), 'month1' => $language->getMonth1(), 'month2' => $language->getMonth2(), 'month3' => $language->getMonth3(), 'month4' => $language->getMonth4(), 'month5' => $language->getMonth5(), 'month6' => $language->getMonth6(), 'month7' => $language->getMonth7(), 'month8' => $language->getMonth8(), 'month9' => $language->getMonth9(), 'month10' => $language->getMonth10(), 'month11' => $language->getMonth11(), 'month12' => $language->getMonth12(), 'short_month1' => $language->getShortMonth1(), 'short_month2' => $language->getShortMonth2(), 'short_month3' => $language->getShortMonth3(), 'short_month4' => $language->getShortMonth4(), 'short_month5' => $language->getShortMonth5(), 'short_month6' => $language->getShortMonth6(), 'short_month7' => $language->getShortMonth7(), 'short_month8' => $language->getShortMonth8(), 'short_month9' => $language->getShortMonth9(), 'short_month10' => $language->getShortMonth10(), 'short_month11' => $language->getShortMonth11(), 'short_month12' => $language->getShortMonth12(), 'day1' => $language->getDay1(), 'day2' => $language->getDay2(), 'day3' => $language->getDay3(), 'day4' => $language->getDay4(), 'day5' => $language->getDay5(), 'day6' => $language->getDay6(), 'day7' => $language->getDay7(), 'short_day1' => $language->getShortDay1(), 'short_day2' => $language->getShortDay2(), 'short_day3' => $language->getShortDay3(), 'short_day4' => $language->getShortDay4(), 'short_day5' => $language->getShortDay5(), 'short_day6' => $language->getShortDay6(), 'short_day7' => $language->getShortDay7()));
 }
Exemplo n.º 5
0
 /**
  * Set caption
  *
  * @param string $caption
  * @param Newscoop\Entity\Language $language
  * @return void
  */
 public function setCaption($caption, Language $language)
 {
     if (!isset($this->captions[$language->getId()])) {
         $this->captions[$language->getId()] = new ArticleImageCaption($this, $language);
     }
     $this->captions[$language->getId()]->setCaption($caption);
 }
 public function getShortDay7()
 {
     $this->__load();
     return parent::getShortDay7();
 }