I am using the 3.0 Tree Behavior.
I have the following from the docs:
$pages = $this-Pages-find('treeList');
http://book.cakephp.org/3.0/en/core-libraries/behaviors/tree.html
This just doesn't feel right. It isn't returning a list at all. Should I
be doing something else, like:
$pages =
Not sure what you mean with It isn't returning a list at all. Can you
explain?
On Friday, July 11, 2014 9:47:27 AM UTC+2, Michael Houghton wrote:
I am using the 3.0 Tree Behavior.
I have the following from the docs:
$pages = $this-Pages-find('treeList');
Hey Jose
Sure thing. This seems like a similar issue that I had with:
$this-Models-findByField($name)-first();
If you recall, I missed the - first() and was trying:
$this-Models-findByField($name);
Which just gives a whole lot of data on the schema.
With the tree behavior, I am calling:
All find() methods returns a query object. All query objects have a first()
and toArray() method. If you want to see the results of your find you can
do:
$pages = $this-Pages-find('treeList')-toArray();
On Friday, July 11, 2014 10:28:58 AM UTC+2, Michael Houghton wrote:
Hey Jose
Sure
Thanks Jose - that seems to be it! It might be worth updating the Tree docs
to show this.
Unfortunately, that is still giving me the error:
*Error: * Function name must be a string
*File*
/home/michael/public_html/bettornet/vendor/cakephp/cakephp/src/Collection/Iterator/TreePrinter.php
Can you gist your full code, I have no idea what that error is.
On Friday, July 11, 2014 11:49:40 AM UTC+2, Michael Houghton wrote:
Thanks Jose - that seems to be it! It might be worth updating the Tree
docs to show this.
Unfortunately, that is still giving me the error:
*Error: *
Hey Jose
Here it is:
https://gist.github.com/cakecoded/59511a440dfb9c5c7628
On Friday, July 11, 2014 12:44:56 PM UTC+1, José Lorenzo wrote:
Can you gist your full code, I have no idea what that error is.
On Friday, July 11, 2014 11:49:40 AM UTC+2, Michael Houghton wrote:
Thanks Jose - that
I cannot reproduce this issue. What PHP version do you have? Can you paste
the the contents of the line where it is throwing the fatal error?
On Friday, July 11, 2014 2:28:11 PM UTC+2, Michael Houghton wrote:
Hey Jose
Here it is:
https://gist.github.com/cakecoded/59511a440dfb9c5c7628
On