Q
Q
Quber2015-01-09 16:32:56
symfony
Quber, 2015-01-09 16:32:56

Is it possible to adjust the length parameter of an integer field in Doctrine 2?

If the field is of type "string" then you can easily assign any length of the field:

/**
 * @ORM\Column(type="string", length=60)
 */
protected $title;

If I set an integer type parameter, then no matter what length I set, it is always one 11.
If I set smallint, then the length is set to 6. Is it possible to adjust the length type parameter for this type of field?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
manyrus, 2015-01-09
@manyrus

If I haven't forgotten, then int is regulated by min and max. So you can get the desired length :)

A
Alex, 2015-01-09
@shoomyst

case 'tinyint':
            case 'smallint':
            case 'mediumint':
            case 'int':
            case 'integer':
            case 'bigint':
            case 'year':
                $length = null;
                break;

Maybe there is a way to indicate some kind of workaround, I don’t know this, but I kind of don’t use them :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question