data mapper POC
[m6w6/pq-gateway] / lib / pq / Mapper / RefProperty.php
1 <?php
2
3 namespace pq\Mapper;
4
5 trait RefProperty
6 {
7 use Property;
8
9 private $refClass;
10 private $refName;
11
12 function to($class) {
13 $this->refClass = $class;
14 return $this;
15 }
16
17 function references($class) {
18 return $this->refClass === (is_object($class) ? get_class($class) : $class);
19 }
20
21 function by($ref) {
22 $this->refName = $ref;
23 return $this;
24 }
25
26 function on($ref) {
27 return $this->refName === $ref;
28 }
29
30 }