mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-260: Add additional info to ReflectionException in ClassMetadata #321
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Jan 16, 2010).
Jira issue originally created by user shurakai:
I was thinking about adding an additional exception to the ClassMetadata class. For example when using reflection for recieving an attribute and an exception is raised (for example because the attribute does not exist), the debug information could be improved. I thought one could catch the ReflectionException and throw a DoctrineReflectionException or something like that and add some additional information like what the name of the currently processed class is
@doctrinebot commented on GitHub (Jan 16, 2010):
Comment created by romanb:
I dont think that would be overly useful as the exceptions from php are pretty good. Can you show an example of the error, the message you get and the improved message you would like to get instead?
@doctrinebot commented on GitHub (Jan 16, 2010):
Comment created by shurakai:
Hi Roman,
i ran the doctrine CLI tool and tried "schema-tool". One of my PHP entities classes hadn't all properties defined in my YAML files (I'm wondering why Doctrine needs to perform Reflection on my PHP classes when converting from YAML...?) and I recieve this error:
{quote} PHP Fatal error: Uncaught exception 'ReflectionException' with message 'Property children does not exist' in /var/workspaces/project/library/Doctrine/ORM/Mapping/ClassMetadata.php:244
Stack trace:
#0 /var/workspaces/project/library/Doctrine/ORM/Mapping/ClassMetadata.php(244): ReflectionClass->getProperty('children')
#1 /var/workspaces/project/library/Doctrine/ORM/Mapping/ClassMetadataInfo.php(1298): Doctrine\ORM\Mapping\ClassMetadata->_storeAssociationMapping(Object(Doctrine\ORM\Mapping\OneToManyMapping))
#2 /var/workspaces/project/library/Doctrine/ORM/Mapping/Driver/YamlDriver.php(266): Doctrine\ORM\Mapping\ClassMetadataInfo->mapOneToMany(Array)
#3 /var/workspaces/project/library/Doctrine/ORM/Mapping/ClassMetadataFactory.php(195): Doctrine\ORM\Mapping\Driver\YamlDriver->loadMetadataForClass('Core\Block\Item...', Object(Doctrine\ORM\Mapping\ClassMetadata))
#4 /var/workspaces/project/library/Doctrine/ORM/Mapping/ClassMetadataFactory.php(111): Doctrine\ORM\Mapping\ClassMetadataFactory->_loadMetadata('Core\Block\Item...')
#5 /va in /var/workspaces/project/library/Doctrine/ORM/Mapping/ClassMetadata.php on line 244
{quote}
The problem here is, that I'm not told in which class the problem occurs because PHP automatically shortens the parameters displayed. Therefore, I need to guess, and thats definitely something I don't want to do.
The errormessage I'd like to see:
. The error occurred in class .
So in this case:
{quote}Property children does not exist. The error occurred in class Core\Block\Item\Panel\AbstractPanel{quote}
@doctrinebot commented on GitHub (Jan 21, 2010):
Comment created by shurakai:
This should fix this issue
@doctrinebot commented on GitHub (Jan 21, 2010):
Comment created by @guilhermeblanco:
In r7041 this issue was fixed.
Thanks for the patch!
@doctrinebot commented on GitHub (Jan 21, 2010):
Issue was closed with resolution "Fixed"
@doctrinebot commented on GitHub (Dec 13, 2015):
Imported 1 attachments from Jira into https://gist.github.com/9b82263fa4659f96cab3