Example #1
0
 private function _registerEventsForBeanName(Collection $annotations, $beanName)
 {
     if ($annotations->contains('listenson')) {
         $annotation = $annotations->getSingleAnnotation('listenson');
         foreach ($annotation->getOptionValues('value') as $eventCsv) {
             foreach (explode(',', $eventCsv) as $eventName) {
                 if (!isset($this->_knownBeansPerEvent[$eventName])) {
                     $this->_knownBeansPerEvent[$eventName] = array();
                 }
                 $this->_knownBeansPerEvent[$eventName][] = $beanName;
             }
         }
     }
 }
Example #2
0
 /**
  * Adds a bean to $_knownBeans.
  *
  * @param string $class The class for this bean
  * @param string $key Where this bean has been chosen from (i.e: component, configuration, bean, etc)
  * @param Ding\Annotation\Collection $annotations Annotations for this bean
  * @param string $overrideWithName Override this bean name with this one
  * @param string $fBean An optional factory bean
  * @param string $fMethod An optional factory method
  *
  * @return string The name of the bean recently added
  */
 private function _addBean($class, $key, $annotations, $overrideWithName = false, $fBean = false, $fMethod = false)
 {
     $annotation = $annotations->getSingleAnnotation($key);
     $names = $this->_getAllNames($annotation, $overrideWithName);
     $leadName = $names[0];
     $this->_addBeanToKnownByClass($class, $leadName);
     $this->_knownBeans[$leadName] = array($names, $class, $key, $annotations, $fBean, $fMethod);
     // Dont let @Bean methods interfere with bean parentship.
     if (!$fBean) {
         $this->_knownClassesWithValidBeanAnnotations[$class] = $leadName;
     }
     return $leadName;
 }