-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DDC-149: No owner found for field when selecting from a table with @InheritanceType SINGLE_TABLE #2118
Comments
Comment created by romanb: Can you give us some code to reproduce? |
Comment created by rickdt: I did not test with this, but here is a simplified version of my entity classes et my query.
|
Comment created by rickdt: This comment have been moved to DDC-150 I have another major problem with the same class. I can open an other case if you want. The discriminator value column is lost after querying on an object. Before this, $rev_type field equal "HEAD". After, it is empty string.
|
Comment created by romanb: Why do you map the discriminator column to a property? Just like foreign keys its not intended to be visible in your classes, its a detail of the relational database. |
Comment created by rickdt: I did this trying to workaround the bug. |
Comment created by rickdt: If I remove the discriminator column from the entity, I still get the "No owner found for field" error and the proposed fix (look into meta mapping) does not work. Maybe the field should just be ignored. |
Comment created by rickdt: Are you OK to investigate on this or you need more input from me ? I may also simulate this behavior at application level if you tell me this feature is too far away from being ready for use. |
Comment created by romanb: There are still some things that are unclear to me.
A failing test case would be best. That means either a phpunit test or a small functional version as an attachment that reproduces the issue. Thanks for your help. |
Comment created by romanb: OK, my first question is answered when looking at the stack trace. So you use getScalarResult. |
Comment created by romanb: I will try to make a test for Single Table Inheritance + getScalarResult in our test suite. Maybe this shows the issue already. I will report back as soon as I have more questions. |
Comment created by rickdt:
For the test case. This represent quiet some work and if it's not absolutely necessary, I prefer not do it. Thank You! |
Comment created by rickdt: For the line numbers in the stack trace, I just understood your question. Line number are different because I added some debugging output. |
Comment created by rickdt: Got it ! That was so simpe, I dont't know why we did not see it. *gatherScalarRowData is missing a case that is properly handled by *gatherRowData
|
Comment created by rickdt: This fix the issue |
Issue was closed with resolution "Fixed" |
Imported 1 attachments from Jira into https://gist.github.com/8d6b5470301d470a8d11 |
Jira issue originally created by user rickdt:
In class AbstractHydrator::_gatherScalarRowData, I get an exception when the result contain metaMappings.
The problem is that $fieldName is empty when obtained this way :
$fieldName = $this->_rsm->fieldMappings[$key];
I think you should also check into :
$this->_rsm->metaMappings[$key];
May a better way would be to add a public function to ResultSetMapping like getMappedFieldName() which would look into both properties.
Here is the exception :
#0 [internal function]: Doctrine\Common\DoctrineException::**callStatic('noOwnerFoundFor...', Array)
#1 /home/eric/Zend/workspaces/DefaultWorkspace7/fna/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php(316): Doctrine\Common\DoctrineException::noOwnerFoundForField(Object(Doctrine\ORM\Mapping\ClassMetadata), NULL)
#2 /home/eric/Zend/workspaces/DefaultWorkspace7/fna/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php(267): Doctrine\ORM\Internal\Hydration\AbstractHydrator->_lookupDeclaringClass(Object(Doctrine\ORM\Mapping\ClassMetadata), NULL)
#3 /home/eric/Zend/workspaces/DefaultWorkspace7/fna/lib/Doctrine/ORM/Internal/Hydration/ScalarHydrator.php(42): Doctrine\ORM\Internal\Hydration\AbstractHydrator->_gatherScalarRowData(Array, Array)
#4 /home/eric/Zend/workspaces/DefaultWorkspace7/fna/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php(103): Doctrine\ORM\Internal\Hydration\ScalarHydrator->_hydrateAll()
#5 /home/eric/Zend/workspaces/DefaultWorkspace7/fna/lib/Doctrine/ORM/AbstractQuery.php(497): Doctrine\ORM\Internal\Hydration\AbstractHydrator->hydrateAll(Object(Doctrine\DBAL\Driver\PDOStatement), Object(Doctrine\ORM\Query\ResultSetMapping), Array)
#6 /home/eric/Zend/workspaces/DefaultWorkspace7/fna/lib/Doctrine/ORM/AbstractQuery.php(361): Doctrine\ORM\AbstractQuery->execute(Array, 3)
#7 /home/eric/Zend/workspaces/DefaultWorkspace7/fna/application/Kronos/FNA/View/FNA/FNAList.php(99): Doctrine\ORM\AbstractQuery->getScalarResult()
The text was updated successfully, but these errors were encountered: