lphuberdeau / Neo4j-PHP-OGM

A doctrine2 style library to access neo4j graphs
156 stars 45 forks source link

"__setMeta" of class "__PHP_Incomplete_Class" #112

Open ander7agar opened 7 years ago

ander7agar commented 7 years ago

A long time ago I use this library in some of my projects with Neo4j. The little time of using it, this error began to appear in some of the functions that I have implemented. The error appears when I try to get multiple nodes of the same tag, but does not always appear. Only sometimes. The problem I have is that this function is executed to display certain data to the user and at the times that it fails nothing is displayed. Here I put the error which I have captured in the log:

[2017-02-03 12:44:31] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\UndefinedMethodException: "Attempted to call an undefined method named "__setMeta" of class "__PHP_Incomplete_Class"." at /home/api/api/vendor/hirevoice/neo4jphp-ogm/lib/HireVoice/Neo4j/Proxy/Factory.php line 68 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\UndefinedMethodException(code: 0): Attempted to call an undefined method named \"__setMeta\" of class \"__PHP_Incomplete_Class\". at /home/api/api/vendor/hirevoice/neo4jphp-ogm/lib/HireVoice/Neo4j/Proxy/Factory.php:68)"} []

I have been trying to fix the error since August 2016 and already I give up.

lphuberdeau commented 7 years ago

This is definitely strange. Looks like it may be cache-related. __PHP_Incomplete_Class points towards towards unserialization.

The library is badly outdated as I have not worked on it in years. Have you tried updating the Doctrine dependencies?

ander7agar commented 7 years ago

Yes, I use:

doctrine/orm                         v2.5.6             Object-Relational-Mapper for PHP
doctrine/doctrine-bundle             1.6.7              Symfony DoctrineBundle
doctrine/doctrine-cache-bundle       1.3.0              Symfony Bundle for Doctrine Cache
ikwattro commented 7 years ago

@ander7agar Proxies are not autoloaded in debug mode, you would have to create an autoloader for them in the boot method of your main Bundle.

References :

https://github.com/graphaware/neo4j-php-ogm/issues/122

https://github.com/symfony/symfony/issues/3907

https://github.com/doctrine/DoctrineMongoDBBundle/pull/85

https://github.com/ikwattro/neo4j-ogm-symfony-security/commit/b7a85818733454aff9c9a3efcbbf0c5ad0557bd3