There is a table fileand a table in my database file_content. A table filestores file metadata, such as name, mimeand some others. file_contentstores blob with the contents of the file. I do not save blob in the same table as metadata for performance reasons only.
For the “version 2” of my project, I study Teaching (2.3). It seems to me that the "File" - it is one object with properties such as name, mime, extension, content, to be used as follows:
$file = new File();
$file->setName('hello.txt');
$file->setMime('text/plain');
$file->setContent('Hello world!')
$em->persist($file);
$em->flush();
Is this possible? It makes no sense for me to create two objects for something that is really just one entity. I could not find anything about this in the documentation, and I read a 2-year topic that this is not possible in Doctrine 2.1: Doctrine 2.1 - Map object for multiple tables
Someone tell me how to do it right? I am new to Doctrine and have played with it a bit to make sure this is the right choice for my project. Thank.
source
share