Created
November 2, 2015 15:57
-
-
Save beporter/d8405c5d1a5844985a02 to your computer and use it in GitHub Desktop.
A quick diff and script to resolve cakephp/cakephp#7626 until that PR can be merged. Save these files in your project root dir, make the .sh executable, and run it. Assumes CakePHP v3.1.3 is in use.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#--------------------------------------------------------------------- | |
usage () | |
{ | |
cat <<EOT | |
${0##*/} | |
Apply the belongstomany.patch file to your cakephp source in vendor/ | |
Usage: | |
bin/${0##*/} <table> | |
EOT | |
exit 0 | |
} | |
if [ "$1" = '-h' ]; then | |
usage | |
fi | |
DIR="$( cd -P "$( dirname "$0" )"/.. >/dev/null 2>&1 && pwd )" | |
printf "\n## Applying patch.\n" | |
patch vendor/cakephp/cakephp/src/ORM/Association/BelongsToMany.php belongstomany.patch | |
printf "\n## To undo, run 'composer install' or reset your vendor/ dir" | |
printf "\n## or run this again and choose 'Y' when prompted to reverse.\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- vendor/cakephp/cakephp/src/ORM/Association/BelongsToMany.php 2015-10-30 10:01:28.000000000 -0500 | |
+++ vendor/cakephp/cakephp/src/ORM/Association/BelongsToMany.php 2015-10-30 10:01:49.000000000 -0500 | |
@@ -758,6 +758,7 @@ | |
$associationConditions = $this->conditions(); | |
if ($associationConditions) { | |
+ $existing->contain($this->target()->alias()); | |
$existing->andWhere($associationConditions); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment