This works fine on localhost but crashes on remote Server. I can return one category, but it will crash when I try to display multiple categories. I also tried to save the categories in a variable and return the variable, which again worked on localhost but not on remote Server.
'programevent.json' => [
'elementType' => ElementType::Entry,
// 'cache' => true,
'elementsPerPage' => 999,
'paginate' => false,
'limit' => 999,
'criteria' => ['section' => 'program','type' =>'Event'],
'transformer' => function(EntryModel $entry) {
HeaderHelper::setHeader([
'Access-Control-Allow-Origin' => '*'
]);
$parent = $entry->getParent();
return [
'title' => $entry->title,
'url' => $entry->url,
'id' => $entry->id,
'description' => (string) $entry->description,
'level' => $entry->level,
'themes' => array_map( function (CategoryModel $category) {
return [
'id' => $category->id,
'title' => $category->title
];
}, $entry->themes->find()),
'kindOfEvent' => array_map( function (CategoryModel $category) {
return [
'id' => $category->id,
'title' => $category->title
];
}, $entry->kindOfEvent->find()),
'languages' => array_map( function (CategoryModel $category) {
return [
'id' => $category->id,
'title' => $category->title
];
}, $entry->languages->find()),
'parent' => $parent ? [
'title' => $parent->title,
'number' => $parent->number,
'url' => $parent->url,
'shuttleLine' => array_map( function (CategoryModel $category) {
return [
'title' => $category->title,
'color' => $category->color
];
}, $parent->shuttleLine->find()),
] : null,
];
},
],
craft/storage/runtime/logs
. If it's web server generated, it'll be in your web server's error logs. – Brad Bell Nov 21 '17 at 16:40PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 65552 bytes)
– user2190590 Nov 22 '17 at 17:08