Doctrine @ORM\Entity

Permalink
Hi,

Lots of projects that are using the doctrine ORM entities. New entities are getting created, everything works fine.... well.... worked fine.

When I create a new entity class, it will not create any tables, because the @ORM part is not working anymore. Strange!

...
use Doctrine\ORM\Mapping as ORM;
/**
 * @ORM\Entity
 * @ORM\Table(name="MyLittleTable")
 */
class Bladiebla {
...


When debugging it, I see that the doctrine part is looking for "\Doctrine\ORM\Mapping\ORM\Entity" which is not correct.

When I change it, it does work... (see below). What is happening? It was working before...

...
/**
 * @\Doctrine\ORM\Mapping\Entity
 * @\Doctrine\ORM\Mapping\Table(name="MyLittleTable")
 */
class Bladiebla {
...


v8.5.2 (also in c8.4.x, not sure which version)

SnefIT
 
SnefIT replied on at Permalink Reply
SnefIT
Stangely enough, the Core is using the short @ORM way, so it should be working.

Just tries it on a clean 8.5.2 install. Custom entity class doesn't work with @ORM\Entity but it works just fine with @\Doctrine\ORM\Mapping\Entity.

Weird!
SnefIT replied on at Permalink Reply 1 Attachment
SnefIT
Hi,

I've got a very simple package that will only create an entity with Doctrine ORM.

I've used this method several times, but suddenly it doesn't seem to work. It installs, but the entity was not created in the base.

If you use the full path for @ORM\..... (@\Doctrine\ORM\Mapping\....) then it will work. What is wrong?

See attached zip.
JohntheFish replied on at Permalink Reply
JohntheFish
A few things to check for differences with previous projects:
- c5 cache
- doctrine dev mode on/off (on the database entities page)
- c5 v5.7 vs v8 (changes in namespace resolution)
- package controller, autoloader registries set
SnefIT replied on at Permalink Reply
SnefIT
Cache was emptied.
It was in 8.5.2 (new installation) and 8.4.x (I updated to 8.5.2 because I had this strange behaviour)
As you can see the simple example package, nothing special at all...

And tried both Doctrine modes.

But I'll try again (and again and again ;-))
hutman replied on at Permalink Best Answer Reply
hutman
In your package controller what is the $appVersionRequired set to? It should be '8.0' or greater, if you have 5.7.x or 5.8 it won't work the way you have it setup.
SnefIT replied on at Permalink Reply
SnefIT
S-T-U-P-I-D M-E!

Thanx a lot. That was the thing that was missing! You saved my day. In all my other packages, I have 8.4.2 (or something similar).

Thanx a lot!