manage properties where they belong
[m6w6/pq-gateway] / lib / pq / Gateway / Cell.php
index 3c69a1294d015111db7629aee7234cb5e550dc45..ab2a46fceac95a3a97056fe78bdc4679c20ca2da 100644 (file)
@@ -11,11 +11,6 @@ class Cell extends Expressible implements \ArrayAccess
         */
        protected $row;
        
-       /**
-        * @var string
-        */
-       protected $name;
-       
        /**
         * @var bool
         */
@@ -28,9 +23,8 @@ class Cell extends Expressible implements \ArrayAccess
         * @param bool $dirty
         */
        function __construct(Row $row, $name, $data, $dirty = false) {
-               parent::__construct($data);
+               parent::__construct($name, $data);
                $this->row = $row;
-               $this->name = $name;
                $this->dirty = $dirty;
        }
        
@@ -68,6 +62,9 @@ class Cell extends Expressible implements \ArrayAccess
         * @return \pq\Gateway\Cell
         */
        function mod($data, $op = null) {
+               if (is_string($data)) {
+                       $data = $this->row->getTable()->getConnection()->quote($data);
+               }
                parent::mod($data, $op);
                $this->dirty = true;
                return $this;