8.5.2: Doctrine\Common\Proxy\AbstractProxyFactory::getProxyDefinition(): Failed

Permalink
I have random exceptions while uninstalling packages:

Doctrine\Common\Proxy\AbstractProxyFactory::getProxyDefinition(): Failed

I can't consistently reproduce this. Sometimes it happens after one package is being uninstalled, sometimes another, sometimes it doesn't happen.

linuxoid
 
linuxoid replied on at Permalink Reply
linuxoid
Looks like setting the option

On - Proxy classes will be generated on the fly. Good for development.

in System & Settings > Environment > Database Entities or Refreshing the entities fixes the problem, the exceptions stopped.

My package controller does already implement the Doctrine interface
use Concrete\Core\Database\EntityManager\Provider\ProviderAggregateInterface;
use Concrete\Core\Database\EntityManager\Provider\StandardPackageProvider;
class Controller extends Package implements ProviderAggregateInterface
{
    protected $pkgAutoloaderRegistries = [
        'src/XXXX' => 'XXXX'
    ];
    public function getEntityManagerProvider()
    {
        $provider = new StandardPackageProvider($this->app, $this, [
            'src/XXXX' => 'XXXX'
        ]);
        return $provider;
    }


What else am I as a package developer supposed to do to avoid that? The user will not set that option if they are not developing.
linuxoid replied on at Permalink Reply
linuxoid
Looks like this should take care of the DB entities (in the package controller install() and upgrade() functions):
use Concrete\Core\Support\Facade\DatabaseORM;
use Concrete\Core\Database\DatabaseStructureManager;
install()
{
    $this->RefreshEntities();
}
upgrade()
{
    $this->RefreshEntities();
}
public function RefreshEntities()
{
    $em = DatabaseORM::entityManager();
    $manager = new DatabaseStructureManager($em);
    $manager->refreshEntities();