Answer the question
In order to leave comments, you need to log in
Symfony - is life without Entity possible?
Porting an existing project to Symfony for hands-on experience.
There are a few questions regarding (perhaps) the development philosophy.
There are many entities that differ in some characteristics (roughly speaking, there are five types of materials that have common properties and some that are unique).
In the old project - there were 6 tables, five - where unique characteristics are stored, and one - where general + some additional ones are stored.
It turns out that it will be necessary to add processing to five entities in the controller or still create a sixth one? Or maybe there is some approach, best practice?
It may be confusing, but I hope it's understandable.
Examples of entities, roughly speaking.
Article - id, title, date, type, render
Text extends Article + body
Photo extends Article + photo_list
Video extends Article + video_code
Answer the question
In order to leave comments, you need to log in
For the example you gave, I would do the following: I would make the Article class abstract, mark it as MappedSuperclass , transfer the general properties there (title, date, type, render), and inherit Photo, Video, Text from it. And, most importantly, in the project structure, I would transfer Article from Entity to Model, since this is no longer a database entity. Id is better to describe manually in each entity.
Answering the actual question in the title: you can not create an Entity. Work through requests, hydrogenate responses into arrays, especially if it is justified by circumstances, and not something from the category "why do I need a version control system? why do I need ide, can I do it in a notepad?".
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question