Revision: 185
http://sourceforge.net/p/beeframework/code/185
Author: m_plomer
Date: 2014-07-23 12:37:06 +0000 (Wed, 23 Jul 2014)
Log Message:
-----------
- Doctrine2: entity injection fixed
Modified Paths:
--------------
trunk/framework/Bee/Persistence/Doctrine2/BeanInjection/InjectionEventListener.php
Modified: trunk/framework/Bee/Persistence/Doctrine2/BeanInjection/InjectionEventListener.php
===================================================================
--- trunk/framework/Bee/Persistence/Doctrine2/BeanInjection/InjectionEventListener.php 2014-07-20 19:55:34 UTC (rev 184)
+++ trunk/framework/Bee/Persistence/Doctrine2/BeanInjection/InjectionEventListener.php 2014-07-23 12:37:06 UTC (rev 185)
@@ -15,6 +15,7 @@
* Class InjectionEventListener
*/
class InjectionEventListener implements EventSubscriber, \Bee_Context_Config_IContextAware {
+
/**
* @var Reader
*/
@@ -29,24 +30,21 @@
* @param LifecycleEventArgs $eventArgs
*/
public function postLoad(LifecycleEventArgs $eventArgs) {
-
$entity = $eventArgs->getEntity();
$reflClass = new ReflectionClass($entity);
foreach($reflClass->getProperties() as $prop) {
- foreach ($this->reader->getPropertyAnnotations($prop) AS $annot) {
- if ($annot instanceof Inject) {
- $this->injectIntoProperty($entity, $prop, $annot);
- }
+ $annot = $this->reader->getPropertyAnnotation($prop, 'Bee\Persistence\Doctrine2\BeanInjection\Inject');
+ if ($annot instanceof Inject) {
+ $this->injectIntoProperty($entity, $prop, $annot);
}
}
foreach($reflClass->getMethods(ReflectionProperty::IS_PUBLIC) as $method) {
if($method->getNumberOfRequiredParameters() == 1) {
- foreach ($this->reader->getMethodAnnotations($method) AS $annot) {
- if ($annot instanceof Inject) {
- $this->injectIntoSetter($entity, $method, $annot);
- }
+ $annot = $this->reader->getMethodAnnotation($method, 'Bee\Persistence\Doctrine2\BeanInjection\Inject');
+ if ($annot instanceof Inject) {
+ $this->injectIntoSetter($entity, $method, $annot);
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|