Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-3007

ManyToMany does not respect all column attributes for the jointable


    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Mapping Drivers
    • Security Level: All
    • Labels:


      Given following 2 entities:

      class Role {
           * @ORM\Id
           * @ORM\GeneratedValue(strategy="UUID")
           * @ORM\Column(name="id", type="guid", nullable=false, unique=true, length=36, options={"fixed"=true})
          protected $id;
           * @ORM\ManyToMany(targetEntity="User", mappedBy="roleList")
          private $userList;
      class User {
           * @ORM\Column(name="id", type="guid", nullable=false, unique=true, length=36, options={"fixed"=true})
           * @ORM\Id
           * @ORM\GeneratedValue(strategy="UUID")
          protected $id;
          /**     *
           * @ORM\ManyToMany(targetEntity="Role", inversedBy="userList")
           * @ORM\JoinTable(name="user_role")
          protected $roleList;

      It should create a table "user_role" with 2 columns which are CHAR(36).

      But it ignores the Column-Attributes and creates a table "user_role" with 2 CHAR(255) columns.

      This has various downsides:

      • It's unusable when using MyISAM, because of limited index size. (CREATE TABLE fails, see DBAL-423)
      • If using GUID-Type (see DBAL-423 with the changes from the linked ull request) and specify "length=36" and "fixed=true" on the Column-Annotation, no changes for the entity-tables itself are generated when running orm:schema-tool:update. However, there are still changes for the many-to-many-table generated (because internal "fixed" is false and length is unset) which represent the current state of the columns. These changes are always generated.


        There are no comments yet on this issue.


          • Assignee:
            Benjamin Eberlei
            Michael Kühn
          • Votes:
            0 Vote for this issue
            1 Start watching this issue


            • Created: