I want to combine the results of 2 tables.Query is:
$sql = "(SELECT p.quote_id FROM order_products p ) UNION (SELECT s.quote_id
FROM order_services s ) ";
I have used native sql which is:
$rsm = new ResultSetMapping();
$rsm->addEntityResult('\Admin\Entity\OrderProducts', 'p');
$rsm->addEntityResult('\Admin\Entity\OrderServices', 's');
$rsm->addFieldResult('p', 'quote_id', 'quoteId');
$rsm->addFieldResult('s', 'quote_id', 'quoteId');
$query = $this->em->createNativeQuery($sql, $rsm);
$query->getResult();
It is showing this error:
Unknown column type "" requested. Any Doctrine type that you use has to be
registered with \Doctrine\DBAL\Types\Type::addType(). You can get a list of all
the known types with \Doctrine\DBAL\Types\Type::getTypesMap(). If this error
occurs during database introspection then you might have forgot to register all
database types for a Doctrine Type. Use
AbstractPlatform#registerDoctrineTypeMapping() or have your custom types
implement Type#getMappedDatabaseTypes(). If the type name is empty you might
have a problem with the cache or forgot some mapping information.
I am new to native sql so any better solution/suggestion will be highly
appreciated.
--
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.