Skip to content

Commit 8fba28b

Browse files
author
christophe-compere
committed
ObjectChoiceCacheService. ContentType not found.
1 parent c773bd4 commit 8fba28b

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

Service/ObjectChoiceCacheService.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,21 @@ public function load($objectIds) {
105105
}
106106
else{
107107
if(!isset($this->fullyLoaded[$ref[0]])){
108-
$alias = $this->contentTypeService->getByName($ref[0])->getEnvironment()->getAlias();
109-
if($alias){
110-
if(!array_key_exists($alias, $queries)){
111-
$queries[$alias] = ['docs' => []];
108+
$contentType = $this->contentTypeService->getByName($ref[0]);
109+
if($contentType){
110+
$alias = $contentType->getEnvironment()->getAlias();
111+
if($alias){
112+
if(!array_key_exists($alias, $queries)){
113+
$queries[$alias] = ['docs' => []];
114+
}
115+
$queries[$alias]['docs'][] = [
116+
"_type" => $ref[0],
117+
"_id" => $ref[1],
118+
];
119+
}
120+
else {
121+
$this->session->getFlashBag()->add('warning', 'ems was not able to find the alias for the content type "'.$ref[0].'"');
112122
}
113-
$queries[$alias]['docs'][] = [
114-
"_type" => $ref[0],
115-
"_id" => $ref[1],
116-
];
117123
}
118124
else {
119125
$this->session->getFlashBag()->add('warning', 'ems was not able to find the content type "'.$ref[0].'"');

0 commit comments

Comments
 (0)