Permalink
Browse files

MultiResult::insert_update (closes #22)

  • Loading branch information...
vrana committed Sep 17, 2011
1 parent c9cf6e6 commit 3431a24ff26e5075ebb30e6ac5a1f3404dc47dfe
Showing with 8 additions and 0 deletions.
  1. +5 −0 NotORM/MultiResult.php
  2. +3 −0 tests/22-insert-update.phpt
View
@@ -36,6 +36,11 @@ function insert($data) {
return call_user_func_array(array($this, 'parent::insert'), $args); // works since PHP 5.1.2, array('parent', 'insert') issues E_STRICT in 5.1.2 <= PHP < 5.3.0
}
+ function insert_update(array $unique, array $insert, array $update = array()) {
+ $unique[$this->column] = $this->active;
+ return parent::insert_update($unique, $insert, $update);
+ }
+
protected function single() {
$this->where[0] = "$this->column = " . $this->quote($this->active);
}
@@ -7,8 +7,11 @@ include_once dirname(__FILE__) . "/connect.inc.php";
for ($i=0; $i < 2; $i++) {
echo $software->application()->insert_update(array("id" => 5), array("author_id" => 12, "title" => "Texy", "web" => "", "slogan" => "$i")) . "\n";
}
+$application = $software->application[5];
+echo $application->application_tag()->insert_update(array("tag_id" => 21), array()) . "\n";
$software->application("id", 5)->delete();
?>
--EXPECTF--
1
2
+1

0 comments on commit 3431a24

Please sign in to comment.