phinx icon indicating copy to clipboard operation
phinx copied to clipboard

Should not the quoteString method be public

Open hkwak opened this issue 5 years ago • 4 comments

https://github.com/cakephp/phinx/blob/877033d6e44d60f8ff149fa9f57f135a33fbbff6/src/Phinx/Db/Adapter/PdoAdapter.php#L283 Currently the quoteString method exists, but it is protected, making it impossible to use in migrations. Is there anything what stops it being public?

hkwak avatar Oct 12 '20 12:10 hkwak

Is there a use case for using it inside migrations? If so, we could do this.

dereuromark avatar Oct 16 '20 14:10 dereuromark

It could be useful if you were running your queries directly through execute() method on a Migration and want some capacity to quote stuff yourself for cross-DB usage, without having to use the full query builder?

MasterOdin avatar Oct 16 '20 19:10 MasterOdin

Any downsites of exposing the method?

dereuromark avatar Oct 16 '20 19:10 dereuromark

It'd have to go into the major version as it's an interface break? It's also like this is (for non-extended purposes) exposing anything you couldn't get by just doing $this->getAdapter()->getConnection()->quote() instead of $this->getAdapter()->quote() to get the same result.

quoteTable and quoteColumn are already public so can't see a reason not to do this here to be consistent. May also want to expose quoteValue for further consistency?

MasterOdin avatar Oct 16 '20 19:10 MasterOdin