persistence
persistence copied to clipboard
AnnotationDriver is not loading entities from symlinked directories
Entity directory structure (AppBundle/Entity)
- Blog (directory)
- Post.php
- Blog2 (symlink)
- Post2.php
Mapping loaded from AnnotationDriver (e.g. via symfony's bin/console doctrine:mapping:info
) will display info for Post but not for Post2 because Blog2
is symlinked.
\RecursiveDirectoryIterator::FOLLOW_SYMLINKS
flag need to be passed to RecursiveDirectoryIterator
to fix this.
To reproduce this in symfony:
symfony new symlinkedEntities
composer install
bin/console doctrine:gen:entity --entity=AppBundle:Blog/Post --format=annotation --fields="title:string(length=255 nullable=true unique=true)" --no-interaction
# set DB params adn then
bin/console doc:data:create
# works
bin/console doctrine:gen:entities AppBundle:Blog
# does not work
mv src/AppBundle/Entity/Blog .
ln -s FULL_PATH/symlinkedEntities/Blog src/AppBundle/Entity/Blog
bin/console doctrine:gen:entities AppBundle:Blog
Generating entities for namespace "AppBundle\Entity\Blog" [RuntimeException] Namespace "AppBundle\Entity\Blog" does not contain any mapped entities.