What are the entities of namespaces and aliases in Doctrine2?

In the documentation, I saw this method:

addEntityNamespace($alias, $namespace); 

But I can’t find anywhere.

Any ideas?

+4
source share
1 answer

Object namespaces are a shortcut for object aliases when pointing to other classes. A good example of an object namespace is inside DQL queries.

When you define a namespace, for example: → addEntityNamespace ('app', 'Application \ Entity'); Then you can easily access them. In the DQL sample, write instead:

 SELECT u FROM Application\Entity\User u 

You can do it:

 SELECT u FROM app:User u 

Hope this helps. =)

Greetings

+8
source

Source: https://habr.com/ru/post/1342467/


All Articles