Artificial intelligent assistant

Symfonyで自作クラス内からDoctrineを呼ぶ方法 DoctrineDI Doctrine Acme/AppBundle/BuilderSubscriberDirector.phpSubscriberBuilder.phpController $builder = new SubscriberBuilder(); $director = new SubscriberDirector($builder); $subscriber = $director->getSubscriber(); Builder SubscriberBuilderSubscriberDB Servicescope: prototypeSubscriberBuilderSubscriberDirectorDoctrineDI subscriber_builder: class: Acme\AppBundle\Builder\Subscriber\SubscriberBuilder scope: prototype arguments: [@doctrine] Controller $builder = $this->get('subscriber_builder'); $director = $this->get('subscriber_director'); $director->initialize($builder); $subscriber = $director->getSubscriber(); Service

PHPOOPSymfony

SymfonyDoctrineEntityManagerDependencyInjectionDIPOOP

##

`@doctrine` `Doctrine\Bundle\DoctrineBundle\Registry` EntityManagerRepository


$em = $doctrine->getManagerForClass(get_class($entity));
$repository = $em->getRepository(get_class($entity));
$entityList = $repository->findBy


EntityManagerRepository `@doctrine`

Repository

* Doctrine Repository



## scope

`scope` `container` `prototype` `prototype`

* How to Work with Scopes (The Symfony CookBook)

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy e1bbc4c7806baec1fc3ef5b947442dc8