use standard SplObserver
[m6w6/pq-gateway] / lib / pq / Gateway / Row.php
index cda8d4af67a0ba857a6854b4f8c262f016f5e34d..78ec4c4e9c2d38e6ef82c118a07c3bf19eb6772f 100644 (file)
@@ -253,6 +253,7 @@ class Row implements \JsonSerializable
         * @return \pq\Gateway\Row
         */
        function create() {
+               $this->table->notify($this, "create");
                $rowset = $this->table->create($this->changes());
                if (!count($rowset)) {
                        throw new \UnexpectedValueException("No row created");
@@ -267,11 +268,9 @@ class Row implements \JsonSerializable
         * @return \pq\Gateway\Row
         */
        function update() {
-               $criteria = $this->criteria();
-               if (($lock = $this->getTable()->getLock())) {
-                       $lock->onUpdate($this, $criteria);
-               }
-               $rowset = $this->table->update($criteria, $this->changes());
+               $where = $this->criteria();
+               $this->table->notify($this, "update", $where);
+               $rowset = $this->table->update($where, $this->changes());
                if (!count($rowset)) {
                        throw new \UnexpectedValueException("No row updated");
                }
@@ -285,6 +284,7 @@ class Row implements \JsonSerializable
         * @return \pq\Gateway\Row
         */
        function delete() {
+               $this->table->notify($this, "delete");
                $rowset = $this->table->delete($this->criteria(), "*");
                if (!count($rowset)) {
                        throw new \UnexpectedValueException("No row deleted");