Example #1
0
 /**
  * Shortcut method to register a sub collection in knot::map::collection
  *
  * @param            $attribute_s
  * @param            $target_s
  * @param array|null $on
  * @return $this
  */
 public function has_collection($attribute_s, $target_s, $on = null)
 {
     if ($this->_collection_name) {
         \Rocketr\Schema\HasCollection::add($this->_collection_name, [$attribute_s => $target_s], $on);
     }
     return $this;
 }
Example #2
0
 /**
  * @param $which
  * @param $collection
  * @param $attr
  * @param $target
  */
 private function _push_to_map($which, $collection, $attr, $target)
 {
     if ($which == 'reference') {
         $ref_attr = isset($on[$collection][$attr]) ? $on[$collection][$attr] : null;
         \Rocketr\Schema\Reference::add($collection, [$attr => $target], $ref_attr);
     } else {
         if ($which == 'has_collection') {
             $ref_attr = isset($on[$collection][$attr]) ? $on[$collection][$attr] : null;
             \Rocketr\Schema\HasCollection::add($collection, [$attr => $target], $ref_attr);
         }
     }
 }