Bug #26128

Doctrine persistence manager compilation should be configurable

Added by Christopher Hlubek over 10 years ago. Updated about 10 years ago.

Status:
Resolved
Priority:
Should have
Category:
Persistence
Target version:
-
Start date:
2011-04-19
Due date:
% Done:

100%

Estimated time:
PHP Version:
Has patch:
Complexity:

Description

The compile method of the Doctrine persistence manager is currently hard-coded inside the FLOW3 Metapackage:

class Package extends BasePackage {

    /**
     * Invokes custom PHP code directly after the package manager has been initialized.
     *
     * @param \F3\FLOW3\Core\Bootstrap $bootstrap The current bootstrap
     * @return void
     */
    public function boot(\F3\FLOW3\Core\Bootstrap $bootstrap) {
        require_once(__DIR__ . '/../Resources/PHP/AutoLoader.php');

        $bootstrap->registerCompiletimeCommandController('flow3:object');
        $bootstrap->registerCompiletimeCommandController('flow3:core');
        $bootstrap->registerCompiletimeCommandController('flow3:cache');

        $dispatcher = $bootstrap->getSignalSlotDispatcher();
        $dispatcher->connect('F3\FLOW3\Core\Bootstrap', 'finishedRuntimeRun', 'F3\FLOW3\Persistence\PersistenceManagerInterface', 'persistAll');
        $dispatcher->connect('F3\FLOW3\Core\Bootstrap', 'bootstrapShuttingDown', 'F3\FLOW3\Configuration\ConfigurationManager', 'shutdown');
        $dispatcher->connect('F3\FLOW3\Core\Bootstrap', 'bootstrapShuttingDown', 'F3\FLOW3\Object\ObjectManagerInterface', 'shutdown');
        $dispatcher->connect('F3\FLOW3\Core\Bootstrap', 'bootstrapShuttingDown', 'F3\FLOW3\Reflection\ReflectionService', 'saveToCache');

        $dispatcher->connect('F3\FLOW3\Command\CoreCommandController', 'finishedCompileCommand', 'F3\FLOW3\Persistence\Doctrine\PersistenceManager', 'compile');
    }
}

If an alternative (generic) persistence is used, there is no need for the compile call, especially since Doctrine puts restrictions on the model.

There should be some kind of configuration option to prevent the Doctrine compilation.

#1

Updated by Christopher Hlubek over 10 years ago

The mere existence of the PersistenceManager is a problem if no driver is configured:

Uncaught exception in line 147 of .../Packages/Framework/FLOW3/Resources/PHP/Doctrine/DBAL/DriverManager.php: The options 'driver' or 'driverClass' are mandatory if no PDO instance is given to DriverManager::getConnection()

Disabling the connect between finishedCompileCommand and PersistenceManager->compile fixes this problem, since no PersistenceManager will be created (given that another Backend and the generic PersistenceManager are configured).

#2

Updated by Karsten Dambekalns about 10 years ago

  • Category set to Persistence
  • Status changed from New to Accepted
#3

Updated by Christopher Hlubek about 10 years ago

The problem inside the package is gone. Now I face the problem, that the Doctrine compilation is always executed in non-production contexts in Bootstrap->initializeForRuntime:

        if ($this->context !== 'Production') {
            $coreCache = $this->cacheManager->getCache('FLOW3_Core');
            if ($coreCache->has('doctrineSetupRunning') === FALSE) {
                $coreCache->set('doctrineSetupRunning', 'White Russian', array(), 60);
                $this->systemLogger->log('Updating Doctrine DB and proxies', LOG_DEBUG);
                $this->executeCommand('flow3:doctrine:update');
                $this->executeCommand('flow3:doctrine:compileproxies');
                $coreCache->remove('doctrineSetupRunning');
            }
        }
#4

Updated by Mr. Hudson about 10 years ago

Patch set 1 of change I95165074115d16c70d00ccfb42512de2e8009cb6 has been pushed to the review server.
It is available at http://review.typo3.org/2305

#5

Updated by Christopher Hlubek about 10 years ago

  • Status changed from Accepted to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF