Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-34

schema-tool --create tries to create duplicate associations and exits with exception

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0-ALPHA2
    • Fix Version/s: 2.0-ALPHA3
    • Component/s: Tools
    • Security Level: All
    • Labels:
      None
    • Environment:
      HEAD

      Description

      I'm getting the error

      SchemaTool:Duplicate field mapping ()

      when trying to create my database schema. I am pretty sure this worked before. The error occurs on a field defined in a mapped superclass on the first entity that extends this class on the first association.

      My entity classes:

      namespace Model;
      
      use \Model\User\User;
      use \DateTime;
      
      /**
       * @MappedSuperclass
       */
      abstract class Blameable
      {
      	/**
      	 *
      	 * @var DateTime
      	 *
      	 * @Column(type="datetime", name="date_created")
      	 */
      	protected $dateCreated;
      
      	/**
      	 *
      	 * @var User
      	 *
      	 * @OneToOne(targetEntity="Model\User\User")
           * @JoinColumn(name="creator_id", referencedColumnName="id", nullable="true")
      	 */
      	protected $creator;
      
      	/**
      	 *
      	 * @var DateTime
      	 *
      	 * @Column(type="datetime", name="date_updated", nullable="true")
      	 */
      	protected $dateUpdated;
      
      	/**
      	 *
      	 * @var User
      	 *
      	 * @OneToOne(targetEntity="Model\User\User")
           * @JoinColumn(name="updater_id", referencedColumnName="id", nullable="true")
      	 */
      	protected $updater;
      
      	/**
      	 *
      	 * @var DateTime
      	 *
      	 * @Column(type="datetime", name="date_deleted", nullable="true")
      	 */
      	protected $dateDeleted;
      
      	/**
      	 *
      	 * @var User
      	 *
      	 * @OneToOne(targetEntity="Model\User\User")
           * @JoinColumn(name="deleter_id", referencedColumnName="id", nullable="true")
      	 */
      	protected $deleter;
      }
      
      namespace Model\User;
      
      use \Zend_Validate_Alnum;
      use \Zend_Validate_StringLength;
      use \Zend_Validate_Alpha;
      use \Zend_Validate_EmailAddress;
      use \Zend_Registry;
      use \Model\Blameable;
      use \Model\ConstraintException;
      use \Itoijala_Singletons;
      use \Zend_Auth;
      use \Itoijala_Password_Hash;
      
      /**
       *
       *
       * @Entity @Table(name="user_users")
       */
      class User extends Blameable
      {
      	/**
      	 *
      	 * @var int
      	 *
      	 * @Id @Column(type="integer", name="id")
           * @GeneratedValue(strategy="AUTO")
      	 */
      	private $id;
      
      	/**
      	 *
      	 * @var string
      	 *
      	 * @Column(type="string", length="20", name="username")
      	 */
      	private $username;
      
      	/**
      	 *
      	 * @var string
      	 *
      	 * @Column(type="string", length="20", name="first_name")
      	 */
      	private $firstName;
      
      	/**
      	 *
      	 * @var string
      	 *
      	 * @Column(type="string", length="20", name="last_name")
      	 */
      	private $lastName;
      
      	/**
      	 *
      	 * @var string
      	 *
      	 * @Column(type="string", length="255", name="email")
      	 */
      	private $email;
      
      	/**
      	 *
      	 * @var string
      	 *
      	 * @Column(type="string", length="20", name="signature")
      	 */
      	private $signature;
      
      	/**
      	 *
      	 * @var string
      	 *
      	 * @Column(type="string", length="128", name="password")
      	 */
      	private $password;
      
      	/**
      	 *
      	 * @var string
      	 *
      	 * @Column(type="string", length="255", name="role")
      	 */
      	private $role;
      
      	/**
      	 *
      	 * @var string
      	 *
      	 * @Column(type="string", length="32", name="session_id", nullable="true")
      	 */
      	private $sessionId;
      
      	/**
      	 *
      	 * @var bool
      	 *
      	 * @Column(type="boolean", name="unlocked")
      	 */
      	private $unlocked;
      }
      
      namespace Model\Article;
      
      use \Closure;
      use \Model\Blameable;
      use \Doctrine\Common\Collections\Collection;
      use \Doctrine\ommon\Collections\ArrayCollection;
      use \Model\User\User;
      use \Model\Gallery\Gallery;
      use \Model\ConstraintException;
      use \Zend_Validate_StringLength;
      
      /**
       * @Entity @Table(name="article_articles")
       */
      class Article extends Blameable
      {
      	/**
      	 *
      	 * @var int
      	 *
      	 * @Id @Column(type="integer", name="id")
           * @GeneratedValue(strategy="AUTO")
      	 */
      	private $id;
      
      	/**
      	 *
      	 * @var Category
      	 *
      	 * @ManyToOne(targetEntity="Model\Article\Category")
           * @JoinColumn(name="category_id", referencedColumnName="id")
      	 */
      	private $category;
      
      	/**
      	 *
      	 * @var string
      	 *
      	 * @Column(type="string", length="255", name="name")
      	 */
      	private $name;
      
      	/**
      	 *
      	 * @var string
      	 *
      	 * @Column(type="text", name="description")
      	 */
      	private $description;
      
      	/**
      	 *
      	 * @var string
      	 *
      	 * @Column(type="string", length="255", name="thumbnail")
      	 */
      	private $thumbnail;
      
      	/**
      	 *
      	 * @var string
      	 *
      	 * @Column(type="text", name="content")
      	 */
      	private $content;
      
      	/**
      	 *
      	 * @var int
      	 *
      	 * @Column(type="integer", name="views")
      	 */
      	private $views;
      
      	/**
      	 *
      	 * @var bool
      	 *
      	 * @Column(type="boolean", name="news")
      	 */
      	private $news;
      
      	/**
      	 *
      	 * @var bool
      	 *
      	 * @Column(type="boolean", name="unlocked")
      	 */
      	private $unlocked;
      
      	/**
      	 *
      	 * @var Collection
      	 *
      	 * @ManyToMany(targetEntity="Model\Gallery\Gallery")
           * @JoinTable(name="article_article_galleries",
           *      joinColumns={@JoinColumn(name="article_id", referencedColumnName="id")},
           *      inverseJoinColumns={@JoinColumn(name="gallery_id", referencedColumnName="id")})
      	 */
      	private $galleries;
      
      	/**
      	 *
      	 * @var Collection
      	 *
      	 * @ManyToMany(targetEntity="Model\User\User")
           * @JoinTable(name="article_article_authors",
           *      joinColumns={@JoinColumn(name="article_id", referencedColumnName="id")},
           *      inverseJoinColumns={@JoinColumn(name="user_id", referencedColumnName="id")})
      	 */
      	private $authors;
      
      	/**
      	 *
      	 * @var Collection
      	 *
      	 * @OneToMany(targetEntity="Model\Article\Attachment", mappedBy="article")
      	 */
      	private $attachments;
      }
      

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Ismo Toijala
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: