src/Leevel/Database/Ddd/Select.php
public function findOrFail(int $id, array $column = ['*']): IEntity
    {
        $result = $this->find($id, $column);

        if (null !== $result->__get($this->entity->singlePrimaryKey())) {
            return $result;
        }

        throw (new EntityNotFoundException())
            ->setEntity(get_class($this->entity));
    }
public function findOrFail(int $id, array $column = ['*']): IEntity
    {
        $result = $this->find($id, $column);

        if (null !== $result->__get($this->entity->singlePrimaryKey())) {
            return $result;
        }

        throw (new EntityNotFoundException())
            ->setEntity(get_class($this->entity));
    }
通过主键查找模型实体，未找到则抛出异常.

@param int   $id
@param array $column

@return \Leevel\Database\Ddd\IEntity