src/Leevel/Database/Ddd/UnitOfWork.php
public function repository($entity): IRepository
    {
        if (is_string($entity)) {
            $entity = new $entity();
        }

        if (defined(get_class($entity).'::REPOSITORY')) {
            $name = $entity::REPOSITORY;
            $repository = new $name($entity);
        } else {
            $repository = new Repository($entity);
        }

        return $repository;
    }
public function repository($entity): IRepository
    {
        if (is_string($entity)) {
            $entity = new $entity();
        }

        if (defined(get_class($entity).'::REPOSITORY')) {
            $name = $entity::REPOSITORY;
            $repository = new $name($entity);
        } else {
            $repository = new Repository($entity);
        }

        return $repository;
    }
取得实体仓储.

@param \Leevel\Database\Ddd\IEntity|string $entity

@return \Leevel\Database\Ddd\IRepository