SoftDelete\Model\Table\SoftDeleteTrait::hardDeleteAll PHP Method

hardDeleteAll() public method

Hard deletes all records that were soft deleted before a given date.
public hardDeleteAll ( Datetime $until ) : integer
$until Datetime Date until which soft deleted records must be hard deleted.
return integer number of affected rows.
    public function hardDeleteAll(\Datetime $until)
    {
        $query = $this->query()->delete()->where([$this->getSoftDeleteField() . ' IS NOT NULL', $this->getSoftDeleteField() . ' <=' => $until->format('Y-m-d H:i:s')]);
        $statement = $query->execute();
        $statement->closeCursor();
        return $statement->rowCount();
    }