+ /**
+ * @return array
+ */
+ function getData() {
+ return $this->data;
+ }
+
+ /**
+ * Check whether the row contains modifications
+ * @return boolean
+ */
+ function isDirty() {
+ foreach ($this->cell as $cell) {
+ if ($cell->isDirty()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ function refresh() {
+ $this->data = $this->table->find($this->criteria(), null, 1, 0)->current()->data;
+ $this->cell = array();
+ return $this;
+ }
+
+ /**
+ * Fill modified cells
+ * @return \pq\Gateway\Row
+ */
+ protected function prime() {
+ $this->cell = array();
+ foreach ($this->data as $key => $val) {
+ $this->cell[$key] = new Cell($this, $key, $val, true);
+ }
+ return $this;
+ }
+
+ /**
+ * Transform data array to where criteria
+ * @return array
+ */
+ protected function criteria() {
+ $where = array();
+ foreach($this->data as $k => $v) {
+ $where["$k="] = $v;
+ }
+ return $where;
+ }
+
+ /**
+ * Get an array of changed properties
+ * @return array
+ */
+ protected function changes() {
+ $changes = array();
+ foreach ($this->cell as $name => $cell) {
+ if ($cell->isDirty()) {
+ $changes[$name] = $cell->get();
+ }
+ }
+ return $changes;
+ }
+
+ /**
+ * Get a cell
+ * @param string $p
+ * @return \pq\Gateway\Cell
+ */