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

set() public method

$qb = $conn->createQueryBuilder() ->update('users', 'u') ->set('u.password', md5('password')) ->where('u.id = ?');
public set ( string $key, string $value )
$key string The column to set.
$value string The value, expression, placeholder, etc.
    public function set($key, $value)
    {
        return $this->add('set', $key . ' = ' . $value, true);
    }

Usage Example

 /**
  * @test
  */
 public function setWithoutNamedParameterQuotesIdentifierAndDelegatesToConcreteQueryBuilder()
 {
     $this->connection->quoteIdentifier('aField')->shouldBeCalled()->willReturnArgument(0);
     $this->concreteQueryBuilder->createNamedParameter(Argument::cetera())->shouldNotBeCalled();
     $this->concreteQueryBuilder->set('aField', 'aValue')->shouldBeCalled()->willReturn($this->subject);
     $this->subject->set('aField', 'aValue', false);
 }
All Usage Examples Of Doctrine\DBAL\Query\QueryBuilder::set