Hi all
Help how to fill column alias( *number_document* ) receive data column that
is not part of the entity to return object correctly without error. The SQL
executed correctly the problem is with in populate entitiy with column
dinamic.
I am not knowing how to apply ( *addMetaResult* and *setDisciminatorColumn*
perhaps
not even the case I doing wrong way ) to the case I need Example below
Please help :(
$rsm = new \Doctrine\ORM\Query\ResultSetMapping();
$rsm->addEntityResult('Document', 'd');
$rsm->addMetaResult('d', '*number_document*', '*number_document*');
// discriminator column
$rsm->setDiscriminatorColumn('d', '*number_document*');
$rsm->addJoinedEntityResult('Document_interested' , 'i', 'd',
'interested');
$rsm->addJoinedEntityResult('Documento_type_interested' , 't', 'd',
'type_document');
$sql = "select distinct d.id,
case when
d.number_office is null then
d.information_number_document
else
to_char(d.number_office,'0000')
end as *number_document*
from
document d left join documento_type_interested t on
(t.document_id = d.id)
left join document_interested as i on
(d.document_interested_id = i.id)
where
t.type != ? and
d.stat_document = ?
limit 5";
$query = $this->em->createNativeQuery($sql, $rsm);
$query->setParameter(1, '0');
$query->setParameter(2, 'T');
$result_obj = $query->getResult();
var_dump( $result_obj );
Error:
A PHP Error was encountered
Severity: Notice
Message: Undefined index: 01/03/1209-FT
Filename: Hydration/ObjectHydrator.php
Line Number: 234
Fatal error: Uncaught exception 'ReflectionException' with message 'Class
does not exist' in
/myproject/sis/application/third_party/Doctrine/Common/Persistence/Mapping/RuntimeReflectionService.php
on line *73*
--
You received this message because you are subscribed to the Google Groups
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.