问题
I get a lot of mapping errors in Symfony's profiler. I only have this problem with associations with the table inheritance super class. All the other entities and relations are just fine and working perfectly.
Errors:
***\ArticleBundle\Entity\Article
The mappings ***\ArticleBundle\Entity\Article#buyer and ***\UserBundle\Entity\User#boughtArticles are inconsistent with each other.
The association ***\ArticleBundle\Entity\Article#category refers to the inverse side field ***\ArticleBundle\Entity\Category#article which does not exist.
The association ***\ArticleBundle\Entity\Article#tags refers to the inverse side field ***\ArticleBundle\Entity\Tag#article which does not exist.
***\ArticleBundle\Entity\TBA
The mappings ***\ArticleBundle\Entity\TBA#buyer and ***\UserBundle\Entity\User#boughtArticles are inconsistent with each other.
The association ***\ArticleBundle\Entity\TBA#category refers to the inverse side field ***\ArticleBundle\Entity\Category#article which does not exist.
The association ***\ArticleBundle\Entity\TBA#tags refers to the inverse side field ***\ArticleBundle\Entity\Tag#article which does not exist.
Article entity:
/**
* Article
*
* @ORM\Table("articles")
* @ORM\Entity(repositoryClass="***\ArticleBundle\Entity\ArticleRepository")
* @ORM\HasLifecycleCallbacks
* @ORM\InheritanceType("JOINED")
* @ORM\DiscriminatorColumn(name="article_type", type="string")
* @ORM\DiscriminatorMap({"auction" = "Auction", "fixed" = "Fixed", "tba" = "TBA"})
*/
class Article
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\ManyToOne(targetEntity="***\UserBundle\Entity\User", inversedBy="articles")
**/
protected $user;
/**
* @ORM\ManyToOne(targetEntity="***\UserBundle\Entity\User", inversedBy="boughtArticles")
**/
protected $buyer;
/**
* @ORM\ManyToOne(targetEntity="Category", inversedBy="article")
**/
protected $category;
/**
* @ORM\ManyToMany(targetEntity="Tag", inversedBy="article")
* @ORM\JoinTable(name="article_has_tags")
**/
protected $tags;
User entity
/**
* User
*
* @ORM\Table(name="users")
* @ORM\HasLifecycleCallbacks
* @ORM\Entity(repositoryClass="Snuffelmarkt\UserBundle\Entity\UserRepository")
* @UniqueEntity(fields="username", message="De door u ingevulde gebruikersnaam is al in gebruik")
* @UniqueEntity(fields="email", message="Er bestaat al een gebruiker met het door u ingevoerde emailadres")
*/
class User implements UserInterface, Serializable
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\OneToMany(targetEntity="Snuffelmarkt\ArticleBundle\Entity\Article", mappedBy="user")
**/
protected $articles;
/**
* @ORM\OneToMany(targetEntity="Snuffelmarkt\ArticleBundle\Entity\Article", mappedBy="user")
**/
protected $boughtArticles;
/**
* @ORM\OneToOne(targetEntity="Profile", mappedBy="user")
*/
private $profile;
来源:https://stackoverflow.com/questions/20926916/mappings-are-inconsistent-with-each-other-single-table-inheritance