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

[6.x] Fix auto creating model by class name #33481

Merged
merged 1 commit into from
Jul 9, 2020

Conversation

vv12131415
Copy link
Contributor

@vv12131415 vv12131415 commented Jul 9, 2020

I'm targeting 6.x because it was broken in 6.x by #30653

There was an issue about this problem #31180

as @driesvints said

We only support Eloquent models for this rule. Because you're not using an Eloquent model, this rule won't work. You'll have to ask the maintainers of laravel doctrine to provide a custom database rule.

But the thing is illuminate/database is only suggestion, not the requirement of this library. Another thing is that https://github.com/laravel-doctrine/ implements PresenceVerifierInterface which works perfectly fine.

The change that I've proposed does not break anyone else code, it just makes validation rule more general purpose and adds ability for other database ORM providers (the guaranties was given by PresenceVerifierInterface, I can implement it on my own and make FilePresenceVerifier if my persistence layer is in file, same way I can make ExternalApiPresenceVerifier and check external API for existence or uniqueness)

also saying that

We only support Eloquent models for this rule. Because you're not using an Eloquent model, this rule won't work. You'll have to ask the maintainers of laravel doctrine to provide a custom database rule.

Is not correct, since? as I have described you give PresenceVerifierInterface

@driesvints driesvints changed the title fix auto creating model by class name [6.x] Fix auto creating model by class name Jul 9, 2020
@vv12131415 vv12131415 force-pushed the fix-database-rule branch 2 times, most recently from f91c530 to da42d7f Compare July 9, 2020 08:40
@vv12131415
Copy link
Contributor Author

I've force pushed to retrigger failed CI (some why container of MySQL on php 7.2 failed)

@vv12131415
Copy link
Contributor Author

okay, reverting back to is_subclass_of
since "Illuminate\Tests\Validation\User" instanceof Model fails, instanceof only works on object level I suppose.

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

Successfully merging this pull request may close these issues.

None yet

3 participants