src/Leevel/Validate/UniqueRule.php
protected function parseEntity(array $parameter): IEntity
    {
        $connect = null;

        if (is_string($parameter[0])) {
            if (false !== strpos($parameter[0], self::SEPARATE)) {
                list($connect, $entityClass) = explode(self::SEPARATE, $parameter[0]);
            } else {
                $entityClass = $parameter[0];
            }

            if (!class_exists($entityClass)) {
                $e = sprintf('Validate entity `%s` was not found.', $entityClass);

                throw new InvalidArgumentException($e);
            }

            $entity = new $entityClass();
        } else {
            $entity = $parameter[0];
        }

        if (!($entity instanceof IEntity)) {
            $e = sprintf('Validate entity `%s` must be an entity.', get_class($entity));

            throw new InvalidArgumentException($e);
        }

        if ($connect) {
            $entity->withConnect($connect);
        }

        return $entity;
    }
protected function parseEntity(array $parameter): IEntity
    {
        $connect = null;

        if (is_string($parameter[0])) {
            if (false !== strpos($parameter[0], self::SEPARATE)) {
                list($connect, $entityClass) = explode(self::SEPARATE, $parameter[0]);
            } else {
                $entityClass = $parameter[0];
            }

            if (!class_exists($entityClass)) {
                $e = sprintf('Validate entity `%s` was not found.', $entityClass);

                throw new InvalidArgumentException($e);
            }

            $entity = new $entityClass();
        } else {
            $entity = $parameter[0];
        }

        if (!($entity instanceof IEntity)) {
            $e = sprintf('Validate entity `%s` must be an entity.', get_class($entity));

            throw new InvalidArgumentException($e);
        }

        if ($connect) {
            $entity->withConnect($connect);
        }

        return $entity;
    }
分析实体.

@param array $parameter*

@return \Leevel\Database\Ddd\IEntity