public function cleanUser(string $validate = null): int
    {
        $result = 0;
        if ($validate) {
            $validateTo = new DateTime;
            $validateTo->modify($validate);

            /** @noinspection PhpUndefinedMethodInspection */
            $list = $this->getList()
                ->where([
                    $this->tableName[0] . '.active' => false,
                    $this->tableName[0] . '.added IS NOT NULL',
                    [$this->tableName[0] . '.added<=%dt', $validateTo],
                ]);

            foreach ($list as $item) {
                if ($this->delete($item[self::COLUMN_ID])) {
                    $result++;
                }
            }
        }
        return $result;
    }
public function cleanUser(string $validate = null): int
    {
        $result = 0;
        if ($validate) {
            $validateTo = new DateTime;
            $validateTo->modify($validate);

            /** @noinspection PhpUndefinedMethodInspection */
            $list = $this->getList()
                ->where([
                    $this->tableName[0] . '.active' => false,
                    $this->tableName[0] . '.added IS NOT NULL',
                    [$this->tableName[0] . '.added<=%dt', $validateTo],
                ]);

            foreach ($list as $item) {
                if ($this->delete($item[self::COLUMN_ID])) {
                    $result++;
                }
            }
        }
        return $result;
    }
public function cleanUser ( string $ validate = null ) : int { $ result = 0 ; if ( $ validate ) { $ validateTo = new DateTime ; $ validateTo -> modify ( $ validate ) ; /** @noinspection PhpUndefinedMethodInspection */ $ list = $ this -> getList ( ) -> where ( [ $ this -> tableName [ 0 ] . '.active' => false , $ this -> tableName [ 0 ] . '.added IS NOT NULL' , [ $ this -> tableName [ 0 ] . '.added<=%dt' , $ validateTo ] , ] ) ; foreach ( $ list as $ item ) { if ( $ this -> delete ( $ item [ self :: COLUMN_ID ] ) ) { $ result ++ ; } } } return $ result ; }
Clean user.

@param string|null $validate
@return int
@throws \Dibi\Exception
@throws \Exception
Clean user .