In Zend Framework 1 there is a quoteinto method for database adapter that can be used to quote sql statements.
I would like to know its equivalent in Zend Framework 2?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Unfortunately, the
quoteInto()method was removed with the introduction of the newZend\Dbin ZF 2.0. And there is no equivalent that has exactly the same behaviour.In ZF2 there is the
quoteValue()method. This method takes one value as a parameter, and then quotes the value so you can safely put it into an SQL query as a value.However, you could use
quoteValue()to replicate the behaviour of the ZF1quoteInto()method. You could simply take the code of thequoteInto()method from ZF1, and apply thequoteValue()method from the platform object in ZF2 to it:There are some differences. ZF1 has a
$typeparameter, but because of the way ZF2 works with these things, the type parameter doesn’t make much sense. And there is a$platformparameter, because this method has a dependency on the platform for thequoteValue()method.