flush
[m6w6/pq-gateway] / lib / pq / Gateway / Cell.php
index efa5fcbb3cd1154ecd99321bdddaf9e093a7a5c2..33f94c8fe609a47aa204027d0fbe13e3a13b5be1 100644 (file)
@@ -48,6 +48,14 @@ class Cell extends Expressible
         * @return \pq\Gateway\Cell
         */
        function set($data) {
+               if ($data instanceof Row) {
+                       $this->row->__set($data->getTable()->getName() . "_id", $data->id);
+                       $this->row->__unset($this->name);
+                       return $this;
+               }
+               if ($data instanceof Cell) {
+                       $data = $data->get();
+               }
                parent::set($data);
                $this->dirty = true;
                return $this;