2

I was changing some entry types to allow for a parent/child structure when I realised that this was already something Craft could do natively. When I undid my changes and attempted to assign a parent page, I am given the following error:

Object of class Craft\Entry Model could not be converted to int.

I am still fairly new to Craft so I am quite limited in understanding exactly what I did to break it. I can still create and edit entries, I just can't set a parent page anymore.

******************************************************************************************************
2017/10/13 22:37:16 [warning] [application] There was a problem parsing the feed: cURL error 60: SSL certificate problem: unable to get local issuer certificate

******************************************************************************************************
2017/10/13 22:37:58 [error] [php] Object of class Craft\EntryModel could not be converted to int (C:\wamp64\www\craft\storage\runtime\compiled_templates\9a\9a68f00c27a5bff3f289231a8d85ef2d821f962bf46e9f246c88cce64dc926f2.php:19)
Stack trace:
#0 C:\wamp64\www\craft\app\etc\templating\BaseTemplate.php(26): __TwigTemplate_22da5c53ac1ef5202e2f12c05417214f2feda1f7c6b451fbb37fa9ade742e5bd->displayWithErrorHandling()
#1 C:\wamp64\www\craft\app\vendor\twig\twig\lib\Twig\Template.php(403): __TwigTemplate_22da5c53ac1ef5202e2f12c05417214f2feda1f7c6b451fbb37fa9ade742e5bd->displayWithErrorHandling()
#2 C:\wamp64\www\craft\app\vendor\twig\twig\lib\Twig\Template.php(411): __TwigTemplate_22da5c53ac1ef5202e2f12c05417214f2feda1f7c6b451fbb37fa9ade742e5bd->display()
#3 C:\wamp64\www\craft\app\services\TemplatesService.php(388): __TwigTemplate_22da5c53ac1ef5202e2f12c05417214f2feda1f7c6b451fbb37fa9ade742e5bd->render()
#4 C:\wamp64\www\craft\app\helpers\ElementHelper.php(122): Craft\TemplatesService->renderObjectTemplate()
#5 C:\wamp64\www\craft\app\services\ElementsService.php(1556): setUniqueUri()
#6 C:\wamp64\www\craft\app\services\EntriesService.php(176): Craft\ElementsService->saveElement()
#7 C:\wamp64\www\craft\app\controllers\EntriesController.php(462): Craft\EntriesService->saveEntry()
#8 C:\wamp64\www\craft\app\framework\web\actions\CInlineAction.php(49): Craft\EntriesController->actionSaveEntry()
#9 C:\wamp64\www\craft\app\framework\web\CController.php(308): CInlineAction->runWithParams()
#10 C:\wamp64\www\craft\app\framework\web\CController.php(286): Craft\EntriesController->runAction()
#11 C:\wamp64\www\craft\app\framework\web\CController.php(265): Craft\EntriesController->runActionWithFilters()
#12 C:\wamp64\www\craft\app\framework\web\CWebApplication.php(282): Craft\EntriesController->run()
#13 C:\wamp64\www\craft\app\etc\web\WebApp.php(823): Craft\WebApp->runController()
#14 C:\wamp64\www\craft\app\etc\web\WebApp.php(287): Craft\WebApp->_processActionRequest()
#15 C:\wamp64\www\craft\app\framework\base\CApplication.php(185): Craft\WebApp->processRequest()
#16 C:\wamp64\www\craft\app\index.php(62): Craft\WebApp->run()
#17 C:\wamp64\www\public_html\index.php(19): require_once()
REQUEST_URI=/public_html/admin/entries/pages/90-cherries
  • 1
    Do you get this error in the Craft control panel? – carlcs Oct 13 '17 at 11:42
  • 1
    What kind of section did you initially create: channel? – RitterKnight Oct 13 '17 at 15:55
  • I made the items as the type 'Structure'. The error is thrown when I click the 'Save' button. I can edit the page's other fields etc and click 'Save' successfully, but when I add the parent page, and then Save, that is when the error is thrown. – Jodi Oct 13 '17 at 22:36
  • So an error in the CP, can you share the full error from your log file please? – carlcs Oct 14 '17 at 6:28
  • 1
    Actually no it didn't - I just had a random funny feeling about changing the link structure and tested it out and I was right. – Jodi Oct 15 '17 at 8:51
2

I was able to fix the issue - it had to do with the URL structure I had set in the Section's URL format area. For nested entries, I had put {parent-uri}/{slug} when in fact it needed to be {parent.uri}/{slug}.

I can now assign parents to entries and this is reflected in the URLs on the front end.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.