In my legacy code I have this class . . .
class Motor
{
//db table motor_part_sizes
//physical dimensions relating to various screw sizes
private $a;
private $b;
private $c;
//db table motor_part_length
//also dimensions relating to length
private $adapter_length;
private $motor_length;
}
The above object in legacy code is pulled from two tables.
When converting my table entities to Doctrine, I created two entities. Now my problem is that existing legacy code expects the above object to contain data from both entities.
I can certainly craft an raw SQL query that loads up the above object and that is how it is done in the code, but when it comes to Doctrine, how do I go about creating such a composite entity without having to ransack a lot of existing legacy code from the get go?
Is there a different way to solve this altogether? What I did currently was to load up two Doctrine entities separately, and then use a factory method to populate existing object above. Essentially I do
$motor->setDataFromTable1($data1);
$motor->setDataFromTable2($data2);
So I resolved this via OOP. Curious about more Doctrine-centric approaches.