Jarves\Configuration\ConditionSubSelect::addSelfJoin PHP Method

addSelfJoin() public method

public addSelfJoin ( $alias, $on )
    public function addSelfJoin($alias, $on)
    {
        $this->selfJoins[$alias] = $on;
    }

Usage Example

Example #1
0
 /**
  * Propel uses for his nested-set objects `lft` and `rgt` fields.
  * So we include with this condition all entries 'inside' the entry
  * defined through $condition.
  *
  * @param Condition $condition
  * @return Condition
  */
 public function getNestedSubCondition(Condition $condition)
 {
     $result = new Condition(null, $this->jarves);
     $sub = new ConditionSubSelect(null, $this->jarves);
     $sub->select('sub.lft');
     $sub->addSelfJoin('sub', 'sub.lft BETWEEN %table%.lft+1 AND %table%.rgt-1');
     $sub->setRules($condition->getRules());
     $subCondition = new Condition();
     $subCondition->addAnd(['lft', 'IN', $sub]);
     $result->addAnd($subCondition);
     return $result;
 }