Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Entity Manager Generator Bundle Laravel Package

activpik/entity-manager-generator-bundle

Symfony2 bundle that generates basic Doctrine Entity Manager classes for your entities and registers them as services (services.xml). Adds save() and getRepository() helpers. Use doctrine:generate:entitymanager Bundle:Entity, then fetch via service id.

View on GitHub
Deep Wiki
Context7

EntityManagerGeneratorBundle

Build Status

Entity Manager Generator for Symfony 2

Works only with bundles with a services.xml config file. Next release will support the other format.

Installation :

Add this line on your composer.json require

        "activpik/entity-manager-generator-bundle": "dev-master"

Update your deps with composer

	php composer.phar update

Update your AppKernel File :

$bundles = array(
...
new Activpik\EntityManagerGeneratorBundle\ActivpikEntityManagerGeneratorBundle(),
...
);

Usage

php app/console doctrine:generate:entitymanager ActivpikManagerBundle:Video

This command generates an VideoManager class in the same directory of your Video Entity.

Calling the entity manager in a controller :

$this->get("activpik_manager.video_manager");

Get the Doctrine Entity Repository

$this->get("activpik_manager.video_manager")->getRepository();

What is generated by this tool : A Basic Entity Manager in the Entity Directory

For our previous sample the result is : In src/Activpik/ManagerBundle/Entity/VideoManager.php

<?php

namespace Activpik\ManagerBundle\Entity;

use Doctrine\ORM\EntityManager;

class VideoManager {

	protected $em;

	public function __construct(EntityManager $em) {

		$this->em = $em;
	}



	public function save(Video $entity){

		$this->em->persist($entity);
		$this->em->flush();
	}



	public function getRepository(){
		return $this->em->getRepository('ActivpikManagerBundle:Video');
	}

}

In service.xml we add theses line

<parameters>
...
<parameter key="activpik_manager.video_manager.class">Activpik\ManagerBundle\Entity\VideoManager</parameter>
...
</parameters>

<services>
...
	<service id="activpik_manager.video_manager" class="%activpik_manager.video_manager.class%"><argument type="service" id="doctrine.orm.entity_manager"/></service>
...
</services>
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
make-dev/orca
dmstr/symfony-system-resources-bundle
dmstr/symfony-job-queue-bundle
dmstr/openapi-json-schema-bundle
dmstr/keycloak-security-bundle
dmstr/doctrine-audit-log-bundle
dmstr/api-platform-utils-bundle
dmstr/api-configuration-bundle
chrisdev/ux-components
baks-dev/finances
emuniq/filament-browser-notifications
syriable/filament-translator
hungnm28/livewire-form
wenprise/eloquent
crudly/encrypted
fadion/bouncy
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle