DDC-1124: Auto Generating proxy classes does not work #1406

Closed
opened 2026-01-22 13:13:23 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (Apr 25, 2011).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user dquintard:

I want to generate entity and proxy classes without command line.
Here is my php code:

$config = new \Doctrine\ORM\Configuration();
        $config->setMetadataDriverImpl($config->newDefaultAnnotationDriver('F:/zf1d2/Entities'));
        $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
        $config->setProxyDir('F:/zf1d2/Proxies');
        $config->setProxyNamespace('Proxies');
        $config->setAutoGenerateProxyClasses(true);

        $connectionParams = array(
            'dbname' => 'db_boo',
            'user' => 'root',
            'password' => '',
            'host' => 'localhost',
            'driver' => 'pdo_mysql',
        );

        $em = \Doctrine\ORM\EntityManager::create($connectionParams, $config);


        // custom datatypes (not mapped for reverse engineering)
        $em->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('set', 'string');
        $em->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
        $em->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('blob', 'string');

        // fetch metadata
        $driver = new \Doctrine\ORM\Mapping\Driver\DatabaseDriver(
            $em->getConnection()->getSchemaManager()
        );
        $em->getConfiguration()->setMetadataDriverImpl($driver);
        $cmf = new \Doctrine\ORM\Tools\DisconnectedClassMetadataFactory($em);
        $cmf->setEntityManager($em); 

        $classes = $driver->getAllClassNames();
        //print_r($classes);

        $metadata = $cmf->getAllMetadata(); 
        //print_r($metadata);
        $generator = new EntityGenerator();
        $generator->setUpdateEntityIfExists(true);
        $generator->setGenerateStubMethods(true);
        $generator->setGenerateAnnotations(true);
        $generator->generate($metadata, 'F:/zf1d2/Entities');

Entity classes are generated but proxy classes are not.

Best regards

David

Originally created by @doctrinebot on GitHub (Apr 25, 2011). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user dquintard: I want to generate entity and proxy classes without command line. Here is my php code: ``` $config = new \Doctrine\ORM\Configuration(); $config->setMetadataDriverImpl($config->newDefaultAnnotationDriver('F:/zf1d2/Entities')); $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache); $config->setProxyDir('F:/zf1d2/Proxies'); $config->setProxyNamespace('Proxies'); $config->setAutoGenerateProxyClasses(true); $connectionParams = array( 'dbname' => 'db_boo', 'user' => 'root', 'password' => '', 'host' => 'localhost', 'driver' => 'pdo_mysql', ); $em = \Doctrine\ORM\EntityManager::create($connectionParams, $config); // custom datatypes (not mapped for reverse engineering) $em->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('set', 'string'); $em->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); $em->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('blob', 'string'); // fetch metadata $driver = new \Doctrine\ORM\Mapping\Driver\DatabaseDriver( $em->getConnection()->getSchemaManager() ); $em->getConfiguration()->setMetadataDriverImpl($driver); $cmf = new \Doctrine\ORM\Tools\DisconnectedClassMetadataFactory($em); $cmf->setEntityManager($em); $classes = $driver->getAllClassNames(); //print_r($classes); $metadata = $cmf->getAllMetadata(); //print_r($metadata); $generator = new EntityGenerator(); $generator->setUpdateEntityIfExists(true); $generator->setGenerateStubMethods(true); $generator->setGenerateAnnotations(true); $generator->generate($metadata, 'F:/zf1d2/Entities'); ``` Entity classes are generated but proxy classes are not. Best regards David
admin added the Bug label 2026-01-22 13:13:23 +01:00
admin closed this issue 2026-01-22 13:13:24 +01:00
Author
Owner

@doctrinebot commented on GitHub (Apr 30, 2011):

Comment created by @beberlei:

Correct behavior, proxy classes are auto generated on demand. In your case there is no demand for them. Have a look at the ORM\Tools\Command subnamespace to see how the generate proxy task generates the proxies. However just for entity generation you dont need them.

@doctrinebot commented on GitHub (Apr 30, 2011): Comment created by @beberlei: Correct behavior, proxy classes are auto generated on demand. In your case there is no demand for them. Have a look at the ORM\Tools\Command subnamespace to see how the generate proxy task generates the proxies. However just for entity generation you dont need them.
Author
Owner

@doctrinebot commented on GitHub (Apr 30, 2011):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Apr 30, 2011): Issue was closed with resolution "Fixed"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#1406