Skip to content

Commit

Permalink
Merge pull request #1038 from sourcefabric/v4.3
Browse files Browse the repository at this point in the history
V4.3
  • Loading branch information
Paweł Mikołajczuk committed Mar 19, 2015
2 parents f6d5223 + 7e7520a commit a9921ad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion newscoop/library/Newscoop/Article/LinkService.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public function getSectionShortName(Article $article)
'number' => $article->getSectionId(),
'publication' => $article->getPublicationId(),
'language' => $article->getLanguageId(),
'issue' => $issue->getId(),
'issue' => $issue ? $issue->getId() : null,
));

return $section ? $section->getShortName() : null;
Expand Down
16 changes: 7 additions & 9 deletions newscoop/library/Newscoop/Article/SearchService.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,12 @@ public function __construct(
WebcodeFacade $webcoder,
RenditionService $renditionService,
LinkService $linkService,
EntityManager $em,
$config = null
)
{
EntityManager $em
) {
$this->webcoder = $webcoder;
$this->renditionService = $renditionService;
$this->linkService = $linkService;
$this->em = $em;
if ($config !== null && is_array($config)) {
$this->config = array_merge($this->config, $config);
}
}

/**
Expand Down Expand Up @@ -119,7 +114,6 @@ public function isIndexed(DocumentInterface $article)
public function isIndexable(DocumentInterface $article)
{
return $article->isPublished()
&& in_array($article->getType(), $this->config['type'])
&& $article->getLanguageId() > 0
&& $article->getSectionId() > 0;
}
Expand All @@ -132,7 +126,11 @@ public function isIndexable(DocumentInterface $article)
*/
public function getDocument(DocumentInterface $article)
{
$image = $this->renditionService->getArticleRenditionImage($article->getNumber(), $this->config['rendition'], 200, 150);
$image = null;
$renditions = $this->renditionService->getRenditions();
if (is_array($renditions) && count($renditions) > 0) {
$image = $this->renditionService->getArticleRenditionImage($article->getNumber(), key($renditions));
}

$webcode = $this->webcoder->getArticleWebcode($article);
if (strpos($webcode, 0, 1) != '+') {
Expand Down

0 comments on commit a9921ad

Please sign in to comment.