orm
orm copied to clipboard
[QUESTION]. Missing DatabasePresenceVerifierInterface In DoctrinePresenceVerifier Class
Please prefix your issue with one of the following: [BUG] [PROPOSAL] [QUESTION].
Laravel Doctrine Version >1.4, Laravel Version 8.12
I am trying to using the Laravel exists function for validating the Doctrine Entity in Laravel 8. I have two different managers in doctrine config one is default and the other is yusrub.
I defined the database connections in config/databse.php with the name of yusrub.
public function rules()
{
return [
'incrementId' => 'required|exists:connection.yusrub.Yusrub\Order\Domain\Entities\Order',
];
}
But When I run the code it always picks the default connection, not the yusrub connection.
Expected behaviour
It should pick the yusrub connection, not the default connection.
Actual behaviour
But When I run the code it always picks the default connection, not the yusrub connection.
Steps to reproduce the behaviour
I debug the code and found in laravel 8.12 there is the change in implementation in Class Illuminate\Validation\Validor
public function getPresenceVerifier($connection = null)
{
if (! isset($this->presenceVerifier)) {
throw new RuntimeException('Presence verifier has not been set.');
}
if ($this->presenceVerifier instanceof DatabasePresenceVerifierInterface) {
$this->presenceVerifier->setConnection($connection);
}
return $this->presenceVerifier;
}
Where the Laravel Doctrine PresenseVerifier class LaravelDoctrine\ORM\Validation does not implement the DatabasePresenceVerifierInterface interface that is why it's always picking the default connection.
My Question, are we going to fix this issue?
Good catch 👍🏻 Looks like you found the correct solution (implement interface). Could you provide a pull request for this? 🙂
Sure, Let me Create a PR for It.