X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=lib%2Fpq%2FGateway%2FCell.php;h=efa5fcbb3cd1154ecd99321bdddaf9e093a7a5c2;hb=b5e596ceb0d6f8e26ce2c98f2b185c03ba4449da;hp=1955552c3858508672746b4f252e2c33fd3c3a7f;hpb=caa2499169b61c7dc6254886e73dcfc000737ed6;p=m6w6%2Fpq-gateway diff --git a/lib/pq/Gateway/Cell.php b/lib/pq/Gateway/Cell.php index 1955552..efa5fcb 100644 --- a/lib/pq/Gateway/Cell.php +++ b/lib/pq/Gateway/Cell.php @@ -2,6 +2,67 @@ namespace pq\Gateway; -class Cell +use \pq\Query\Expressible; + +class Cell extends Expressible { + /** + * @var \pq\Gateway\Row + */ + protected $row; + + /** + * @var string + */ + protected $name; + + /** + * @var bool + */ + protected $dirty; + + /** + * @param \pq\Gateway\Row $row + * @param string $name + * @param mixed $data + * @param bool $dirty + */ + function __construct(Row $row, $name, $data, $dirty = false) { + parent::__construct($data); + $this->row = $row; + $this->name = $name; + $this->dirty = $dirty; + } + + /** + * Check whether the cell has been modified + * @return bool + */ + function isDirty() { + return $this->dirty; + } + + /** + * Set the value + * @param mixed $data + * @return \pq\Gateway\Cell + */ + function set($data) { + parent::set($data); + $this->dirty = true; + return $this; + } + + /** + * Modify the value in this cell + * @param mixed $data + * @param string $op a specific operator + * @return \pq\Gateway\Cell + */ + function mod($data, $op = null) { + parent::mod($data, $op); + $this->dirty = true; + return $this; + } + }