0
votes

I am getting error of Case mismatch between loaded and declared class names: "Doctrine\ORM\Mapping\ManytoOne" vs "Doctrine\ORM\Mapping\ManyToOne" with User Entity only. Same Code with other entities is working fine.

Here is my Comp Entity

namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Comp
 *
 * @ORM\Table(name="comp")
 * @ORM\Entity(repositoryClass="AppBundle\Repository\CompanyRepository")
 */
class Comp
{
    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var integer
     * @ORM\ManytoOne(targetEntity="User")
     * @ORM\JoinColumn(name="user_id",referencedColumnName="id", nullable=true)
     */
    private $user;

My User Entity is

namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use FOS\UserBundle\Model\User as BaseUser;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * User
 *
 * @ORM\Table(name="user")
 * @ORM\Entity(repositoryClass="AppBundle\Repository\UserRepository")
 */
class User extends BaseUser
{
    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @var string
     *
     * @ORM\Column(name="name", type="string", length=255)
     */
    private $name;

and I am getting error of Case mismatch between loaded and declared class names: "Doctrine\ORM\Mapping\ManytoOne" vs "Doctrine\ORM\Mapping\ManyToOne"

while updating schema

The same code is working file with other entities. I manage to make foreign keys. Cannot understand what is going wrong with User field only.

1

1 Answers

3
votes

try to change this:

* @ORM\ManytoOne(targetEntity="User")

to this:

* @ORM\ManyToOne(targetEntity="User")

Annotations are case sensitive for this reason you retrieve an error