Skip to content
This repository has been archived by the owner on Aug 9, 2020. It is now read-only.

instance of Phile\Model\Page required, instance of Phile\Repository\PageCollection given #2

Closed
graphographer opened this issue Aug 15, 2015 · 6 comments
Labels

Comments

@graphographer
Copy link

"Catchable fatal error: Argument 1 passed to Phile\Plugin\Siezi\PhileAdminMarkdownEditor\Lib\PageDecorator::__construct() must be an instance of Phile\Model\Page, instance of Phile\Repository\PageCollection given, called in /Users/susieSontag/websites/phile/plugins/siezi/phileAdminMarkdownEditor/Classes/Lib/ContentRepository.php on line 165 and defined in /Users/susieSontag/websites/phile/plugins/siezi/phileAdminMarkdownEditor/Classes/Lib/PageDecorator.php on line 17"

This happens after I log into the Admin area, and then click on or navigate to "Pages".

This error, perhaps only incidentally, causes the Phile error handling plugin to use all available memory until it presumably crashes. I can only see the above error if I turn it off.

Presumably, I'm using the latest of Phile, PhileAdmin, and PhileAdminMarkdownEditor, all installed with Composer. I'm running this locally using the the PHP cli server, version 5.6.11.

@Schlaefer Schlaefer added the bug label Aug 17, 2015
@Schlaefer
Copy link
Owner

Probably an issue with Phile 1.6. I'll look into it.

@Exsaveron
Copy link

I think i found the issue:
Line 57 in ContentRepository.
return $this->decorate($pages); sends the pageCollection to the decorate
return $this->decorate($pages->toArray()); But the pages Array is expected

i assume also the decorate function could handle this, but this change was an easier workaround for me.
I hope this points in the right direction.

@Schlaefer
Copy link
Owner

I assume the problem is related to the fact that Repository\Page::findAll() doesn't return an array anymore but a class in Phile 1.6 (see note ²). So using $pages->toArray() somewhere sounds right.

@Schlaefer
Copy link
Owner

I released a new version. Check if it fixes the problem for you.

@Exsaveron
Copy link

Works for me. Thanks

@graphographer
Copy link
Author

Works for me too! Thank you kindly.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants