Re: 3.0 Tree Behavior - understanding find('treeList')
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'); 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 = $this-Pages-find('treeList')-all(); It just feels like I am missing something here. When I put my $pages variable into my 'options' = $pages for my form select, I get the following error: *Error: * Function name must be a string *File* /home/michael/public_html/bettornet/vendor/cakephp/cakephp/src/Collection/Iterator/TreePrinter.php *Line: * 77 Any help with this would be appreciated. Thanks in advance. Michael -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: 3.0 Tree Behavior - understanding 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: $pages = $this-Pages-find('treeList'); pr($pages); die; But again, it is giving me a lot of schema stuff. I checked the docs, but it only mentions what I did - how to a build the list here - in 2.x we would do: $this-Page-generateTreeList(); I want to build the same list in 3.0! Do you have any idea what I could be missing? Thanks again for your help - I am slowly getting my head around this! On Friday, July 11, 2014 9:18:08 AM UTC+1, José Lorenzo wrote: Not sure what you mean with It isn't returning a list at all. Can you explain? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: 3.0 Tree Behavior - understanding find('treeList')
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 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: $pages = $this-Pages-find('treeList'); pr($pages); die; But again, it is giving me a lot of schema stuff. I checked the docs, but it only mentions what I did - how to a build the list here - in 2.x we would do: $this-Page-generateTreeList(); I want to build the same list in 3.0! Do you have any idea what I could be missing? Thanks again for your help - I am slowly getting my head around this! On Friday, July 11, 2014 9:18:08 AM UTC+1, José Lorenzo wrote: Not sure what you mean with It isn't returning a list at all. Can you explain? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: 3.0 Tree Behavior - understanding find('treeList')
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 Any idea what this could be? Thanks again. On Friday, July 11, 2014 10:24:30 AM UTC+1, José Lorenzo wrote: 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(); -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: 3.0 Tree Behavior - understanding find('treeList')
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: * Function name must be a string *File* /home/michael/public_html/bettornet/vendor/cakephp/cakephp/src/Collection/Iterator/TreePrinter.php Any idea what this could be? Thanks again. On Friday, July 11, 2014 10:24:30 AM UTC+1, José Lorenzo wrote: 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(); -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: 3.0 Tree Behavior - understanding find('treeList')
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 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 Any idea what this could be? Thanks again. On Friday, July 11, 2014 10:24:30 AM UTC+1, José Lorenzo wrote: 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(); -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: 3.0 Tree Behavior - understanding find('treeList')
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 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 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 Any idea what this could be? Thanks again. On Friday, July 11, 2014 10:24:30 AM UTC+1, José Lorenzo wrote: 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(); -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.