Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate Join::ON ? #11105

Open
wants to merge 1 commit into
base: 2.18.x
Choose a base branch
from
Open

Conversation

HypeMC
Copy link
Contributor

@HypeMC HypeMC commented Dec 5, 2023

I've been wondering about this for years, what is the purpose of the Join::ON constant? This constant seems completely useless, as the DQL parser doesn't even support the ON keyword in a join:

$fooRepository->createQueryBuilder('f')
    ->innerJoin('f.bar', 'b', Join::ON, 'b.condition = 1')
    ->getQuery()
    ->execute()
;
[Syntax Error] line 0, col 51: Error: Expected end of string, got 'ON'

I haven't found any issues related to this, nor any explanations regarding the original idea behind this constant.

Also, if it's decided to deprecate and remove this constant, the $conditionType parameters of the QueryBuilder::*Join() methods and Expr\Join class will become redundant since currently, the only two options are WITH and ON. Therefore, it might be a good idea to consider deprecating them as well.

* @param string $alias The alias of the join.
* @param string|null $conditionType The condition type constant. Either ON or WITH.
* @param string|Expr\Comparison|Expr\Composite|Expr\Func|null $condition The condition for the join.
* @param string|null $indexBy The index for the join.
* @psalm-param Expr\Join::ON|Expr\Join::WITH|null $conditionType
*
* @return $this
*/
public function innerJoin($join, $alias, $conditionType = null, $condition = null, $indexBy = null)
{
$parentAlias = substr($join, 0, (int) strpos($join, '.'));
$rootAlias = $this->findRootAlias($alias, $parentAlias);
$join = new Expr\Join(
Expr\Join::INNER_JOIN,
$join,
$alias,
$conditionType,
$condition,
$indexBy
);
return $this->add('join', [$rootAlias => $join], true);
}

@HypeMC HypeMC force-pushed the deprecate-join-on branch from 8e7d275 to 3c32b3c Compare January 21, 2024 20:14
Copy link
Contributor

There hasn't been any activity on this pull request in the past 90 days, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days.
If you want to continue working on it, please leave a comment.

@github-actions github-actions bot added the Stale label Oct 18, 2024
@derrabus
Copy link
Member

Sorry that we haven't picked this up yet.

Does that mean that Join::WITH is the only valid value we can pass as the third argument of innerJoin()? If so, does it make sense to maintain a parameter with only a single valid value? Can we also deprecate the Join::WITH constant?

@HypeMC
Copy link
Contributor Author

HypeMC commented Oct 18, 2024

Sorry that we haven't picked this up yet.

Does that mean that Join::WITH is the only valid value we can pass as the third argument of innerJoin()? If so, does it make sense to maintain a parameter with only a single valid value? Can we also deprecate the Join::WITH constant?

@derrabus Yes, that's right, Join::WITH is the only valid value. IMO, it would make sense to deprecate the parameter altogether, as it's currently useless.

Copy link
Contributor

There hasn't been any activity on this pull request in the past 90 days, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days.
If you want to continue working on it, please leave a comment.

@github-actions github-actions bot added the Stale label Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants