Example #1
0
 /**
  * Add a clause to set all properties to be updated on the wished variable
  *
  * @param Str $variable
  * @param CollectionInterface $changeset
  * @param Query $query
  *
  * @return Query
  */
 private function update(Str $variable, CollectionInterface $changeset, Query $query) : Query
 {
     return $query->set(sprintf('%s += {%s_props}', $variable, $variable))->withParameter((string) $variable->append('_props'), $changeset->toPrimitive());
 }
Example #2
0
 public function testUpdateStatement_AddSet_Replace()
 {
     $query = new Query("UPDATE `test` SET description='abc', type_id=10 WHERE xyz=10");
     $query->set("abc=12", null, Query::REPLACE);
     $this->assertEquals("UPDATE `test` SET `abc`=12 WHERE xyz=10", (string) $query);
 }