5 use \pq\Query\Expressible
;
7 class Cell
extends Expressible
implements \ArrayAccess
10 * @var \pq\Gateway\Row
25 * @param \pq\Gateway\Row $row
30 function __construct(Row
$row, $name, $data, $dirty = false) {
31 parent
::__construct($data);
34 $this->dirty
= $dirty;
38 * Check whether the cell has been modified
42 return (bool) $this->dirty
;
48 * @return \pq\Gateway\Cell
51 if ($data instanceof Row
) {
52 $this->row
->__set($data->getTable()->getName() . "_id", $data->id
);
53 $this->row
->__unset($this->name
);
56 if ($data instanceof Cell
) {
65 * Modify the value in this cell
67 * @param string $op a specific operator
68 * @return \pq\Gateway\Cell
70 function mod($data, $op = null) {
71 parent
::mod($data, $op);
76 function offsetGet($o) {
77 if (isset($this->data
) && !is_array($this->data
)) {
78 throw new \
UnexpectedValueException("Cell data is not an array");
80 return $this->data
[$o];
83 function offsetSet($o, $v) {
84 if (isset($this->data
) && !is_array($this->data
)) {
85 throw new \
UnexpectedValueException("Cell data is not an array");
95 function offsetExists($o) {
96 if (isset($this->data
) && !is_array($this->data
)) {
97 throw new \
UnexpectedValueException("Cell data is not an array");
99 return isset($this->data
[$o]);
102 function offsetUnset($o) {
103 if (isset($this->data
) && !is_array($this->data
)) {
104 throw new \
UnexpectedValueException("Cell data is not an array");
106 unset($this->data
[$o]);