示例#1
0
文件: relation.php 项目: cepharum/txf
 /**
  * Searches node in relation matching model and/or alias/name of model
  * either at ends of relation or on all of them.
  *
  * @param model|\ReflectionClass|null $model model of node to look for
  * @param string|null $nameOrAlias name of model or alias of node to look for
  * @param bool $endpointsOnly false to search whole relation instead
  * @param array|mixed $value first value to bind, or all values as array
  * @return $this
  */
 public function bindOnMatching($model = null, $nameOrAlias = null, $endpointsOnly = true, $value)
 {
     if (!$model && !$nameOrAlias) {
         throw new \InvalidArgumentException('select either associated model or its name/alias to search for matching node in relation');
     }
     return $this->_bindOnModel($model, $nameOrAlias, !!$endpointsOnly, data::normalizeVariadicArguments(func_get_args(), 3));
 }
示例#2
0
 /**
  * Binds reference using provided values.
  *
  * Values are used to bind referencing node of current reference.
  *
  * @param array $values values for binding reference
  * @return $this
  */
 public function bind($values)
 {
     if ($this->referencingLeftToRight) {
         $this->predecessorEnd->bindOnSuccessor(data::normalizeVariadicArguments(func_get_args(), 0));
     } else {
         $this->successorEnd->bindOnPredecessor(data::normalizeVariadicArguments(func_get_args(), 0));
     }
     return $this;
 }