Decouple Zend\Db\Sql from concrete Zend\Db\Adapter implementations #2989

Closed
wants to merge 2 commits into
from

Projects

None yet

3 participants

@Slamdunk
Contributor

By typehinting only interfaces we can fully decouple Zend\Db\Sql from concrete Zend\Db\Adapter\Adapter implementation.

As you can see in the diff, I've changed no test, expect two protected-method tests, so there is no breaks.

I consider Zend\Db\Sql a good sql builder, and in order to use it with non-zend adapter, like Doctrine2, we need to provide only interface dependancies.

@Slamdunk
Contributor

I'm sorry, why did you mark this PR as 2.1? I think it can be merged in 2.0 trunk

@Maks3w
Member
Maks3w commented Nov 16, 2012

Because change method signatures and that is BC Break.

There are public methods expecting a concrete "Adapter" object and now will receive an object implementing "AdapterInterface"

@weierophinney
Member

@Maks3w Actually, the changes are fine.

  • In cases where he's hinting now on AdapterInterface, these are actually now more lenient, which means no BC break. Since Adapter implements AdapterInterface, all previous use cases work -- since before, you'd need to extend Adapter to fulfill the signature anyways.
  • All other signature changes are happening on protected methods -- and we do not protect BC on protected members.

This looks clean.

That said, because it introduces a new interface, it needs to be marked for 2.1, @Slamdunk -- so that categorization by @Maks3w is correct.

@Slamdunk
Contributor

Do you prefer me to rebase to develop?

@Maks3w
Member
Maks3w commented Nov 16, 2012

Yes please

@weierophinney
Member

@Slamdunk shouldn't be a problem, actually; I'll merge shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment