doctrine / orm

Doctrine Object Relational Mapper (ORM)
https://www.doctrine-project.org/projects/orm.html
MIT License
9.93k stars 2.52k forks source link

Generated entity with MAX length are translated by 0 #5994

Open ajira86 opened 8 years ago

ajira86 commented 8 years ago

Hello,

In the context of a large project, I generated multiple entities from a MS SQL database. I notice that all fields nvarchar(MAX) were translated in annotation attribute length=0 like this:

    /**
     * @var string
     *
     * @ORM\Column(name="name", type="string", length=0, nullable=true)
     */
    protected $name;

Shouldn't be better to remove the length limit in this case ?

Ocramius commented 8 years ago

@ajira86 a removed length would result in a length=255 by default. Also, seems like a schema introspection issue. Can this be isolated into the DBAL code that causes it, and then reported there in more detail?

ajira86 commented 8 years ago

Thank you for your reply, I was not excepting this default value.

Can this be isolated into the DBAL code that causes it, and then reported there in more detail?

How can I get this kind of report ?

FYI: I'm using Symfony and the module leaseweb/doctrine-pdo-dblib as DBAL driver for the use of FreeTDS

Ocramius commented 8 years ago

@ajira86 you'd need to debug it and figure out what the DatabaseDriver does, then figure out if the MAX is cast to 0 by the DBAL or by the driver itself.