I have a handler that uses the same Entityfor two different types of queries:
abstract class Meter
{
const TYPE_PHYSICAL = 'PHY';
const TYPE_VIRTUAL = 'VIR';
const TYPE_LOGICAL = 'LOG';
protected $id;
<methods>
}
class PhyMeter extends Meter
{
protected $idInstrum;
protected $idDevice;
protected $instrumType;
...<methods>
}
First handler method is performed in the old DB table, and it will display all fields need annotated using @ORM\Column( id, idInstrum, idDevice, instrumType). To do this, I use a primitive query and match the data withResultSetMapping
$rsm = new ResultSetMapping;
$rsm->addEntityResult('Belka\Iso50k1Bundle\Entity\PhyMeter', 'mt');
$rsm->addFieldResult('mt', 'id', 'id');
...
and it works like a charm. The problem lies in the way of another handler, which must be stored in the table app.meter: what I really wanted to keep - this is a small part of the property (ie only id, idInstrumbut not instrumTypeto have this column in my new table schema.
StaticPHPDriver, , : / ORM- (.. )
? (@ORM\Column ). , ResultSetMapping, .