예제 #1
0
 /**
  * Shortcut method to register a reference from the condition to resolve sub_queries
  *
  * @param string       $attribute
  * @param string|array $target_s
  * @param array|null   $on
  * @return $this
  */
 public function reference($attribute, $target_s, $on = null)
 {
     if ($this->_collection_name) {
         \Rocketr\Schema\Reference::add($this->_collection_name, [$attribute => $target_s], $on);
     } else {
         //TODO: Exeption ?
     }
     return $this;
 }
예제 #2
0
파일: Map.php 프로젝트: alex-robert/knot
 /**
  * @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);
         }
     }
 }