offset = $offset; if(is_null($limit)) { $limit = -1; } $this->limit = $limit; $this->filter(); } protected function filter() { $table = $this->table; $rowsCount = $table->getRowsCount(); // we delete from 0 to offset if($this->offset > 0) { $table->deleteRowsOffset( 0, $this->offset ); } // at this point the array has offset less elements. We delete from limit to the end if( $this->limit >= 0 ) { $table->deleteRowsOffset( $this->limit ); } } }