storage test
[m6w6/pq-gateway] / lib / pq / Mapper / MapInterface.php
1 <?php
2
3 namespace pq\Mapper;
4
5 use pq\Gateway\Row;
6 use pq\Gateway\Rowset;
7 use pq\Gateway\Table;
8
9 interface MapInterface
10 {
11 /**
12 * Get the mapped class' name
13 * @return string
14 */
15 function getClass();
16
17 /**
18 * Get the object manager
19 * @return ObjectManager
20 */
21 function getObjects();
22
23 /**
24 * The the underlying table gateway
25 * @return Table
26 */
27 function getGateway();
28
29 /**
30 * Get the mapped properties
31 * @return PropertyInterface[]
32 */
33 function getProperties();
34
35 /**
36 * Add a property to map
37 * @param PropertyInterface $property
38 */
39 function addProperty(PropertyInterface $property);
40
41 /**
42 * Get all child rows by foreign key
43 * @param Row $row
44 * @param string $refName
45 * @param array $objects
46 * @return Rowset
47 */
48 function allOf(Row $row, $refName, &$objects = null);
49
50 /**
51 * Get the parent row by foreign key
52 * @param Row $row
53 * @param string $refName
54 * @param array $objects
55 * @return Rowset
56 */
57 function refOf(Row $row, $refName, &$objects = null);
58
59 /**
60 * Get the table relation reference
61 * @param MapInterface $map origin
62 * @param string $refName relations reference name
63 * @return Table\Reference
64 */
65 function relOf(MapInterface $map, $refName);
66
67 /**
68 * Map a row to an object
69 * @param Row $row
70 * @return object
71 */
72 function map(Row $row);
73
74 /**
75 * Map a rowset to an array of objects
76 * @param Rowset $rows
77 * @return object[]
78 */
79 function mapAll(Rowset $rows);
80
81 /**
82 * Unmap on object
83 * @param object $object
84 * @return Row
85 */
86 function unmap($object);
87 }