gollumsf / manager
Simple manager abstract class service for entity
v0.1.0
2019-01-31 10:26 UTC
Requires
- php: >=7.0
- symfony/framework-bundle: 4.*
This package is auto-updated.
Last update: 2024-10-29 05:22:51 UTC
README
Simple manager abstract class service for entity
Installation:
composer require gollumsf/manager
Usage:
Register service by autowire.
namespace App\Manager; use GolumSF\Manager\Manager; class UserManager extends Manager { }
namespace App\Controler; use App\Manager\UserManager; class MyControler { myAction(UserManager $userManager) { return Response($userManager->getEntityClass()); } }
Display:
App\Entity\User
Methods:
* public getEntityClass(): string // Return class name fo entity * protected getEntityManager(): string // Return entity manager * public getRepository(): ?ObjectRepository // Return repository of entity * public delete($entity): Entity // Delete the doctrine entity * public update($entity): Entity // Persist and flush the entity * public find($id): Entity|null // Return the entity of id (wrapper of repository->find) * public findOneBy(array $criteria): Entity|null // Return the entity of criteria (wrapper of repository->findOneBy) * public findBy( // Return the entities of criteria (wrapper of repository->findBy) array $criteria, array $orderBy = null, $limit = null, $offset = null ): Entity[]