$qb = $conn->createQueryBuilder()
->select('u.name')
->from('users', 'u')
->rightJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
/** * Creates and adds a right join to the query. * * <code> * $qb = $conn->getQueryBuilder() * ->select('u.name') * ->from('users', 'u') * ->rightJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1'); * </code> * * @param string $fromAlias The alias that points to a from clause. * @param string $join The table name to join. * @param string $alias The alias of the join table. * @param string $condition The condition for the join. * * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. */ public function rightJoin($fromAlias, $join, $alias, $condition = null) { $this->queryBuilder->rightJoin($fromAlias, $this->getTableName($join), $alias, $condition); return $this; }
/** * Creates and adds a right join to the query. * * @param string $fromAlias The alias that points to a from clause. * @param string $join The table name to join. * @param string $alias The alias of the join table. * @param string $condition The condition for the join. * * @return self */ public function rightJoin($fromAlias, $join, $alias, $condition = null) { $this->qb->rightJoin($fromAlias, $join, $alias, $condition); return $this; }
/** * Creates and adds a right join to the query. * * @param string $fromAlias The alias that points to a from clause. * @param string $join The table name to join. * @param string $alias The alias of the join table. * @param string $condition The condition for the join. * * @return QueryBuilder This QueryBuilder instance. */ public function rightJoin(string $fromAlias, string $join, string $alias, string $condition = null) : QueryBuilder { $this->concreteQueryBuilder->rightJoin($this->quoteIdentifier($fromAlias), $this->quoteIdentifier($join), $this->quoteIdentifier($alias), $condition); return $this; }
/** * Creates and adds a right join to the query. * * <code> * $qb = $conn->getQueryBuilder() * ->select('u.name') * ->from('users', 'u') * ->rightJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1'); * </code> * * @param string $fromAlias The alias that points to a from clause. * @param string $join The table name to join. * @param string $alias The alias of the join table. * @param string $condition The condition for the join. * * @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance. */ public function rightJoin($fromAlias, $join, $alias, $condition = null) { $this->queryBuilder->rightJoin($fromAlias, $this->helper->quoteColumnName($join), $alias, $condition); return $this; }
/** * @test */ public function rightJoinQuotesIdentifiersAndDelegatesToConcreteQueryBuilder() { $this->connection->quoteIdentifier('fromAlias')->shouldBeCalled()->willReturnArgument(0); $this->connection->quoteIdentifier('join')->shouldBeCalled()->willReturnArgument(0); $this->connection->quoteIdentifier('alias')->shouldBeCalled()->willReturnArgument(0); $this->concreteQueryBuilder->rightJoin('fromAlias', 'join', 'alias', null)->shouldBeCalled()->willReturn($this->subject); $this->subject->rightJoin('fromAlias', 'join', 'alias'); }