Skip to content

Loading…

DDC-34: schema-tool --create tries to create duplicate associations and exits with exception #4198

Closed
doctrinebot opened this Issue · 1 comment

2 participants

@doctrinebot

Jira issue originally created by user itoijala:

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;
}
@doctrinebot

Issue was closed with resolution "Fixed"

@jwage jwage was assigned by doctrinebot
@doctrinebot doctrinebot added this to the 2.0-ALPHA3 milestone
@doctrinebot doctrinebot closed this
@doctrinebot doctrinebot added the Bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.