Class Login not found in AbstractProxyFactory

Hi every body,
Following my previous problems, I now face to a new issue.

When I try to access to the main page of our application, I get the following error :

<b>Fatal error</b>:  Uncaught Error: Class &quot;DoctrineORMModule\Proxy\__CG__\Application\Entity\Login&quot; not found in [...]/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php:111
Stack trace:
#0 [...]/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(2873): Doctrine\Common\Proxy\AbstractProxyFactory->getProxy()
#1 [...]/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php(156): Doctrine\ORM\UnitOfWork->createEntity()
#2 [...]/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php(63): Doctrine\ORM\Internal\Hydration\SimpleObjectHydrator->hydrateRowData()
#3 [...]/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php(270): Doctrine\ORM\Internal\Hydration\SimpleObjectHydrator->hydrateAllData()
#4 [...]/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php(757): Doctrine\ORM\Internal\Hydration\AbstractHydrator->hydrateAll()
#5 [...]/vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php(243): Doctrine\ORM\Persisters\Entity\BasicEntityPersister->load()
#6 [...]/module/Application/src/Repository/BaseRepository.php(52): Doctrine\ORM\EntityRepository->findOneBy()
#7 [...]/module/Application/src/Repository/SettingRepository.php(190): Application\Repository\BaseRepository->findOneBy()
#8 [...]/module/Application/src/View/Helper/LogoHelper.php(40): Application\Repository\SettingRepository->getHomeLogoStyle()
#9 [...]/module/Application/view/layout/layout.phtml(73): Application\View\Helper\LogoHelper->getHomeLogoStyle()
#10 [...]/vendor/laminas/laminas-view/src/Renderer/PhpRenderer.php(519): include('...')
#11 [...]/vendor/laminas/laminas-view/src/View.php(194): Laminas\View\Renderer\PhpRenderer->render()
#12 [...]/vendor/laminas/laminas-mvc/src/View/Http/DefaultRenderingStrategy.php(98): Laminas\View\View->render()
#13 [...]/vendor/laminas/laminas-eventmanager/src/EventManager.php(319): Laminas\Mvc\View\Http\DefaultRenderingStrategy->render()
#14 [...]/vendor/laminas/laminas-eventmanager/src/EventManager.php(171): Laminas\EventManager\EventManager->triggerListeners()
#15 [...]/vendor/laminas/laminas-mvc/src/View/Http/DefaultRenderingStrategy.php(116): Laminas\EventManager\EventManager->triggerEvent()
#16 [...]/vendor/laminas/laminas-eventmanager/src/EventManager.php(319): Laminas\Mvc\View\Http\DefaultRenderingStrategy->render()
#17 [...]/vendor/laminas/laminas-eventmanager/src/EventManager.php(171): Laminas\EventManager\EventManager->triggerListeners()
#18 [...]/vendor/laminas/laminas-mvc/src/Application.php(360): Laminas\EventManager\EventManager->triggerEvent()
#19 [...]/vendor/laminas/laminas-mvc/src/Application.php(341): Laminas\Mvc\Application->completeRequest()
#20 [...]/public/index.php(41): Laminas\Mvc\Application->run()
#21 {main}
  thrown in <b>[...]/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php</b> on line <b>111</b>

It looks like if the “events” weren’t correctly initialized (or something like that), into the run method (Laminas\Mvc\Application).
I don’t know why is exactly the problem…

  • Problem the initializing the events ?
  • Proxy issue ?
  • Router issue ?

On my localhost, I don’t have this issue. I guess it’s probably a configuration issue (I hope :sweat_smile: )
I don’t know how on which point focus my research :sweat:

Hi Issinia,

this could be a simple Problem. Can the user, which executes PHP access the data/DoctrineORMModule/Proxy directory or does it even exist? Is read and write access granted to the data/DoctrineORMModule folder?

This is just a guess …

Hi @ezkimo,
Everybody has at least read/execute right on the DoctrineORMModule folder.
Do you think I should add write right ?

Hi @Issinia,

  1. If you’re a Linux user. Give write permission to the data folder.
  2. Try disabling the cache if you’ve it enabled.
  3. Make a zip file of the data folder then delete everything in it and run the project again.
  4. Check your doctrine class in your source code Application\Entity\Login; Because this class must be missing some interface which it needs.

For example, I’ve got a class similar to yours but not exact. Which looks like below:

namespace Application\Entity;

/* used classes/services */

/*
ORM definition
*/

Class User implements UserInterface, IdentityInterface{

}

In the above definition “UserInterface” belongs to LmcUser, LmcUserDoctrine aka ZfcUser. Because of that DoctrineModule generate a proxy for me the same way your does with the exception of the class name User( DoctrineORMModule\Proxy_CG_\Application\Entity\User);

I hope this helps you find your problem. Thanks!

Hey @Issinia,

The default proxy directory is data/DoctrineORMModule/Proxy and this directory must be writable.

  1. Create the following directory in your project root.

mkdir data/DoctrineORMModule/Proxy

  1. Change the directory permissions and make it writable.

chmod -R 755 data/DoctrineORMModule/Proxy

755 means read and execute access for everyone and write access for the owner of the file.

Happy coding!

Hi, thanks for the answer.

The folder data/DoctrineORMModule/Proxy exists with 755

But the folder is empty… Is there any command to “generate” the files ?

I tried to import manually the files from my workspace, but I still have the error :frowning:

This command should do the trick.

./vendor/bin/doctrine-module orm:generate-proxies

Resource:

Have a great day.

1 Like

Hi @ghostwriter
Everything look good now !
Thank you for all your support :slight_smile: