5 class Storage
implements StorageInterface
13 * @var \pq\Mapper\Mapper
19 * @var pq\Mapper\MapInterface
24 * @var \pq\Gateway\Table
28 function __construct(Mapper
$mapper, $class) {
29 $this->class = $class;
30 $this->mapper
= $mapper;
31 $this->mapping
= $mapper->mapOf($class);
32 $this->gateway
= $this->mapping
->getGateway();
35 function getMapper() {
39 function find($where = [], $order = null, $limit = null, $offset = null) {
40 /* @var pq\Gateway\Rowset $rowset */
41 $rowset = $this->gateway
->find($where, $order, $limit, $offset);
42 return $this->mapping
->mapAll($rowset);
45 function delete($object) {
46 $cache = $this->mapping
->getObjects();
47 $row = $cache->asRow($object)->delete();
48 $cache->resetObject($row);
49 $cache->resetRow($object);
52 function persist($object) {
53 $this->mapping
->unmap($object);