}
/**
- * Export current state with security sensitive data removed. You should override that, just
- * calls export() by default.
+ * Export current state with security sensitive data removed. You should override that.
+ * Just calls export() by default.
* @return array
*/
function exportPublic() {
$where["$col IS"] = new QueryExpr("NULL");
}
}
-
- if (($lock = $this->getTable()->getLock())) {
- $lock->criteria($this, $where);
- }
return $where;
}
return $changes;
}
+ /**
+ * Cell accessor
+ * @param string $p column name
+ * @return \pq\Gateway\Cell
+ */
+ protected function cell($p) {
+ if (!isset($this->cell[$p])) {
+ $this->cell[$p] = new Cell($this, $p, isset($this->data[$p]) ? $this->data[$p] : null);
+ }
+ return $this->cell[$p];
+ }
+
/**
* Get a cell or parent rows
* @param string $p
if ($this->table->hasRelation($p)) {
return $this->table->by($this, $p);
}
- if (!isset($this->cell[$p])) {
- $this->cell[$p] = new Cell($this, $p, isset($this->data[$p]) ? $this->data[$p] : null);
- }
- return $this->cell[$p];
+ return $this->cell($p);
}
/**
* @param mixed $v
*/
function __set($p, $v) {
- $this->__get($p)->set($v);
+ $this->cell($p)->set($v);
}
/**
* @return \pq\Gateway\Row
*/
function update() {
- $rowset = $this->table->update($this->criteria(), $this->changes());
+ $criteria = $this->criteria();
+ if (($lock = $this->getTable()->getLock())) {
+ $lock->onUpdate($this, $criteria);
+ }
+ $rowset = $this->table->update($criteria, $this->changes());
if (!count($rowset)) {
throw new \UnexpectedValueException("No row updated");
}