Documentation

Class Phalcon\Mvc\Model\Query\Builder\Update

extends abstract class Phalcon\Mvc\Model\Query\Builder\Where

implements Phalcon\Events\EventsAwareInterface, Phalcon\Di\InjectionAwareInterface, Phalcon\Mvc\Model\Query\BuilderInterface

Source on GitHub

<?php

$resultset = Phalcon\Mvc\Model\Query\Builder::createUpdateBuilder()
   ->table('Robots')
   ->set(array('name' => 'Google'))
   ->getQuery()
   ->execute();

Methods

public __construct ([array $params])

Phalcon\Mvc\Model\Query\Builder\Update constructor

public Phalcon\Mvc\Model\Query\Builder\Update table (string $table)

Sets the table to update

public string getTable ()

Gets the table to update

public Phalcon\Mvc\Model\Query\Builder\Update set (array $set)

Sets the values to update with an associative array

<?php

$builder->set(array('id' => 1, 'name' => 'Google'));

public string|array getSet ()

Return the values to update with an associative array

public Phalcon\Mvc\Model\Query\Builder\Update setConflict (array $conflict)

Sets conflict

protected string _compile ()

Returns a PHQL statement built based on the builder parameters

public int setConditions (string|array $conditions, [array $bindParams], [array $bindTypes], [array $bindParams], [boolean $type]) inherited from Phalcon\Mvc\Model\Query\Builder\Where

Gets the type of PHQL queries

public string getConditions () inherited from Phalcon\Mvc\Model\Query\Builder\Where

Returns the conditions, If the conditions is a single numeric field. We internally create a condition using the related primary key

<?php

$builder->getConditions();

public Phalcon\Mvc\Model\Query\Builder where (string|array $conditions, [array $bindParams], [array $bindTypes]) inherited from Phalcon\Mvc\Model\Query\Builder\Where

Sets the query conditions

<?php

$builder->where('name = "Peter"');
$builder->where('name = :name: AND id > :id:', array('name' => 'Peter', 'id' => 100));

public Phalcon\Mvc\Model\Query\Builder andWhere (string|array $conditions, [array $bindParams], [array $bindTypes]) inherited from Phalcon\Mvc\Model\Query\Builder\Where

Appends a condition to the current conditions using a AND operator

<?php

$builder->andWhere('name = "Peter"');
$builder->andWhere('name = :name: AND id > :id:', array('name' => 'Peter', 'id' => 100));

public Phalcon\Mvc\Model\Query\Builder orWhere (string|array $conditions, [array $bindParams], [array $bindTypes]) inherited from Phalcon\Mvc\Model\Query\Builder\Where

Appends a condition to the current conditions using a OR operator

<?php

$builder->orWhere('name = "Peter"');
$builder->orWhere('name = :name: AND id > :id:', array('name' => 'Peter', 'id' => 100));

public Phalcon\Mvc\Model\Query\Builder betweenWhere (string $expr, mixed $minimum, mixed $maximum, [boolean $useOrWhere]) inherited from Phalcon\Mvc\Model\Query\Builder\Where

Appends a BETWEEN condition to the current conditions

<?php

$builder->betweenWhere('price', 100.25, 200.50);

public Phalcon\Mvc\Model\Query\Builder notBetweenWhere (string $expr, mixed $minimum, mixed $maximum, [boolean $useOrWhere]) inherited from Phalcon\Mvc\Model\Query\Builder\Where

Appends a NOT BETWEEN condition to the current conditions

<?php

$builder->notBetweenWhere('price', 100.25, 200.50);

public Phalcon\Mvc\Model\Query\Builder inWhere (string $expr, array $values, [boolean $useOrWhere]) inherited from Phalcon\Mvc\Model\Query\Builder\Where

Appends an IN condition to the current conditions

<?php

$builder->inWhere('id', [1, 2, 3]);

public Phalcon\Mvc\Model\Query\Builder notInWhere (string $expr, array $values, [boolean $useOrWhere]) inherited from Phalcon\Mvc\Model\Query\Builder\Where

Appends a NOT IN condition to the current conditions

<?php

$builder->notInWhere('id', [1, 2, 3]);

public string|array getWhere () inherited from Phalcon\Mvc\Model\Query\Builder\Where

Return the conditions for the query

public static Phalcon\Mvc\Model\Query\Builder create (unknown $type) inherited from Phalcon\Mvc\Model\Query\Builder

Create a new Query Builder of the given type.

<?php

Phalcon\Mvc\Model\Query\Builder::create(Phalcon\Mvc\Model\Query::TYPE_SELECT);

public static Phalcon\Mvc\Model\Query\Builder\Select createSelectBuilder ([array $params], [Phalcon\DiInterface $dependencyInjector]) inherited from Phalcon\Mvc\Model\Query\Builder

Create a new Query Builder for Select

public static Phalcon\Mvc\Model\Query\Builder\Insert createInsertBuilder ([array $params], [Phalcon\DiInterface $dependencyInjector]) inherited from Phalcon\Mvc\Model\Query\Builder

Create a new Query Builder for Insert

public static Phalcon\Mvc\Model\Query\Builder\Update createUpdateBuilder ([array $params], [Phalcon\DiInterface $dependencyInjector]) inherited from Phalcon\Mvc\Model\Query\Builder

Create a new Query Builder for Update

public static Phalcon\Mvc\Model\Query\Builder\Delete createDeleteBuilder ([array $params], [Phalcon\DiInterface $dependencyInjector]) inherited from Phalcon\Mvc\Model\Query\Builder

Create a new Query Builder for Delete

public int getType () inherited from Phalcon\Mvc\Model\Query\Builder

Gets the type of PHQL queries

public Phalcon\Mvc\Model\Query\Builder setBindParams (array $bindparams, [unknown $merge]) inherited from Phalcon\Mvc\Model\Query\Builder

Sets the bind parameters

public Phalcon\Mvc\Model\Query\Builder getBindParams () inherited from Phalcon\Mvc\Model\Query\Builder

Gets the bind parameters

public Phalcon\Mvc\Model\Query\Builder getMergeBindParams () inherited from Phalcon\Mvc\Model\Query\Builder

Gets the merge bind parameters

public Phalcon\Mvc\Model\Query\Builder setBindTypes (array $bindtypes, [unknown $merge]) inherited from Phalcon\Mvc\Model\Query\Builder

Sets the bind types

public Phalcon\Mvc\Model\Query\Builder getBindTypes () inherited from Phalcon\Mvc\Model\Query\Builder

Gets the bind types

public Phalcon\Mvc\Model\Query\Builder getMergeBindTypes () inherited from Phalcon\Mvc\Model\Query\Builder

Gets the merge bind types

public Phalcon\Mvc\Model\Query\Builder setIndex (string $index) inherited from Phalcon\Mvc\Model\Query\Builder

Adds the index

public string getIndex () inherited from Phalcon\Mvc\Model\Query\Builder

Gets the index

public Phalcon\Mvc\Model\Query\Builder compile () inherited from Phalcon\Mvc\Model\Query\Builder

Compile the PHQL query

public string getPhql () inherited from Phalcon\Mvc\Model\Query\Builder

Returns a PHQL statement built based on the builder parameters

public Phalcon\Mvc\Model\Query getQuery () inherited from Phalcon\Mvc\Model\Query\Builder

Returns the query built

public setDI (Phalcon\DiInterface $dependencyInjector) inherited from Phalcon\Di\Injectable

Sets the dependency injector

public Phalcon\DiInterface getDI ([unknown $error], [unknown $notUseDefault]) inherited from Phalcon\Di\Injectable

Returns the internal dependency injector

public setEventsManager (Phalcon\Events\ManagerInterface $eventsManager) inherited from Phalcon\Di\Injectable

Sets the event manager

public Phalcon\Events\ManagerInterface getEventsManager () inherited from Phalcon\Di\Injectable

Returns the internal event manager

public boolean fireEvent (string $eventName, [mixed $data], [unknown $cancelable]) inherited from Phalcon\Di\Injectable

Fires an event, implicitly calls behaviors and listeners in the events manager are notified

public mixed fireEventCancel (string $eventName, [mixed $data], [unknown $cancelable]) inherited from Phalcon\Di\Injectable

Fires an event, can stop the event by returning to the false

public boolean hasService (string $name) inherited from Phalcon\Di\Injectable

Check whether the DI contains a service by a name

public Phalcon\Di\ServiceInterface setService (unknown $name) inherited from Phalcon\Di\Injectable

Sets a service from the DI

public object|null getService (unknown $name) inherited from Phalcon\Di\Injectable

Obtains a service from the DI

public mixed getResolveService (string $name, [array $args], [unknown $noerror], [unknown $noshared]) inherited from Phalcon\Di\Injectable

Resolves the service based on its configuration

public attachEvent (string $eventType, Closure $callback) inherited from Phalcon\Di\Injectable

Attach a listener to the events

public __get (unknown $property) inherited from Phalcon\Di\Injectable

Magic method __get

public __sleep () inherited from Phalcon\Di\Injectable

...

public __debugInfo () inherited from Phalcon\Di\Injectable

...