DDC-647: string length not taken into account on id while using Yaml driver #798

Closed
opened 2026-01-22 12:50:47 +01:00 by admin · 4 comments
Owner

Originally created by @doctrinebot on GitHub (Jun 20, 2010).

Jira issue originally created by user goriol:

The string lenght specified in the Yaml file is not respected on id columns.

Sample YAML file


---
# Entities.Stock.dcm.yml
Entities\Stock:
  type: entity
  table: stocks
  id:
    id:
      type: string
      length: 10
      generator:
        strategy: NONE
  fields:
    nature:
      type: string
      length: 10
    name:
      type: string
      length: 40
    creationDate:
      name: creation_date
      type: datetime
    owner:
      type: string
      length: 8

Command used to generate the SQL statements:
./doctrine orm:schema-tool:create --dump-sql

Result:

CREATE TABLE stocks (id VARCHAR(255) NOT NULL, nature VARCHAR(12) NOT
NULL, name VARCHAR(40) NOT NULL, creationDate DATETIME NOT NULL, owner
VARCHAR(8) NOT NULL, PRIMARY KEY(id)) ENGINE = InnoDB

The "id" is generated as VARCHAR(255) instead of VARCHAR(10).

Originally created by @doctrinebot on GitHub (Jun 20, 2010). Jira issue originally created by user goriol: The string lenght specified in the Yaml file is not respected on id columns. Sample YAML file ``` --- # Entities.Stock.dcm.yml Entities\Stock: type: entity table: stocks id: id: type: string length: 10 generator: strategy: NONE fields: nature: type: string length: 10 name: type: string length: 40 creationDate: name: creation_date type: datetime owner: type: string length: 8 ``` Command used to generate the SQL statements: ./doctrine orm:schema-tool:create --dump-sql Result: ``` CREATE TABLE stocks (id VARCHAR(255) NOT NULL, nature VARCHAR(12) NOT NULL, name VARCHAR(40) NOT NULL, creationDate DATETIME NOT NULL, owner VARCHAR(8) NOT NULL, PRIMARY KEY(id)) ENGINE = InnoDB ``` The "id" is generated as VARCHAR(255) instead of VARCHAR(10).
admin added the Bug label 2026-01-22 12:50:47 +01:00
admin closed this issue 2026-01-22 12:50:48 +01:00
Author
Owner

@doctrinebot commented on GitHub (Jun 20, 2010):

Comment created by @beberlei:

Fixed formating

@doctrinebot commented on GitHub (Jun 20, 2010): Comment created by @beberlei: Fixed formating
Author
Owner

@doctrinebot commented on GitHub (Jun 22, 2010):

Comment created by shurakai:

Fixed: http://github.com/Shurakai/doctrine2/tree/DDC-647

@doctrinebot commented on GitHub (Jun 22, 2010): Comment created by shurakai: Fixed: http://github.com/Shurakai/doctrine2/tree/[DDC-647](http://www.doctrine-project.org/jira/browse/DDC-647)
Author
Owner

@doctrinebot commented on GitHub (Jun 22, 2010):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Jun 22, 2010): Issue was closed with resolution "Fixed"
Author
Owner

@doctrinebot commented on GitHub (Jun 28, 2010):

Comment created by @beberlei:

Hey Christian, please don't mark bugs as fixed that have not been merged into the main repository yet.

Merged now

@doctrinebot commented on GitHub (Jun 28, 2010): Comment created by @beberlei: Hey Christian, please don't mark bugs as fixed that have not been merged into the main repository yet. Merged now
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#798