src/Leevel/Database/Ddd/SpecificationExpression.php
public function and(ISpecification $spec): ISpecification
    {
        $old = $this->spec;
        $oldHandle = $this->handle;

        $this->spec = function (IEntity $entity) use ($old, $spec): bool {
            return $old($entity) && $spec->isSatisfiedBy($entity);
        };

        $this->handle = function (Select $select, IEntity $entity) use ($spec, $oldHandle) {
            $oldHandle($select, $entity);
            $spec->handle($select, $entity);
        };

        return $this;
    }
public function and(ISpecification $spec): ISpecification
    {
        $old = $this->spec;
        $oldHandle = $this->handle;

        $this->spec = function (IEntity $entity) use ($old, $spec): bool {
            return $old($entity) && $spec->isSatisfiedBy($entity);
        };

        $this->handle = function (Select $select, IEntity $entity) use ($spec, $oldHandle) {
            $oldHandle($select, $entity);
            $spec->handle($select, $entity);
        };

        return $this;
    }
规约 And 操作.

@param \Leevel\Database\Ddd\ISpecification $spec

@return \Leevel\Database\Ddd\ISpecification