PHP code example of grossum / custom-entity-manager

1. Go to this page and download the library: Download grossum/custom-entity-manager 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/ */

    

grossum / custom-entity-manager example snippets



// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new Grossum\CustomEntityManagerBundle\GrossumCustomEntityManagerBundle(),
        );

        // ...
    }

    // ...
}


// ...
/** @var EntityManagerLoader $entityManagerLoader */
private $entityManagerLoader;

// ...
public function __construct(
    EntityManagerLoader $entityManagerLoader,
    // ...
) {
    $this->entityManagerLoader = $entityManagerLoader;
    // ...
}
// ...

/**
* param string $className
* return ManagedClassNameInterface
*/
public function getEntityManagerByClassName($className)
{
    return $this->entityManagerLoader->getManagerForClass($className);
}
// ...