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

[5.1] Fix Issue #11169 #13360

Merged
merged 1 commit into from
Apr 29, 2016
Merged

[5.1] Fix Issue #11169 #13360

merged 1 commit into from
Apr 29, 2016

Conversation

AdenFraser
Copy link
Contributor

@AdenFraser AdenFraser commented Apr 28, 2016

Assuming this is merged in to 5.1, I imagine it will need merging up to 5.2 and master as well as it doesn't appear to have been fixed there.

@AdenFraser
Copy link
Contributor Author

@GrahamCampbell Getting failed StyleCI analysis on this, is this something you are aware of?

@AdenFraser AdenFraser force-pushed the Issue11169 branch 2 times, most recently from e00f54e to de57cf5 Compare April 28, 2016 16:21
@AdenFraser
Copy link
Contributor Author

Tests are failing too, I'll look into that when I get home...

@GrahamCampbell
Copy link
Member

It looks like your fork is out of date and needs rebasing.

@@ -860,7 +860,7 @@ public function morphTo($name = null, $type = null, $id = null)
// If the type value is null it is probably safe to assume we're eager loading
// the relationship. When that is the case we will pass in a dummy query as
// there are multiple types in the morph and we can't use single queries.
if (is_null($class = $this->$type)) {
if (is_null($class = $this->$type) || $class === '') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to just change this to if (! empty($class = $this->$type)) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did that on a previous version which failed tests elsewhere in Model.php.

I will try again after I rebase back to 5.1
On 28 Apr 2016 18:31, "Graham Campbell" notifications@github.com wrote:

In src/Illuminate/Database/Eloquent/Model.php
#13360 (comment):

@@ -860,7 +860,7 @@ public function morphTo($name = null, $type = null, $id = null)
// If the type value is null it is probably safe to assume we're eager loading
// the relationship. When that is the case we will pass in a dummy query as
// there are multiple types in the morph and we can't use single queries.

  •    if (is_null($class = $this->$type)) {
    
  •    if (is_null($class = $this->$type) || $class === '') {
    

Better to just change this to if (! empty($class = $this->$type)) {


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
https://github.com/laravel/framework/pull/13360/files/bc1519926bf4a5a541bfb1aafefe0bcba4f0acbe#r61468802

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this change isn't correct then, and our tests should be failing here too but the tests are just incomplete?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats definitely a possibility, so an going to dig deeper and determine
what's going on and a fix.
On 28 Apr 2016 19:21, "Graham Campbell" notifications@github.com wrote:

In src/Illuminate/Database/Eloquent/Model.php
#13360 (comment):

@@ -860,7 +860,7 @@ public function morphTo($name = null, $type = null, $id = null)
// If the type value is null it is probably safe to assume we're eager loading
// the relationship. When that is the case we will pass in a dummy query as
// there are multiple types in the morph and we can't use single queries.

  •    if (is_null($class = $this->$type)) {
    
  •    if (is_null($class = $this->$type) || $class === '') {
    

Maybe this change isn't correct then, and our tests should be failing here
too but the tests are just incomplete?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
https://github.com/laravel/framework/pull/13360/files/bc1519926bf4a5a541bfb1aafefe0bcba4f0acbe#r61477087

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

@GrahamCampbell GrahamCampbell changed the title Fix Issue #11169 [5.1] Fix Issue #11169 Apr 28, 2016
@AdenFraser AdenFraser force-pushed the Issue11169 branch 2 times, most recently from 3af995f to b5596ca Compare April 29, 2016 08:44
@AdenFraser
Copy link
Contributor Author

Seems I was being a little dense yesterday, looking over my previous commits I was checking if(! empty when I should have been checking if (empty($class = $this->$type)) {.

Tests are now passing fine and this is the cleaner implementation.

@taylorotwell taylorotwell merged commit 46fd7dd into laravel:5.1 Apr 29, 2016
@AdenFraser AdenFraser deleted the Issue11169 branch April 29, 2016 15:10
zither added a commit to zither/framework that referenced this pull request Apr 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants