Well moving to xml, I did auto-generate xml files, I looked at one of them
and see this:
<entity name="PrefixClients" table="prefix_clients">
Then in bootstrap I did set this:
$paths = array(__DIR__."xml");
$config = Setup::createXMLMetadataConfiguration($paths, $isDevMode);
$em = EntityManager::create($dbParams, $config);
Now is this ready to run a query using xml instead of php class?
I used this to query:
$rsm = new Doctrine\ORM\Query\ResultSetMapping;
$rsm->addEntityResult('PrefixClients', 'u');
$rsm->addFieldResult('u', 'client_id', 'clientId');
$rsm->addFieldResult('u', 'first_name', 'firstName');
$query = $em->createNativeQuery('SELECT client_id, first_name FROM
prefix_clients WHERE username = ?', $rsm);
$query->setParameter(1, 'blah');
$users = $query->getResult();
print_r($users);
and I got this error: please advice what wrong I did? if you help me fixing
this I believe the php problem will be fixed too?
Warning: array_map(): An error occurred while invoking the map callback in
/home2/edited/composer/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php
on line 324
Fatal error: Uncaught exception
'Doctrine\Common\Persistence\Mapping\MappingException' with message 'Class
'editedgineClients' does not exist' in
/home2/edited/composer/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/MappingException.php:96
Stack trace:
#0
/home2/edited/composer/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/RuntimeReflectionService.php(40):
Doctrine\Common\Persistence\Mapping\MappingException::nonExistingClass('editedgineCli...')
#1
/home2/edited/composer/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php(267):
Doctrine\Common\Persistence\Mapping\RuntimeReflectionService->getParentClasses('editedgineCli...')
#2
/home2/edited/composer/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php(297):
Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getParentClasses('editedgineCli...')
#3
/home2/edited/composer/vendor/doctrine/common/lib/Doctrine/Common/Persisten
in
/home2/edited/composer/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/MappingException.php
on line 96
On Monday, February 3, 2014 1:29:24 PM UTC+1, Parsifal wrote:
>
> My apolgies to Marco to post a new thread instead of under the same
> thread, this is because under that another thread I asked about proxy and I
> am waiting for the answer yet.
> I was able to fix class not found. I see in entity file, there is
> something like:
> 'fieldName' => 'clientId',
> 'columnName' => 'client_id',
> Should I change field name to client_id that is actually my coloumn name?
> or just adding
> protected $clientId;
> is enough to solve the problem below?
>
>
> Fatal error: Uncaught exception 'ReflectionException' with message
> 'Property Entities\clients::$clientId does not exist' in
> /home2/edited/composer/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/RuntimeReflectionService.php:79
>
> Stack trace:
>
> #0
> /home2/edited/composer/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/RuntimeReflectionService.php(79):
>
> ReflectionProperty->__construct('Entities\client...', 'clientId')
>
> #1
> /home2/edited/composer/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php(889):
>
> Doctrine\Common\Persistence\Mapping\RuntimeReflectionService->getAccessibleProperty('Entities\client...',
>
> 'clientId')
>
> #2
> /home2/edited/composer/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php(537):
>
> Doctrine\ORM\Mapping\ClassMetadataInfo->wakeupReflection(Object(Doctrine\Common\Persistence\Mapping\RuntimeReflectionService))
>
> #3
> /home2/edited/composer/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php(329):
>
> Doctrine\ in
> /home2/edited/composer/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/RuntimeReflectionService.php
>
> on line 79
>
--
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/groups/opt_out.