DDC-60: doctrine schema-tool generates invalid php code for aliased columns from YAML #72

Closed
opened 2026-01-22 12:26:10 +01:00 by admin · 7 comments
Owner

Originally created by @doctrinebot on GitHub (Oct 26, 2009).

Originally assigned to: @jwage on GitHub.

Jira issue originally created by user chriswest:

Using:
php doctrine convert-mapping --from=path-to-scheme --to=annotation --dest=dest-path

Snippet from YAML scheme:

User_Note:
    tableName: note
    columns:
      id:
        type: integer(4)
        autoincrement: true
        unsigned: true
        primary: true
      userId:
        type: integer(4)
        unsigned: true
        notnull: true
      uri:
        type: string(255)
        notnull: true
      xcoord as x:
        type: integer(3)
        unsigned: true
        notnull: true
      ycoord as y:
        type: integer(3)
        unsigned: true
        notnull: true

Creating an annotation class from this scheme produces the following invalid output for the aliased columns "xcoord" and "ycoord":

     /****
     * @Column(name="xcoord as x", type="integer", length=3)
     */
    private $xcoord as x;

    /****
     * @Column(name="ycoord as y", type="integer", length=3)
     */
    private $ycoord as y;
Originally created by @doctrinebot on GitHub (Oct 26, 2009). Originally assigned to: @jwage on GitHub. Jira issue originally created by user chriswest: Using: php doctrine convert-mapping --from=path-to-scheme --to=annotation --dest=dest-path Snippet from YAML scheme: ``` User_Note: tableName: note columns: id: type: integer(4) autoincrement: true unsigned: true primary: true userId: type: integer(4) unsigned: true notnull: true uri: type: string(255) notnull: true xcoord as x: type: integer(3) unsigned: true notnull: true ycoord as y: type: integer(3) unsigned: true notnull: true ``` Creating an annotation class from this scheme produces the following invalid output for the aliased columns "xcoord" and "ycoord": ``` /**** * @Column(name="xcoord as x", type="integer", length=3) */ private $xcoord as x; /**** * @Column(name="ycoord as y", type="integer", length=3) */ private $ycoord as y; ```
admin added the Bug label 2026-01-22 12:26:10 +01:00
admin closed this issue 2026-01-22 12:26:10 +01:00
Author
Owner

@doctrinebot commented on GitHub (Oct 26, 2009):

Comment created by romanb:

Correct output should be:

@Column(name="xcoord", type="integer")
private $x;

@Column(name="ycoord", type="integer")
private $y;

@doctrinebot commented on GitHub (Oct 26, 2009): Comment created by romanb: Correct output should be: @Column(name="xcoord", type="integer") private $x; @Column(name="ycoord", type="integer") private $y;
Author
Owner

@doctrinebot commented on GitHub (Oct 26, 2009):

Comment created by @jwage:

Your YAML is incorrect. Looks like you're using the syntax from Doctrine 1. It should be:

User_Note:
    tableName: note
    columns:
      id:
        type: integer(4)
        autoincrement: true
        unsigned: true
        primary: true
      userId:
        type: integer(4)
        unsigned: true
        notnull: true
      uri:
        type: string(255)
        notnull: true
      xcoord:
        type: integer(3)
        unsigned: true
        notnull: true
        column: x
      ycoord:
        type: integer(3)
        unsigned: true
        notnull: true
        column: y
@doctrinebot commented on GitHub (Oct 26, 2009): Comment created by @jwage: Your YAML is incorrect. Looks like you're using the syntax from Doctrine 1. It should be: ``` User_Note: tableName: note columns: id: type: integer(4) autoincrement: true unsigned: true primary: true userId: type: integer(4) unsigned: true notnull: true uri: type: string(255) notnull: true xcoord: type: integer(3) unsigned: true notnull: true column: x ycoord: type: integer(3) unsigned: true notnull: true column: y ```
Author
Owner

@doctrinebot commented on GitHub (Oct 26, 2009):

Comment created by @jwage:

Whoops and tableName is not correct.

User_Note:
    table: note
    fields:
      id:
        type: integer(4)
        autoincrement: true
        unsigned: true
        primary: true
      userId:
        type: integer(4)
        unsigned: true
        notnull: true
      uri:
        type: string(255)
        notnull: true
      xcoord:
        type: integer(3)
        unsigned: true
        notnull: true
        column: x
      ycoord:
        type: integer(3)
        unsigned: true
        notnull: true
        column: y
@doctrinebot commented on GitHub (Oct 26, 2009): Comment created by @jwage: Whoops and tableName is not correct. ``` User_Note: table: note fields: id: type: integer(4) autoincrement: true unsigned: true primary: true userId: type: integer(4) unsigned: true notnull: true uri: type: string(255) notnull: true xcoord: type: integer(3) unsigned: true notnull: true column: x ycoord: type: integer(3) unsigned: true notnull: true column: y ```
Author
Owner

@doctrinebot commented on GitHub (Oct 26, 2009):

Issue was closed with resolution "Invalid"

@doctrinebot commented on GitHub (Oct 26, 2009): Issue was closed with resolution "Invalid"
Author
Owner

@doctrinebot commented on GitHub (Oct 26, 2009):

Comment created by chriswest:

ok, thanks for that hint - we currently try to migrate our 1.x scheme to 2.0 and I didn't have a look at the changes in YAML. are there any plans for an "easy" migration process? I think it would help a lot when doctrine 2.0 gets finally released.

@doctrinebot commented on GitHub (Oct 26, 2009): Comment created by chriswest: ok, thanks for that hint - we currently try to migrate our 1.x scheme to 2.0 and I didn't have a look at the changes in YAML. are there any plans for an "easy" migration process? I think it would help a lot when doctrine 2.0 gets finally released.
Author
Owner

@doctrinebot commented on GitHub (Oct 26, 2009):

Comment created by @jwage:

You can convert a 1.0 yaml schema with the convert-mapping task.

./doctrine convert-mapping --from=/path/to/doctrine1/schema --to=yml --dest=newschema
{code

I am not sure if this will remain this way as it is kind of hidden lol. It might be better to have a dedicated task for this.
@doctrinebot commented on GitHub (Oct 26, 2009): Comment created by @jwage: You can convert a 1.0 yaml schema with the convert-mapping task. ``` ./doctrine convert-mapping --from=/path/to/doctrine1/schema --to=yml --dest=newschema {code I am not sure if this will remain this way as it is kind of hidden lol. It might be better to have a dedicated task for this. ```
Author
Owner

@doctrinebot commented on GitHub (Oct 26, 2009):

Comment created by @jwage:

./doctrine convert-mapping --from=/path/to/doctrine1/schema --to=yml --dest=/path/to/newschema
@doctrinebot commented on GitHub (Oct 26, 2009): Comment created by @jwage: ``` ./doctrine convert-mapping --from=/path/to/doctrine1/schema --to=yml --dest=/path/to/newschema ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#72