3 namespace pq\Mapper\Property
;
8 use pq\Mapper\Property
;
9 use pq\Mapper\PropertyInterface
;
11 class Field
implements PropertyInterface
15 function __construct(Mapper
$mapper, $property, $field = null) {
16 $this->mapper
= $mapper;
17 $this->property
= $property;
18 $this->field
= $field ?
: $property;
21 function read(Row
$row, $objectToUpdate) {
22 /* @var $val \pq\Gateway\Cell */
23 $val = $row->{$this->field
};
24 $this->assign($objectToUpdate, $val->get());
27 function write($object, Row
$rowToUpdate) {
28 $val = $this->extract($object);
29 $rowToUpdate->{$this->field
} = $val;