{"id":1602,"date":"2022-08-30T15:17:54","date_gmt":"2022-08-30T15:17:54","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/27\/is-not-a-valid-entity-or-mapped-class-error-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:17:54","modified_gmt":"2022-08-30T15:17:54","slug":"is-not-a-valid-entity-or-mapped-class-error-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/is-not-a-valid-entity-or-mapped-class-error-collection-of-common-programming-errors\/","title":{"rendered":"is not a valid entity or mapped class Error-Collection of common programming errors"},"content":{"rendered":"<p>I&#8217;m using Doctrine with Codeigniter. So i write a library class for using them together. But i cant access entities (after creating them from db with reverse-engineering). Doctrine gives error: <strong>Fatal error: Uncaught exception &#8216;Doctrine\\ORM\\Mapping\\MappingException&#8217; with message &#8216;Class Actions is not a valid entity or mapped super class.&#8217;<\/strong><\/p>\n<p>I just add this code for this situation to library class and works everything right but <strong>speed is very low<\/strong>:<\/p>\n<pre><code>    $this-&gt;em-&gt;getConfiguration()\n             -&gt;setMetadataDriverImpl(\n                new DatabaseDriver(\n                        $this-&gt;em-&gt;getConnection()-&gt;getSchemaManager()\n                )\n    );\n<\/code><\/pre>\n<p>What can i do for this error? I generated entities from DB with this function:<\/p>\n<pre><code>    $cmf = new DisconnectedClassMetadataFactory();\n    $cmf-&gt;setEntityManager($this-&gt;em);\n    $metadata = $cmf-&gt;getAllMetadata();\n    $generator = new EntityGenerator();\n\n    $generator-&gt;setUpdateEntityIfExists(true);\n    $generator-&gt;setGenerateStubMethods(true);\n    $generator-&gt;setGenerateAnnotations(true);\n    $generator-&gt;generate($metadata, APPPATH.\"models\/entities\");\n<\/code><\/pre>\n<p>My Action entity:<\/p>\n<pre><code>\n<\/code><\/pre>\n<ol>\n<li>\n<p>Solution is editing php.ini file for closing eAccelerator:<\/p>\n<pre><code>eaccelerator.enable=\"0\"\n<\/code><\/pre>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-11-27 12:01:00. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I&#8217;m using Doctrine with Codeigniter. So i write a library class for using them together. But i cant access entities (after creating them from db with reverse-engineering). Doctrine gives error: Fatal error: Uncaught exception &#8216;Doctrine\\ORM\\Mapping\\MappingException&#8217; with message &#8216;Class Actions is not a valid entity or mapped super class.&#8217; I just add this code for this [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1602","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1602","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1602"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1602\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1602"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1602"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1602"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}