When I'm using Doctrine Annotation file like the example above, the command php bin/console doctrine:migrations:diff
works perfectly.
#src/Entity/User.php
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping AS ORM;
/**
* @ORM\Entity(repositoryClass="Repository\UserRepository")
* @ORM\Table(
* schema="data",
* name="ts_user",
* options={"comment":"Utilisateurs de l'application"},
* uniqueConstraints={@ORM\UniqueConstraint(name="uk_usr_email", columns={"usr_email"})}
* )
*/
class User
{
/**
* @ORM\Id
* @ORM\Column(type="integer", name="usr_id")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="text", nullable=true, name="usr_name")
*/
private $name;
/**
* @ORM\Column(type="text", nullable=false, name="usr_email")
*/
private $email;
/**
* @ORM\Column(type="text", nullable=true, name="usr_password")
*/
private $password;
}
For some reasons (trait, interfaces), I have to use doctrine yaml file to declare my entity. As soon as I replace annotations by a yaml file, the migration command is throwing this error :
In OrmSchemaProvider.php line 41:
No mapping information to process
Here is my yaml file:
#src/Resources/config/doctrine/User.orm.yml
App\Entity\User:
type: entity
schema: data
table: ts_user
repositoryClass: Repository\UserRepository
id:
id:
type: integer
column: usr_id
generator:
strategy: AUTO
fields:
name:
type: text
nullable: true
column: usr_name
email:
type: text
nullable: false
column: usr_email
password:
type: text
nullable: true
column: usr_password
uniqueConstraints:
uk_usr_email:
columns: [usr_email]
options:
comment: Utilisateurs de l'application
Because of this error, I supposed that it didn't find my yaml file. Is it in a wrong directory ? Where to put this file ? I saw nothing in source code to declare the directory of my yaml file. I already tried in this directories with no success:
- src/Entity
- src/Resources/config/doctrine/
- src/Resources/config/doctrine/App
- src/Resources/config/doctrine/App/Entity
- src/Resources/config/doctrine/Entity
What am I doing wrong?
Env: PHP 7.2.3, Symfony 4.1.1 (kernel: src, env: dev, debug: true)