/**
* Provides the Output Settings that has the provided Section.
*
* @param Section|int $section
* The section to be searched, not null, not empty.
* @param Output|int|string $output
*
* @return Newscoop\Entity\OutputSettingsSection
* The Output Setting, NULL if no Output Setting could be found for the provided section.
*/
public function findBySectionAndOutput($section, $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 Section object is supplied */
/* @var $section Section */
$sectionId = $section;
if ($section instanceof Section) {
$sectionId = $section->getId();
}
$em = $this->getManager();
$repository = $em->getRepository($this->entityClassName);
$resources = $repository->findBy(array('section' => $sectionId, 'output' => $outputId));
if (!empty($resources)) {
return $resources[0];
}
return NULL;
}