Answer the question
In order to leave comments, you need to log in
What is the best way (using the console) to convert the type of an entity field Integer to Relation in Symfony?
Suppose I have an int_key field of type Integer
in my Symfony entity table1
and now I want to make this field a key for communicating with table table2 (ManyToOne)
Well, roughly speaking, I have numbers in int_key , and now I want these to be not just numbers, and IDs are table2 , where text descriptions for each number are stored))
How can I do this in the least laborious and correct way through php bin/console so that the data is not lost in table1 and all that?
Thank you. upd.
I want the effect to be completely equivalent to how if I initially created the entity using $ php bin/console make:entity and specified in it instead of integer - relation. So that it itself creates the correct getters and setters for the field.
And yes, a related question:
- Changes need to be made ONLY in two files - 1) in the entity / model and 2) create a new migration, or is there something else that needs to be changed / corrected somewhere?
If only this, then, yes, in principle, you can change the essence with your hands.
By the way, here it is:
then send a command through the console so that the doctrine generates :diff and creates a migration
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question