public function registerEntityManager(ApplicationInterface $application, PersistenceUnitConfigurationInterface $persistenceUnitNode)
    {

        // bind the callback for the Entity Manager instance to the naming directory
        $application->getNamingDirectory()
                    ->bind(
                        sprintf('php:global/%s/%s', $application->getUniqueName(), $lookupName = $persistenceUnitNode->getName()),
                        array(&$this, 'lookup'),
                        array($lookupName)
                    );

        // bind the Entity Manager's configuration to the naming directory
        $application->getNamingDirectory()
                    ->bind(
                        sprintf('php:global/%s/%sConfiguration', $application->getUniqueName(), $lookupName),
                        $persistenceUnitNode
                    );

        // register the entity manager's configuration in the persistence manager
        $this->addEntityManagerName($lookupName);

        // load the object manager instance
        $objectManager = $this->getApplication()->search(ObjectManagerInterface::IDENTIFIER);

        // add the descriptors, necesseary to create the Entity Manaager instance, to the object manager
        $objectManager->addObjectDescriptor(PersistenceUnitDescriptor::newDescriptorInstance()->fromConfiguration($persistenceUnitNode));
        $objectManager->addObjectDescriptor(PersistenceUnitFactoryDescriptor::newDescriptorInstance()->fromConfiguration($persistenceUnitNode));
    }
public function registerEntityManager(ApplicationInterface $application, PersistenceUnitConfigurationInterface $persistenceUnitNode)
    {

        // bind the callback for the Entity Manager instance to the naming directory
        $application->getNamingDirectory()
                    ->bind(
                        sprintf('php:global/%s/%s', $application->getUniqueName(), $lookupName = $persistenceUnitNode->getName()),
                        array(&$this, 'lookup'),
                        array($lookupName)
                    );

        // bind the Entity Manager's configuration to the naming directory
        $application->getNamingDirectory()
                    ->bind(
                        sprintf('php:global/%s/%sConfiguration', $application->getUniqueName(), $lookupName),
                        $persistenceUnitNode
                    );

        // register the entity manager's configuration in the persistence manager
        $this->addEntityManagerName($lookupName);

        // load the object manager instance
        $objectManager = $this->getApplication()->search(ObjectManagerInterface::IDENTIFIER);

        // add the descriptors, necesseary to create the Entity Manaager instance, to the object manager
        $objectManager->addObjectDescriptor(PersistenceUnitDescriptor::newDescriptorInstance()->fromConfiguration($persistenceUnitNode));
        $objectManager->addObjectDescriptor(PersistenceUnitFactoryDescriptor::newDescriptorInstance()->fromConfiguration($persistenceUnitNode));
    }
public function registerEntityManager ( ApplicationInterface $ application , PersistenceUnitConfigurationInterface $ persistenceUnitNode ) { // bind the callback for the Entity Manager instance to the naming directory $ application -> getNamingDirectory ( ) -> bind ( sprintf ( 'php:global/%s/%s' , $ application -> getUniqueName ( ) , $ lookupName = $ persistenceUnitNode -> getName ( ) ) , array ( & $ this , 'lookup' ) , array ( $ lookupName ) ) ; // bind the Entity Manager's configuration to the naming directory $ application -> getNamingDirectory ( ) -> bind ( sprintf ( 'php:global/%s/%sConfiguration' , $ application -> getUniqueName ( ) , $ lookupName ) , $ persistenceUnitNode ) ; // register the entity manager's configuration in the persistence manager $ this -> addEntityManagerName ( $ lookupName ) ; // load the object manager instance $ objectManager = $ this -> getApplication ( ) -> search ( ObjectManagerInterface :: IDENTIFIER ) ; // add the descriptors, necesseary to create the Entity Manaager instance, to the object manager $ objectManager -> addObjectDescriptor ( PersistenceUnitDescriptor :: newDescriptorInstance ( ) -> fromConfiguration ( $ persistenceUnitNode ) ) ; $ objectManager -> addObjectDescriptor ( PersistenceUnitFactoryDescriptor :: newDescriptorInstance ( ) -> fromConfiguration ( $ persistenceUnitNode ) ) ; }
Deploys the entity manager described by the passed XML node.

@param \AppserverIo\Psr\Application\ApplicationInterface                            $application         The application instance
@param \AppserverIo\Description\Configuration\PersistenceUnitConfigurationInterface $persistenceUnitNode The XML node that describes the entity manager

@return void
Deploys the entity manager described by the passed XML node .