Symfony3 Error Namespace does not contain mapped objects

I tried creating getters and setters in Symfony 3.0.1

when i run the command

php bin/console doctrine:generate:entities VendorName/MyBundle/EntityName

i has an error

Namespace "VendorName\MyBundle\EntityName" does not contain any mapped entities.

where is the mistake?

Edit-1: First create an object with YAML format

Edit-2: I tried to create getters and seters for the provider package

I also try to run the php bin / console doctrine: command to generate: the VendorNameMyBundle: EntityName entities and have a different error:

Can't find base path for "VendorName\MyBundle\Entity\EntityName" (path: "/home/site/vendor/vendorname/mybundle/Entity", destination: "/home/site/vendor/vendorname/mybundle/Entity").  
+4
source share
3 answers

As John Pankoist points out the answer to another question:

Doctrine PSR-4, - . , PSR-4 / , .

https://github.com/doctrine/DoctrineBundle/issues/282

, ; composer.json, .

composer.json psr-4 psr-0:

"autoload": {
    "psr-4": { "Acme\\Bundle\\AwesomeBundle\\": "" }
},

"autoload": {
    "psr-0": { "Acme\\Bundle\\AwesomeBundle\\": "" }
},

:

vendor
 +--acme
     +--awesome-bundle
         |--Controller
         |--Entity

vendor
 +--acme
     +--awesome-bundle
         +--Acme
             +--Bundle
                 +--AwesomeBundle
                     |--Controller
                     |--Entity

:

bin/console doctrine:generate:entities AwesomeBundle
+2

, , . :

php bin/console doctrine:generate:entities VendorName/MyBundle

:

php bin/console doctrine:generate:entity VendorName/MyBundle/EntityName
0

Symfony 3.22 src/AppBundle/Entity/User.php

, ORM

**/**
 * @ORM\Column(name="last_login", type="datetimetz")
 */
private $lastLogin;**

php bin/console doctrine: generate: entity AppBundle

r

php bin/console doctrine: schema: update

php bin/console doctrine: schema: update --force PROD

-1

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


All Articles