Zend Framework: reusing the WHERE clause returned from Zend_Db_Select :: getPart ()

I have a SELECT object containing WHERE.

I can return WHERE with getPart(Zend_Db_Select::WHERE), this returns something like this:

array
    0 => string "(clienttype = 'agent')"
    1 => string "AND (nextpayment < (NOW() - INTERVAL 1 DAY))"

This array seems pretty useless since I can't do this with it

$client->update(array("paymentstatus" => "lapsed"), $where);

Or even put it in another SELECT object. Is there a way to get a more useful representation of the WHERE statement from a SELECT object?

thank

EDIT

The best I've come up with so far is

$where = new Zend_Db_Expr(implode(" ", $select->getPart(Zend_Db_Select::WHERE)));
+3
source share
1 answer

, $client->update(...) , getParts "AND" where.

, :

  • (, , where) - -
  • $ "AND", "OR", .
+1

Source: https://habr.com/ru/post/1778723/


All Articles