getId() public method

Get id
public getId ( ) : integer
return integer
 public function getId()
 {
     if ($this->__isInitialized__ === false) {
         return (int) $this->_identifier["id"];
     }
     $this->__load();
     return parent::getId();
 }
示例#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"));
 }
 /**
  * Provides the Output Settings Issue for the provided issue and output
  *
  * @param Issue|int $issue
  * 		The issue to be searched, not null, not empty.
  * @param Output|int|string $output
  * 		The output to be searched, not null, not empty.
  *
  * @return array Newscoop\Entity\Output\OutputSettingsIssue
  * 		The Output Setting, NULL if no Output Setting could be found for the provided issue.
  */
 public function findByIssueAndOutput($issue, $output)
 {
     /** Get the id if an Output object is supplied */
     /* @var $output Output */
     $outputId = $output;
     if ($output instanceof Output) {
         $outputId = $output->getId();
     }
     /** Get the id if an Issue object is supplied */
     /* @var $issue Issue */
     $issueId = $issue;
     if ($issue instanceof Issue) {
         $issueId = $issue->getId();
     }
     $em = $this->getManager();
     $repository = $em->getRepository($this->entityClassName);
     $resources = $repository->findBy(array('issue' => $issueId, 'output' => $outputId));
     if (!empty($resources)) {
         return $resources[0];
     }
     return NULL;
 }
示例#4
0
 /**
  * Finds output for issue by issue and output
  *
  * @param Issue  $issue  Issue object
  * @param Output $output Output object
  *
  * @return string|null
  */
 public function findByIssueAndOutput($issue, $output)
 {
     $outputId = $output;
     if ($output instanceof Output) {
         $outputId = $output->getId();
     }
     $issueId = $issue;
     if ($issue instanceof Issue) {
         $issueId = $issue->getId();
     }
     $resources = $this->em->getRepository('Newscoop\\Entity\\Output\\OutputSettingsIssue')->findBy(array('issue' => $issueId, 'output' => $outputId));
     if (!empty($resources)) {
         return $resources[0];
     }
     return null;
 }
 /**
  * Get the page for error
  *      to be used as a template.
  *
  * @param Issue|Int $issue
  *      The issue object or the id of the issue for whom the template is needed.
  * @param Output|int|string $output
  *      The object Output, the id or the Name of the Output for whom the template is needed.
  *
  * @return string
  *      The full path of the template.
  */
 public function getErrorPage($issue, $output)
 {
     /* @var $issue Issue */
     $issueId = $issue;
     if ($issue instanceof Issue) {
         $issueId = $issue->getId();
     } else {
         $issue = $this->getIssueService()->getById($issueId);
     }
     $publicationId = $issue->getPublicationId();
     $outputId = $output;
     if ($output instanceof Output) {
         $outputId = $output->getId();
     }
     $em = $this->getManager();
     $q = $em->createQueryBuilder();
     $q->select(array('oi', 'ot'))->from(OutputSettingsTheme::NAME, 'ot')->from(OutputSettingsIssue::NAME_1, 'oi')->where('ot.themePath = oi.themePath')->andWhere('ot.publication = :publication')->andWhere('ot.output = :output')->andWhere('oi.output = :output')->andWhere('oi.issue = :issue')->setParameter('output', $outputId)->setParameter('issue', $issueId)->setParameter('publication', $publicationId);
     $results = $q->getQuery()->getResult();
     if (count($results) < 2) {
         return '';
     }
     /* @var $outputSettingTheme OutputSettingsTheme */
     list(, $outputSettingTheme) = each($results);
     /* @var $outputSettingIssue OutputSettingsIssue */
     list(, $outputSettingIssue) = each($results);
     if (!is_null($resource = $outputSettingIssue->getErrorPage())) {
         return $this->getResourceFullPath($resource);
     }
     return $this->getResourceFullPath($outputSettingTheme->getErrorPage());
 }