projects
/
m6w6
/
pq-gateway
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
phpdoc
[m6w6/pq-gateway]
/
lib
/
pq
/
Mapper
/
RefProperty.php
diff --git
a/lib/pq/Mapper/RefProperty.php
b/lib/pq/Mapper/RefProperty.php
index d7c6c6f6735cd485ecf4d4bcbe686de9a4e7482f..50b62883c5ab27bae0e7796b21bbf1e86d8f99f1 100644
(file)
--- a/
lib/pq/Mapper/RefProperty.php
+++ b/
lib/pq/Mapper/RefProperty.php
@@
-6,25
+6,53
@@
trait RefProperty
{
use Property;
{
use Property;
+ /**
+ * The referred class
+ * @var string
+ */
private $refClass;
private $refClass;
+
+ /**
+ * The foreign key name
+ * @var string
+ */
private $refName;
private $refName;
+ /**
+ * Define the referred class
+ * @param string $class
+ * @return RefPropertyInterface
+ */
function to($class) {
$this->refClass = $class;
return $this;
}
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);
}
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;
}
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;
}
function on($ref) {
return $this->refName === $ref;
}
-
}
}