DDC-3007: ManyToMany does not respect all column attributes for the jointable #3733

Closed
opened 2026-01-22 14:26:33 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (Mar 3, 2014).

Originally assigned to: @ostrolucky on GitHub.

Jira issue originally created by user breiti:

Given following 2 entities:

<?php
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;
}
<?php
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.
Originally created by @doctrinebot on GitHub (Mar 3, 2014). Originally assigned to: @ostrolucky on GitHub. Jira issue originally created by user breiti: Given following 2 entities: ``` <?php 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; } ``` ``` <?php 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](http://www.doctrine-project.org/jira/browse/DBAL-423)) *\* If using GUID-Type (see [DBAL-423](http://www.doctrine-project.org/jira/browse/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.
admin added the Bug label 2026-01-22 14:26:33 +01:00
admin closed this issue 2026-01-22 14:26:34 +01:00
Author
Owner

@doctrinebot commented on GitHub (Sep 10, 2014):

Comment created by @doctrinebot:

A related Github Pull-Request [GH-465] was assigned:
https://github.com/doctrine/dbal/pull/465

@doctrinebot commented on GitHub (Sep 10, 2014): Comment created by @doctrinebot: A related Github Pull-Request [GH-465] was assigned: https://github.com/doctrine/dbal/pull/465
Author
Owner

@ostrolucky commented on GitHub (Aug 5, 2018):

Due to various issues, support for DB-generated UUIDs has been dropped in Doctrine/DBAL 3.0. See https://github.com/doctrine/doctrine2/pull/7330 or https://github.com/doctrine/dbal/pull/3211. Hence, this issue is no longer relevant.

@ostrolucky commented on GitHub (Aug 5, 2018): Due to various issues, support for DB-generated UUIDs has been dropped in Doctrine/DBAL 3.0. See https://github.com/doctrine/doctrine2/pull/7330 or https://github.com/doctrine/dbal/pull/3211. Hence, this issue is no longer relevant.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#3733