src/Titon/Db/Query.php
public function data($data) {
        if ($data instanceof Arrayable) {
            $data = $data->toArray();

        } else if (!is_array($data)) {
            throw new InvalidArgumentException('Data passed must be an array or extend the Titon\Type\Contract\Arrayable interface');
        }

        $type = $this->getType();

        // Only set binds for queries with dynamic data
        if (in_array($type, [self::INSERT, self::UPDATE, self::MULTI_INSERT], true)) {
            $binds = [];
            $rows = $data;

            if ($type !== self::MULTI_INSERT) {
                $rows = [$rows];
            }

            foreach ($rows as $row) {
                foreach ($row as $field => $value) {
                    $binds[] = [
                        'field' => $field,
                        'value' => $value
                    ];
                }
            }

            $this->setBindings($binds);
        }

        $this->_data = $data;

        return $this;
    }
public function data($data) {
        if ($data instanceof Arrayable) {
            $data = $data->toArray();

        } else if (!is_array($data)) {
            throw new InvalidArgumentException('Data passed must be an array or extend the Titon\Type\Contract\Arrayable interface');
        }

        $type = $this->getType();

        // Only set binds for queries with dynamic data
        if (in_array($type, [self::INSERT, self::UPDATE, self::MULTI_INSERT], true)) {
            $binds = [];
            $rows = $data;

            if ($type !== self::MULTI_INSERT) {
                $rows = [$rows];
            }

            foreach ($rows as $row) {
                foreach ($row as $field => $value) {
                    $binds[] = [
                        'field' => $field,
                        'value' => $value
                    ];
                }
            }

            $this->setBindings($binds);
        }

        $this->_data = $data;

        return $this;
    }
public function data ( $ data ) { if ( $ data instanceof Arrayable ) { $ data = $ data -> toArray ( ) ; } else if ( ! is_array ( $ data ) ) { throw new InvalidArgumentException ( 'Data passed must be an array or extend the Titon\Type\Contract\Arrayable interface' ) ; } $ type = $ this -> getType ( ) ; // Only set binds for queries with dynamic data if ( in_array ( $ type , [ self :: INSERT , self :: UPDATE , self :: MULTI_INSERT ] , true ) ) { $ binds = [ ] ; $ rows = $ data ; if ( $ type !== self :: MULTI_INSERT ) { $ rows = [ $ rows ] ; } foreach ( $ rows as $ row ) { foreach ( $ row as $ field => $ value ) { $ binds [ ] = [ 'field' => $ field , 'value' => $ value ] ; } } $ this -> setBindings ( $ binds ) ; } $ this -> _data = $ data ; return $ this ; }
Set the data to use in an update, insert, or create index statement.
We should also extract data to later bind during a prepared statement.

@param array|\Titon\Type\Contract\Arrayable $data
@return $this
@throws \Titon\Db\Exception\InvalidArgumentException
Set the data to use in an update insert or create index statement . We should also extract data to later bind during a prepared statement .