Skip to content

Commit

Permalink
Merge branch '4.0' into 4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mficzel committed Mar 4, 2019
2 parents efb01fd + 5edce23 commit 5fab2fb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
13 changes: 7 additions & 6 deletions Neos.Media/Classes/Domain/Model/AssetCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,26 +100,27 @@ public function setAssets(ArrayCollection $assets)
* Add one asset to the asset collection
*
* @param Asset $asset
* @return boolean
* @return bool
*/
public function addAsset(Asset $asset)
public function addAsset(Asset $asset): bool
{
if ($this->assets->contains($asset) === false) {
if ($asset->getAssetCollections()->contains($this) === false) {
$this->assets->add($asset);
return true;
}

return false;
}

/**
* Remove one asset from the asset collection
*
* @param Asset $asset
* @return boolean
* @return bool
*/
public function removeAsset(Asset $asset)
public function removeAsset(Asset $asset): bool
{
if ($this->assets->contains($asset) === true) {
if ($asset->getAssetCollections()->contains($this) === false) {
$this->assets->removeElement($asset);
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion Neos.Media/Classes/Domain/Repository/AssetRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ protected function addImageVariantFilterClause(Query $query)
public function findOneByResourceSha1($sha1)
{
$query = $this->createQuery();
$query->matching($query->equals('resource.sha1', $sha1, false))->setLimit(1);
$query->matching($query->equals('resource.sha1', $sha1))->setLimit(1);
return $query->execute()->getFirst();
}

Expand Down
8 changes: 5 additions & 3 deletions Neos.Neos/Classes/Controller/Service/NodesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,11 @@ public function indexAction($searchTerm = '', array $nodeIdentifiers = array(),
if ($nodeIdentifiers === array()) {
$nodes = $this->nodeSearchService->findByProperties($searchTerm, $searchableNodeTypeNames, $contentContext, $contextNode);
} else {
$nodes = array_map(function ($identifier) use ($contentContext) {
return $contentContext->getNodeByIdentifier($identifier);
}, $nodeIdentifiers);
$nodes = array_filter(
array_map(function ($identifier) use ($contentContext) {
return $contentContext->getNodeByIdentifier($identifier);
}, $nodeIdentifiers)
);
}

$this->view->assign('nodes', $nodes);
Expand Down

0 comments on commit 5fab2fb

Please sign in to comment.