conedevelopment / bazar

Bazar is an e-commerce package for Laravel applications.
https://root.conedevelopment.com
MIT License
422 stars 56 forks source link

Addressable User relationship uuid != integer #158

Closed richstandbrook closed 3 years ago

richstandbrook commented 3 years ago

Description:

Attempt to visit /bazar/users and I receive this error

SQLSTATE[42883]: Undefined function: 7 ERROR: operator does not exist: uuid = integer LINE 1: ...dresses" where "bazar_addresses"."addressable_id" in (5, 6, ... ^ HINT: No operator matches the given name and argument types. You might need to add explicit type casts. (SQL: select * from "bazar_addresses" where "bazar_addresses"."addressable_id" in (5, 6, 7) and "bazar_addresses"."addressable_type" = Bazar\Models\User)

I saw something similar when I tried to do an install with --seed option.

It's clear from the database that bazar_addresses.addressable_id is a uuid field and the user.id is an integer so they can't have a direct comparison.

Steps To Reproduce:

Install Bazar and visit/bazar/users

iamgergo commented 3 years ago

Hi,

Thanks for the report.

Well, I've added the UUID concept to the cart models, but obviously, it causes more trouble than I expected. By the way, I tested only with MySQL and SQLite, and not PostgreSQL, so this kind of mix was not a problem. I'm happy it turned out.

I pushed a commit that should solve this, could you test it, please?

Thank you!

richstandbrook commented 3 years ago

I pushed a commit that should solve this, could you test it, please?

Brilliant — works perfectly now!