src/mg/Ding/Bean/Factory/Driver/AnnotationResourceDriver.php
public function afterDefinition(BeanDefinition $bean)
    {
        $class = $bean->getClass();
        $rClass = $this->reflectionFactory->getClass($class);
        $properties = $bean->getProperties();
        foreach ($rClass->getMethods() as $method) {
            $methodName = $method->getName();
            if (strpos($methodName, 'set') !== 0) {
                continue;
            }
            $annotations = $this->reflectionFactory->getMethodAnnotations($class, $methodName);
            if (!$annotations->contains('resource')) {
                continue;
            }
            $propName = lcfirst(substr($methodName, 3));
            $name = $propName;
            $annotation = $annotations->getSingleAnnotation('resource');
            if ($annotation->hasOption('name')) {
                $name = $annotation->getOptionSingleValue('name');
            }
            $properties[$propName] = new BeanPropertyDefinition(
                $propName, BeanPropertyDefinition::PROPERTY_BEAN, $name
            );
        }
        foreach ($rClass->getProperties() as $property) {
            $propertyName = $property->getName();
            $annotations = $this->reflectionFactory->getPropertyAnnotations($class, $propertyName);
            if (!$annotations->contains('resource')) {
                continue;
            }
            $annotation = $annotations->getSingleAnnotation('resource');
            $name = $propertyName;
            if ($annotation->hasOption('name')) {
                $name = $annotation->getOptionSingleValue('name');
            }
            $properties[$propertyName] = new BeanPropertyDefinition(
                $propertyName, BeanPropertyDefinition::PROPERTY_BEAN, $name
            );
        }
        $bean->setProperties($properties);
        return $bean;
    }
public function afterDefinition(BeanDefinition $bean)
    {
        $class = $bean->getClass();
        $rClass = $this->reflectionFactory->getClass($class);
        $properties = $bean->getProperties();
        foreach ($rClass->getMethods() as $method) {
            $methodName = $method->getName();
            if (strpos($methodName, 'set') !== 0) {
                continue;
            }
            $annotations = $this->reflectionFactory->getMethodAnnotations($class, $methodName);
            if (!$annotations->contains('resource')) {
                continue;
            }
            $propName = lcfirst(substr($methodName, 3));
            $name = $propName;
            $annotation = $annotations->getSingleAnnotation('resource');
            if ($annotation->hasOption('name')) {
                $name = $annotation->getOptionSingleValue('name');
            }
            $properties[$propName] = new BeanPropertyDefinition(
                $propName, BeanPropertyDefinition::PROPERTY_BEAN, $name
            );
        }
        foreach ($rClass->getProperties() as $property) {
            $propertyName = $property->getName();
            $annotations = $this->reflectionFactory->getPropertyAnnotations($class, $propertyName);
            if (!$annotations->contains('resource')) {
                continue;
            }
            $annotation = $annotations->getSingleAnnotation('resource');
            $name = $propertyName;
            if ($annotation->hasOption('name')) {
                $name = $annotation->getOptionSingleValue('name');
            }
            $properties[$propertyName] = new BeanPropertyDefinition(
                $propertyName, BeanPropertyDefinition::PROPERTY_BEAN, $name
            );
        }
        $bean->setProperties($properties);
        return $bean;
    }
(non-PHPdoc)
@see Ding\Bean\Lifecycle.IAfterDefinitionListener::afterDefinition()