简体   繁体   中英

The class 'Sonata\PageBundle\Model\Site' was not found in the chain configured namespaces

I am working on a Symfony 3.3 application that uses Sonata's page bundle.

I want to create a Page fixture that is assigned to a Site. To get the repository of available sites, I have attempted to use this line of code:

$siteRepository = $manager->getRepository('Sonata\PageBundle\Model\Site');

... But I get the following error:

The class 'Sonata\\PageBundle\\Model\\Site' was not found in the chain configured namespaces Application\\Sonata\\Clas
sificationBundle\\Entity, Sonata\\ClassificationBundle\\Entity, Application\\Sonata\\MediaBundle\\Entity, Sonata\\MediaB undle\\Entity, Sonata\\NotificationBundle\\Entity, Application\\Sonata\\NotificationBundle\\Entity, Application\\Sonata\\
PageBundle\\Entity, Sonata\\PageBundle\\Entity, Sonata\\UserBundle\\Entity, Spy\\TimelineBundle\\Entity, Application\\Son
ata\\TimelineBundle\\Entity, Application\\Sonata\\UserBundle\\Entity, Sonata\\TimelineBundle\\Entity, AppBundle\\Entity

What am I doing wrong here?

It turned out that this class was already being extended locally, so I was able to get something that worked by using:

$siteRepository = $manager->getRepository('ApplicationSonataPageBundle:Site');

That doesn't really answer my original question, but maybe it will help somebody.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM