I am having a [Doctrine\ORM\ORMException] Unknown Entity namespace alias 'src\AppBundle\Entity'
error message.
A quick search led me to three related SO questions :
here about a problem in a user-created bundle, which I'm not using here.
here where the error message is obtained by PHP code rather using doctrine in the command line as I'm currently doing, and
there where the answer suggests doing sudo php app/console cache:clear --env=dev
; I did that followed by sudo chmod a+w app/cache/dev/annotations
, but the problem stayed the same.
Here is what I did :
1) Successfully create my database with php app/console doctrine:database:create
2) Create manually a Product Entity in app/Entity/Product.php
with the following content (the code below is
copy-pasted from the Symfony Book) :
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="product")
*/
class Product
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="string", length=100)
*/
protected $name;
/**
* @ORM\Column(type="decimal", scale=2)
*/
protected $price;
/**
* @ORM\Column(type="text")
*/
protected $description;
}
3) Type php app/console doctrine:generate:entities src/AppBundle/Entity:Product
- which produced the "unknown entity namespace" error message.
Any help appreciated.