Symfony - The mappings are inconsistent with each other

In the Follower Entity, replace this:

/**
 * @ORM\ManyToOne(targetEntity="User", inversedBy="followers")
 */
protected $follower;

with:

/**
 * @ORM\ManyToOne(targetEntity="User", inversedBy="followings")
 */
protected $follower;

You can use the command doctrine:schema:validate that checks the current mapping for valid forward and reverse mappings.

php app/console doctrine:schema:validate

Hope this help


You should replace followers by followings in :

/**
 * @ORM\ManyToOne(targetEntity="User", inversedBy="followers")
 */
protected $follower;

But i think it's better to use ManyToMany associations on User Entity. You can try something like this :

/**
 * @ORM\Entity
 * @ORM\Table(name="users")
*/
class User extends BaseUser
{
  /**
   * @ORM\ManyToMany(targetEntity="User", mappedBy="followings")
  */
  private $followers;

  /**
   * @ORM\ManyToMany(targetEntity="User", inversedBy="followers")
   * @ORM\JoinTable(name="follows",
   *      joinColumns={@ORM\JoinColumn(name="following_id", referencedColumnName="id")},
   *      inverseJoinColumns={@ORM\JoinColumn(name="follower_id", referencedColumnName="id")}
   *      )
  */
  private $followings;