src/Beans/BeanUtils.php
public static function beansOfType(ApplicationInterface $applicationContext, $class)
    {
        /**
         * @var $objectManager ObjectManagerInterface
         */
        $objectManager = $applicationContext->search("ObjectManagerInterface");
        $initialContext = new InitialContext();
        $initialContext->injectApplication($applicationContext);
        $beans = array();
        foreach ($objectManager->getObjectDescriptors() as $descriptor) {
            if ($descriptor instanceof ComponentDescriptorInterface) {
                if (is_subclass_of($descriptor->getClassName(), $class)) {
                    $beans[$descriptor->getName()] = $initialContext->lookup($descriptor->getName());
                }
            }
        }
        return $beans;
    }
public static function beansOfType(ApplicationInterface $applicationContext, $class)
    {
        /**
         * @var $objectManager ObjectManagerInterface
         */
        $objectManager = $applicationContext->search("ObjectManagerInterface");
        $initialContext = new InitialContext();
        $initialContext->injectApplication($applicationContext);
        $beans = array();
        foreach ($objectManager->getObjectDescriptors() as $descriptor) {
            if ($descriptor instanceof ComponentDescriptorInterface) {
                if (is_subclass_of($descriptor->getClassName(), $class)) {
                    $beans[$descriptor->getName()] = $initialContext->lookup($descriptor->getName());
                }
            }
        }
        return $beans;
    }
public static function beansOfType ( ApplicationInterface $ applicationContext , $ class ) { /**
         * @var $objectManager ObjectManagerInterface
         */ $ objectManager = $ applicationContext -> search ( "ObjectManagerInterface" ) ; $ initialContext = new InitialContext ( ) ; $ initialContext -> injectApplication ( $ applicationContext ) ; $ beans = array ( ) ; foreach ( $ objectManager -> getObjectDescriptors ( ) as $ descriptor ) { if ( $ descriptor instanceof ComponentDescriptorInterface ) { if ( is_subclass_of ( $ descriptor -> getClassName ( ) , $ class ) ) { $ beans [ $ descriptor -> getName ( ) ] = $ initialContext -> lookup ( $ descriptor -> getName ( ) ) ; } } } return $ beans ; }
Returns beans of a specific type
@param ApplicationInterface $applicationContext The applicationContext to search in
@param string               $class              The type of the beans
@return array
Returns beans of a specific type