phpdoc
[m6w6/pq-gateway] / lib / pq / Mapper / Property / Ref.php
index 84f39f41e7cbd660969983967158b5aa862e1f59..01489d9c1b8180e201c37759dfd99b5981880a93 100644 (file)
@@ -4,6 +4,7 @@ namespace pq\Mapper\Property;
 
 use pq\Gateway\Row;
 use pq\Mapper\Mapper;
+use pq\Mapper\PropertyInterface;
 use pq\Mapper\RefProperty;
 use pq\Mapper\RefPropertyInterface;
 use UnexpectedValueException;
@@ -11,12 +12,22 @@ use UnexpectedValueException;
 class Ref implements RefPropertyInterface
 {
        use RefProperty;
-       
+
+       /**
+        * Create a parent row mapping
+        * @param Mapper $mapper
+        * @param string $property
+        */
        function __construct(Mapper $mapper, $property) {
                $this->mapper = $mapper;
                $this->property = $property;
        }
 
+       /**
+        * Read the parent object
+        * @param Row $row
+        * @param object $objectToUpdate
+        */
        function read(Row $row, $objectToUpdate) {
                $val = $this->extract($objectToUpdate);
                if (!isset($val)) {
@@ -27,6 +38,12 @@ class Ref implements RefPropertyInterface
                }
        }
 
+       /**
+        * Write the parent row's foreign key
+        * @param object $object
+        * @param Row $rowToUpdate
+        * @throws UnexpectedValueException
+        */
        function write($object, Row $rowToUpdate) {
                $map = $this->mapper->mapOf($this->refClass);
                $ref = $this->extract($object);
@@ -45,6 +62,11 @@ class Ref implements RefPropertyInterface
                }
        }
 
+       /**
+        * Find the property exposing $col
+        * @param string $col
+        * @return PropertyInterface[]
+        */
        private function findFieldProperty($col) {
                $map = $this->mapper->mapOf($this->refClass);
                return array_filter($map->getProperties(), function($property) use($col) {