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

Relationship with UUID force sometime a cast to integer #26594

Closed
masterix21 opened this issue Nov 22, 2018 · 3 comments
Closed

Relationship with UUID force sometime a cast to integer #26594

masterix21 opened this issue Nov 22, 2018 · 3 comments

Comments

@masterix21
Copy link
Contributor

  • Laravel Version: 5.7.14
  • PHP Version: 7.2.11
  • Database Driver & Version: MySQL Ver 14.14 Distrib 5.7.24, for osx10.14 (x86_64)

Description:

I had wrote the application using 5.6, migrated to 5.7. On the first releases (5.7) it works, now it has some casting problems. I'm using only UUID as ID, with $incrementing to FALSE.

Using the following relation

public function clazz()
{
      return $this->belongsTo(Clazz::class, 'class_id', 'id');
}

the query will be translated to:

SELECT * FROM `classes` WHERE `classes`.`id` in (9223372036854775807, 47054, 4, 4, 51316830)

But if i change the previous relation with:

public function clazz()
{
      return $this->hasOne(Clazz::class, 'id', 'class_id');
}

it works:

SELECT * FROM `classes` WHERE `classes`.`id` in ('45e24ee0-e670-11e8-a21c-f19a3bda0c2c', '47054ee0-e670-11e8-b6fd-91db92a186e6', '4ae66650-e670-11e8-82dd-f790d51163b7', '4d2b19f0-e670-11e8-b1c2-777da339fff3', '51316830-e670-11e8-a9d6-fbefcd513547')

Any ideas?

@masterix21
Copy link
Contributor Author

I have downgraded now to 5.7.13 and belongsTo start again to works: i can confirm the bug with 5.7.14.

@driesvints
Copy link
Member

Please see #26591 & #26582

@masterix21
Copy link
Contributor Author

Thanks, sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants