laminas/laminas-validator

Let AbstractDb implement AdapterAwareInterface

michalbundyra opened this issue · 6 comments

At the moment Zend\Validator\Db\AbstractDb has a method setAdapter to set the database adapter. I think the canonical way of doing that would be to implement the Zend\Db\Adapter\AdapterAwareInterface's setDbAdapter() instead, maybe by using the Zend\Db\Adapter\AdapterAwareTrait.


Originally posted by @larsnystrom at zendframework/zend-validator#32

We haven't done this in the past as the AdapterAwareInterface was added after the validator was created. :)

As for the AdapterAwareTrait, until 2.5, we couldn't have used it.

Feel free to send a PR with these changes.


Originally posted by @weierophinney at zendframework/zend-validator#32 (comment)

Has this been fixed yet ? If not I would like to give it a try .


Originally posted by @Keops92 at zendframework/zend-validator#32 (comment)

@michalbundyra, this one has been already implemented:

abstract class AbstractDb extends AbstractValidator implements AdapterAwareInterface
{
use AdapterAwareTrait;