gollumsf/manager

为实体提供简单的管理抽象类服务

v0.1.0 2019-01-31 10:26 UTC

This package is auto-updated.

Last update: 2024-08-29 05:00:24 UTC


README

为实体提供简单的管理抽象类服务

安装

composer require gollumsf/manager

使用

通过自动装配注册服务。

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());
	}
	
}

显示

App\Entity\User

方法

 * 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[]