Newscoop\Service\Implementation\OutputSettingIssueServiceDoctrine::findByIssueAndOutput PHP Méthode

findByIssueAndOutput() public méthode

Provides the Output Settings Issue for the provided issue and output
public findByIssueAndOutput ( Issue | integer $issue, Output | integer | string $output ) : array
$issue Newscoop\Entity\Issue | integer The issue to be searched, not null, not empty.
$output Newscoop\Entity\Output | integer | string The output to be searched, not null, not empty.
Résultat 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;
    }