laravel-doctrine / orm

A drop-in Doctrine ORM 2 implementation for Laravel 5+ and Lumen

Home Page:http://laraveldoctrine.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Laravel 11 "validation.presence" not overriden

xaben opened this issue · comments

Laravel 11 upgrade not possible due to all the validations failing as service is not being overridden.

Package version, Laravel version

laravel-doctrine/orm 2.1.0
laravel/framework v11.10.0

Expected behaviour

LaravelDoctrine\ORM\Validation\DoctrinePresenceVerifier is returned when trying to fetch "validation.presence" service

Actual behaviour

Illuminate\Validation\DatabasePresenceVerifier is returned instead

Steps to reproduce the behaviour

Add an Exists validation as described in https://laraveldoctrine.org/docs/1.8/orm/validation

I manager to solve this by adding the following to my AppServiceProvider:

$this->app->singleton(DoctrinePresenceVerifier::class);
$this->app->extend('validation.presence', fn () => app()->get(DoctrinePresenceVerifier::class));

A bit hacky but a step in the right direction. I can look into submitting a PR this weekend.