Closed masterspambot closed 12 years ago
First point, you should not have a field with the id in the PHP code but a relation to the parent node. It would be far much cleaner.
And did you cleared your prod cache and warmed it up so that proxies are regenerated ? php app/console cache:clear --env=prod --no-debug
I know my method is not the finest but it works quite fast. at least. But how to transform this select to use the 'parent' instead of _'parentid'? Maybe my knowledge is not sufficient, so that I used the parent id.
And of course i cleared the cache. No help. I'm really upset.
Did you cleared it using --no-debug
? When running the command in debug mode, the cache is warmed up in debug mode and as the debug mode will generate the proxies for each request anyway, it does not run the cache warmer.
the doc of the extensions sets the relation to the parent in the example: https://github.com/l3pp4rd/DoctrineExtensions/blob/master/doc/tree.md (and this is even needed by the Tree extension). And the query is already implemented in a more efficient way (without using a subquery) in the NestedTreeRepository: https://github.com/l3pp4rd/DoctrineExtensions/blob/master/lib/Gedmo/Tree/Entity/Repository/NestedTreeRepository.php#L381
Ok. I did it with --no-debug
.
Didn't make any change.
What helped? :)
sudo rm -R app/cache/ app/log/
And btw thanks for links to documentation. I thought it wasn't implemented... So I was trying to make a workaround. My bad.
Thanks for help.
I'm closing the issue.
Hi. To get all the leaves from the tree i implemented simple function extending NestedTreeRepository.php
To retrive parent_id I added extra field to my Category.php class, which is not accessible by default:
Everything works great in dev environtment, but if i'm trying to get nodes in production env. i got error 500 issue. I'm not realy sure if it's StofDoctrineExtensionsBundle error or Doctrine error, because if I remove subquery from selset everything works fine in both environments. Please chceck this and if u find any solution share it with me.