Doctrine\DBAL\Query\QueryBuilder::update PHP Method

update() public method

$qb = $conn->createQueryBuilder() ->update('users', 'u') ->set('u.password', md5('password')) ->where('u.id = ?');
public update ( string $update = null, string $alias = null )
$update string The table whose rows are subject to the update.
$alias string The table alias used in the constructed query.
    public function update($update = null, $alias = null)
    {
        $this->type = self::UPDATE;
        if (!$update) {
            return $this;
        }
        return $this->add('from', array('table' => $update, 'alias' => $alias));
    }

Usage Example

 public function testEmptyUpdate()
 {
     $qb = new QueryBuilder($this->conn);
     $qb2 = $qb->update();
     $this->assertEquals(QueryBuilder::UPDATE, $qb->getType());
     $this->assertSame($qb2, $qb);
 }
All Usage Examples Of Doctrine\DBAL\Query\QueryBuilder::update