public function update($data, $predicate, $combination = Predicate\PredicateSet::OP_AND, $validate_datatypes = false)
    {
        $prefixed_table = $this->prefixed_table;

        if ($data instanceof ArrayObject) {
            $d = (array) $data;
        } elseif (is_array($data)) {
            $d = $data;
        } else {
            throw new Exception\InvalidArgumentException(__METHOD__ . ": requires data to be array or an ArrayObject");
        }

        $this->checkDataColumns($d);

        if ($validate_datatypes) {
            $this->validateDatatypes($d);
        }

        $update = $this->sql->update($prefixed_table);
        $update->set($d);
        $update->where($predicate, $combination);

        $result = $this->executeStatement($update);

        return  $result->getAffectedRows();
    }
public function update($data, $predicate, $combination = Predicate\PredicateSet::OP_AND, $validate_datatypes = false)
    {
        $prefixed_table = $this->prefixed_table;

        if ($data instanceof ArrayObject) {
            $d = (array) $data;
        } elseif (is_array($data)) {
            $d = $data;
        } else {
            throw new Exception\InvalidArgumentException(__METHOD__ . ": requires data to be array or an ArrayObject");
        }

        $this->checkDataColumns($d);

        if ($validate_datatypes) {
            $this->validateDatatypes($d);
        }

        $update = $this->sql->update($prefixed_table);
        $update->set($d);
        $update->where($predicate, $combination);

        $result = $this->executeStatement($update);

        return  $result->getAffectedRows();
    }
public function update ( $ data , $ predicate , $ combination = Predicate \ PredicateSet :: OP_AND , $ validate_datatypes = false ) { $ prefixed_table = $ this -> prefixed_table ; if ( $ data instanceof ArrayObject ) { $ d = ( array ) $ data ; } elseif ( is_array ( $ data ) ) { $ d = $ data ; } else { throw new Exception \ InvalidArgumentException ( __METHOD__ . ": requires data to be array or an ArrayObject" ) ; } $ this -> checkDataColumns ( $ d ) ; if ( $ validate_datatypes ) { $ this -> validateDatatypes ( $ d ) ; } $ update = $ this -> sql -> update ( $ prefixed_table ) ; $ update -> set ( $ d ) ; $ update -> where ( $ predicate , $ combination ) ; $ result = $ this -> executeStatement ( $ update ) ; return $ result -> getAffectedRows ( ) ; }
Update data into table

@param array|ArrayObject $data
@param  Where|\Closure|string|array|Predicate\PredicateInterface $predicate
@param  string $combination One of the OP_* constants from Predicate\PredicateSet
@param  boolean $validate_datatypes ensure all datatype are compatible with column definition

@throws Exception\InvalidArgumentException
@throws Exception\ColumnNotFoundException when $data contains columns that does not exists in table
@throws Exception\ForeignKeyException when insertion failed because of an invalid foreign key
@throws Exception\DuplicateEntryException when insertion failed because of an invalid foreign key
@throws Exception\NotNullException when insertion failed because a column cannot be null
@throws Exception\RuntimeException when insertion failed for another reason

@return int number of affected rows
Update data into table