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

[Bug]: Error when we use UUID/ULID #26

Open
envolute opened this issue Mar 18, 2024 · 6 comments
Open

[Bug]: Error when we use UUID/ULID #26

envolute opened this issue Mar 18, 2024 · 6 comments
Labels
bug Something isn't working v3 Planned for v3

Comments

@envolute
Copy link

What happened?

Hi Mokhosh!!

I am using ULID in the model, so when I try to drag the item to another status or edit it, an error occurs...
I found that the problem is that all declarations of the $recordId parameter were defined as integer
int $recordId
This way I found all the declarations and changed it to:
int|string $recordId
The changed methods were in the following files:
"src/Concerns/HasStatusChange.php"
"src/Concerns/HasEditRecordModal.php"

In this second file, we have the variable
public ?int $editModalRecordId = null;
Changed to:
public null|int|string $editModalRecordId = null;
And the method:
getEditModalFormSchema(?int $recordId)
Changed to
getEditModalFormSchema(null|int|string $recordId)

Important:
I also had to change the function calls:
onStatusChanged(int|string $recordId, ...)
getEditModalFormSchema(null|int|string $recordId, ...)
In the page generated through the "make" command.

Reminder:
It is necessary to change the test files and functions generated in the "make" command

Well, I believe that as the use of UUID or ULID is common, this correction is interesting...

How to reproduce the bug

Use UUID or ULID as record IDs. Then try to change them...

Package Version

v2.3.0

PHP Version

8.1.10

Laravel Version

10.10

Which operating systems does with happen with?

Windows

Which browsers does with happen with?

Chrome

Notes

No response

@envolute envolute added the bug Something isn't working label Mar 18, 2024
@mokhosh
Copy link
Owner

mokhosh commented Mar 18, 2024

Thanks for reporting. I'll look into it.

@mokhosh mokhosh added the v3 Planned for v3 label Mar 18, 2024
@mokhosh
Copy link
Owner

mokhosh commented Mar 18, 2024

I wrote new tests for models using ulid, and tests are passing, but this will be a breaking change, as it will change the signature of some KanbanBoard methods that are usually overrode.

I'll ship this in v3.

@envolute
Copy link
Author

Great!!
In my project the changes have already been made and so far everything is ok... Of course, if I need to update or, certainly, use it again I will go to version 3...

Thank you for your attention and for the code that worked perfectly for my needs!!

@milenmk
Copy link

milenmk commented Jun 18, 2024

As a temporary fix:

  1. Make the board extends Filament Page class ToDoBoard extends Page implements HasForms

  2. Copy all data (properties and methods) from KanbanBoard to your board and make $record_id to be a string

  3. Create your own HasEditRecordModal and HasStatusChange traits and make $record_id to be a string

I got it working with UUID this way.

P.S.: Great work. Very usefull module.

@crisanT1231
Copy link

hello, any updates regarding this feature?

@crisanT1231
Copy link

As a temporary fix:

  1. Make the board extends Filament Page class ToDoBoard extends Page implements HasForms
  2. Copy all data (properties and methods) from KanbanBoard to your board and make $record_id to be a string
  3. Create your own HasEditRecordModal and HasStatusChange traits and make $record_id to be a string

I got it working with UUID this way.

P.S.: Great work. Very usefull module.

thanks, this worked for me too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v3 Planned for v3
Projects
None yet
Development

No branches or pull requests

4 participants