AppserverIo\Appserver\PersistenceContainer\PersistenceManagerFactory::visit PHP Method

visit() public static method

The main method that creates new instances in a separate context.
public static visit ( AppserverIo\Psr\Application\ApplicationInterface $application, AppserverIo\Appserver\Core\Api\Node\ManagerNodeInterface $managerConfiguration ) : void
$application AppserverIo\Psr\Application\ApplicationInterface The application instance to register the class loader with
$managerConfiguration AppserverIo\Appserver\Core\Api\Node\ManagerNodeInterface The manager configuration
return void
    public static function visit(ApplicationInterface $application, ManagerNodeInterface $managerConfiguration)
    {
        // initialize the stackable for the entity managers
        $entityManagers = new GenericStackable();
        // initialize the default settings for the persistence units
        $persistenceManagerSettings = new PersistenceManagerSettings();
        $persistenceManagerSettings->mergeWithParams($managerConfiguration->getParamsAsArray());
        // initialize the persistence manager instance
        $persistenceManager = new PersistenceManager();
        $persistenceManager->injectApplication($application);
        $persistenceManager->injectEntityManagers($entityManagers);
        $persistenceManager->injectManagerSettings($persistenceManagerSettings);
        // create the naming context and add it the manager
        $contextFactory = $managerConfiguration->getContextFactory();
        $contextFactory::visit($persistenceManager);
        // attach the instance
        $application->addManager($persistenceManager, $managerConfiguration);
    }
PersistenceManagerFactory