PHP code example of olvlvl / doctrine-generators

1. Go to this page and download the library: Download olvlvl/doctrine-generators library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

olvlvl / doctrine-generators example snippets




use Doctrine\ODM\MongoDB\Configuration;
use olvlvl\DoctrineGenerators\Document\HydratorGenerator;
use olvlvl\DoctrineGenerators\Document\ProxyGenerator;

/* @var string $cacheDir */

// An excerpt of the configuration used to create the document manager
$config = new Configuration();
$config->setProxyDir("$cacheDir/Proxies");
$config->setProxyNamespace('Proxies');
$config->setAutoGenerateProxyClasses(Configuration::AUTOGENERATE_NEVER);
$config->setHydratorDir("$cacheDir/Hydrators");
$config->setHydratorNamespace('Hydrators');
$config->setAutoGenerateHydratorClasses(Configuration::AUTOGENERATE_NEVER);

/* @var \Doctrine\ODM\MongoDB\DocumentManager $dm */

$classes = (new HydratorGenerator)($dm);
$classes = (new ProxyGenerator)($dm);