public function testShouldCreateSqlUpdateStatementWithParameters()
 {
     $table = "test";
     $value = StringUtils::generateRandomAlphaNumeric(10);
     $update = new UpdateStatement($table);
     $update->addParameter("content", $value);
     $update->where(Restrictions::eq("id", ':id'));
     $update->addParameter(":id", 1001, true);
     $sql = $update->toSql();
     $this->assertThat(trim($sql), $this->equalTo("UPDATE {$table} SET content=:content WHERE (id = :id)"));
     $this->assertThat($update->hasParameters(), $this->isTrue());
     $parameters = $update->getParameters();
     $this->assertThat(array_shift($parameters), $this->equalTo($value));
     $this->assertThat(array_pop($parameters), $this->equalTo(1001));
 }
 public function update(ModelInterface $model)
 {
     $statement = new UpdateStatement($model->table());
     $statement->setParameters($model->extract())->where(Restrictions::eq("id", ":id"))->addExpressionParameter("id", $model->id());
     $this->getDatabase()->execute($statement);
 }