Added leftjoin ORM Query Type #42
Added leftjoin ORM Query Type #42
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TomHAnderson thanks for this feature. Code looks good for me, just two small comments. I haven't tested it yet, but I believe you checked it and it works for you and you 😄 Thanks 👍
README.md
Outdated
@@ -303,6 +303,16 @@ To enable inner join add this to your configuration. | |||
``` | |||
|
|||
|
|||
There is also an ORM Query Type for LeftJoin. This join type is commonly used to fetch an empty right side of a relationship. | |||
|
|||
Left Join is not included by default in the `zf-doctrine-querybuilder.global.php.dist`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason why it is not included in the dist config file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the same reason innerJoin is not included in the .dist. The join filters allow deeper querying of data. Not including them is erring on the side of caution. Examples are all theoretical. Including the ability to join tables IMHO should be left to the implementing developer.
For instance given a resource which can return users you could inner join the user table to the user acl table and fetch all users who are just administrators.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine. Don't you think then we need add here how to enable it? I know it will be very similar to innerjoin
, but maybe better to have it here, and if someone want enable it can just copy-paste this part from the docs. Or maybe even better, add it to .dist config but commented out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed the instructions to add the filter yourself and I've added both join filters to the .dist config file. TomHAnderson@f7d9119
src/Filter/ORM/LeftJoin.php
Outdated
<?php | ||
/** | ||
* @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause | ||
* @copyright Copyright (c) 2014 Zend Technologies USA Inc. (http://www.zend.com) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update year to 2017 here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Odd behavior of github right now. I pushed this change to the PR branch and it didn't add the commit here. https://github.com/TomHAnderson/zf-doctrine-querybuilder/commits/feature/leftjoin
@TomHAnderson No idea why github is not updating your commits here... So weird! |
Github status says there's a backlog of queue events. I'll check back later today. |
This PR now includes all expected commits. |
@TomHAnderson Thanks ! |
Added leftjoin ORM Query Type
@TomHAnderson thanks ! |
I found myself needing to query the non-foreign-key containing side of a relationship for null on the other and innerjoin does not do that, so here is leftjoin.