X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fpq-gateway;a=blobdiff_plain;f=lib%2Fpq%2FMapper%2FRefProperty.php;h=50b62883c5ab27bae0e7796b21bbf1e86d8f99f1;hp=d7c6c6f6735cd485ecf4d4bcbe686de9a4e7482f;hb=05a907a5cb7377e2ad7abfa21096e3630752b944;hpb=d4d84fb9b85f0216bd611946d59054a606c71960 diff --git a/lib/pq/Mapper/RefProperty.php b/lib/pq/Mapper/RefProperty.php index d7c6c6f..50b6288 100644 --- a/lib/pq/Mapper/RefProperty.php +++ b/lib/pq/Mapper/RefProperty.php @@ -6,25 +6,53 @@ trait RefProperty { use Property; + /** + * The referred class + * @var string + */ private $refClass; + + /** + * The foreign key name + * @var string + */ private $refName; + /** + * Define the referred class + * @param string $class + * @return RefPropertyInterface + */ function to($class) { $this->refClass = $class; return $this; } + /** + * Check whether this mapping refers to $class + * @param string $class + * @return bool + */ function references($class) { return $this->refClass === (is_object($class) ? get_class($class) : $class); } + /** + * Define the foreign key name as defined by pq\Gateway\Table\Reference + * @param string $ref + * @return RefPropertyInterface + */ function by($ref) { $this->refName = $ref; return $this; } + /** + * Check whether this mapping referes to a foreign key + * @param string $ref + * @return bool + */ function on($ref) { return $this->refName === $ref; } - }