1

I use Doctrine 2.6.3 with Symfony 4.3.1 and Postgres 10

Unfortunately when I specify a simple_array or array column type, the Doctrine just simple create that column as TEXT, but why? Postgres supports int arrays too.

     @ORM\Column(type="simple_array", nullable=true)

I want to store some enum values here: [1, 2, 3, 4] and thats all, integers.

How can I force Doctrine to creaet int_array type for the column instead of text?

1 Answer 1

3

Both array and simple_array default to text:

This type will always be mapped to the database vendor's text type internally as there is no way of storing a PHP array representation natively in the database.

If you want to leverage native types giving up on portability, you can give this doctrine dbal extension a try.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.