Propel2 icon indicating copy to clipboard operation
Propel2 copied to clipboard

addJoin table names without alias get mangled

Open donCarlosOne opened this issue 8 years ago • 7 comments

Found an issue in ActiveQuery/Criteria.php, method addJoin.

The left and right column names get stripped of the first character if there is no "." in the provided values.

I have corrected this (in my local copy of the most recent release) with the following:

line 921:

$leftColumnName = substr($left, $dotpos ? $dotpos + 1 : 0);

line 927:

$rightColumnName = substr($right, $dotpos ? $dotpos + 1 : 0);

These check for the presence of $dotpos, which is false if there is no "." in the left or right values.

The current code automatically adds 1 to $dotpos, making it 1 if there is no ".", and winds up stripping the first character off of the left and right values, causing the subsequent query to fail.

donCarlosOne avatar Jul 21 '16 20:07 donCarlosOne

Would you like to send us a PR with that changes?

marcj avatar Oct 16 '16 02:10 marcj

Sure. How would I go about doing that?

donCarlosOne avatar Oct 16 '16 09:10 donCarlosOne

Fork this repo, add the change, make sure test suite is green, preferably add a custom test which proofs your changes (means: the test should fail without your code change), commit the changed, push to your fork, and then come backto this repository and create a pull request.

marcj avatar Oct 16 '16 13:10 marcj

ping @donCarlosOne

dereuromark avatar Jul 01 '20 12:07 dereuromark

@dereuromark I haven't used Propel in quite some time, so really have nothing to add at this time.

donCarlosOne avatar Jul 16 '20 14:07 donCarlosOne

@Incognito Do we want to follow up on this?

dereuromark avatar Jul 16 '20 14:07 dereuromark

Sounds like something that would be great to have a fix for.

Low severity as there is a work-around, high value because it is something that should just work out of the box. The fix suggested makes perfect sense, I don't know what the setup would need to look like to have no "." however.

Incognito avatar Jul 16 '20 14:07 Incognito