src/Leevel/Database/Ddd/Entity.php
public function destroy(): IEntity
    {
        if (null === $this->primaryKey()) {
            $e = sprintf('Entity %s has no primary key.', static::class);

            throw new InvalidArgumentException($e);
        }

        $this->leevelFlushed = false;

        $this->leevelFlush = function ($condition) {
            $this->handleEvent(static::BEFORE_DELETE_EVENT, $condition);

            $num = $this->metaConnect()->delete($condition);

            $this->handleEvent(static::AFTER_DELETE_EVENT);

            return $num;
        };

        $this->leevelFlushData = [$this->idCondition()];

        return $this;
    }
public function destroy(): IEntity
    {
        if (null === $this->primaryKey()) {
            $e = sprintf('Entity %s has no primary key.', static::class);

            throw new InvalidArgumentException($e);
        }

        $this->leevelFlushed = false;

        $this->leevelFlush = function ($condition) {
            $this->handleEvent(static::BEFORE_DELETE_EVENT, $condition);

            $num = $this->metaConnect()->delete($condition);

            $this->handleEvent(static::AFTER_DELETE_EVENT);

            return $num;
        };

        $this->leevelFlushData = [$this->idCondition()];

        return $this;
    }
销毁模型实体.

@return $this