Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

43 lines (37 sloc) 1.46 KB
* This file is part of the Doctrine MongoDBBundle
* The code was originally distributed inside the Symfony framework.
* (c) Fabien Potencier <>
* (c) Doctrine Project
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
namespace Doctrine\Bundle\MongoDBBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class CreateProxyDirectoryPass implements CompilerPassInterface
public function process(ContainerBuilder $container)
if (!$container->hasParameter('doctrine.odm.mongodb.proxy_dir')) {
// Don't do anything if auto_generate_proxy_classes is false
if (!$container->getParameter('doctrine.odm.mongodb.auto_generate_proxy_classes')) {
// Create document proxy directory
$proxyCacheDir = $container->getParameter('doctrine.odm.mongodb.proxy_dir');
if (!is_dir($proxyCacheDir)) {
if (false === @mkdir($proxyCacheDir, 0777, true)) {
exit(sprintf('Unable to create the Doctrine Proxy directory (%s)', dirname($proxyCacheDir)));
} elseif (!is_writable($proxyCacheDir)) {
exit(sprintf('Unable to write in the Doctrine Proxy directory (%s)', $proxyCacheDir));
Jump to Line
Something went wrong with that request. Please try again.