join() публичный Метод

Matches the values with the supplied values according to the supplied filter then maps the results into as according to the supplied function.
public join ( array | Traversable $values ) : Pinq\Interfaces\IJoiningOnTraversable
$values array | Traversable
Результат Pinq\Interfaces\IJoiningOnTraversable
Пример #1
0
 /**
  * @dataProvider theImplementations
  */
 public function testThatExecutionIsDeferred(\Pinq\ITraversable $traversable, array $data)
 {
     $this->assertThatExecutionIsDeferred(function (callable $function) use($traversable) {
         return $traversable->join([])->on($function)->to($function);
     });
     $this->assertThatExecutionIsDeferred(function (callable $function) use($traversable) {
         return $traversable->join([])->onEquality($function, $function)->to($function);
     });
 }
Пример #2
0
 /**
  * Evaluates the join segment values and filter upon the supplied traversable.
  *
  * @param ITraversable                       $traversable
  * @param Common\Join\Options                $join
  * @param Queries\IResolvedParameterRegistry $resolvedParameters
  *
  * @return \Pinq\Interfaces\IJoiningToTraversable
  */
 public static function evaluateJoinOptions(ITraversable $traversable, Common\Join\Options $join, Queries\IResolvedParameterRegistry $resolvedParameters)
 {
     $values = self::evaluateSource($join->getSource(), $resolvedParameters);
     $joiningTraversable = $join->isGroupJoin() ? $traversable->groupJoin($values) : $traversable->join($values);
     if ($join->hasFilter()) {
         $filter = $join->getFilter();
         if ($filter instanceof Common\Join\Filter\Custom) {
             $joiningTraversable = $joiningTraversable->on($resolvedParameters[$filter->getOnFunction()->getCallableId()]);
         } elseif ($filter instanceof Common\Join\Filter\Equality) {
             $joiningTraversable = $joiningTraversable->onEquality($resolvedParameters[$filter->getOuterKeyFunction()->getCallableId()], $resolvedParameters[$filter->getInnerKeyFunction()->getCallableId()]);
         }
     }
     if ($join->hasDefault()) {
         $joiningTraversable = $joiningTraversable->withDefault($resolvedParameters[$join->getDefaultValueId()], $resolvedParameters[$join->getDefaultKeyId()]);
     }
     return $joiningTraversable;
 }