Hi All,

I put together my application and I use TableGateway pattern based on
the tutorial. I got some help how to select data from the database if
there are multiple where conditions. It is quite good and easy when
you got the way how it works.

Unfortunately, I found something interesting:

I have this code in one of my tablegateway class:

public function selectWith($select = null) {

        $filter = new Predicate();
        $filter->like('category_name',"%dess%")
                ->OR
                ->like('category_desc', "%ks%");

        var_dump($this->tableGateway->select(function(Select $select)
use ($filter) {
            $select->where($filter);
        }));

        return $this->tableGateway->select(function(Select $select)
use ($filter) {
            $select->where($filter);
        });
    }

According to the dump the executed select is the following:

'SELECT `categories`.* FROM `categories` WHERE (`category_name` LIKE
:where1 OR `category_desc` LIKE :where2)'

But it should be this:

SELECT `categories`.* FROM `categories` WHERE (`category_name` LIKE
'%dess%' OR `category_desc` LIKE '%ks%')

The result is the same if I use Where instead of Predicate.

I use ZF 2.2.2.

Is this a known issue or I did something wrong?

Thanks for any help in advance!

András


-- 
--  Csanyi Andras (Sayusi Ando)  -- http://sayusi.hu --
http://facebook.com/andras.csanyi
--  ""Trust in God and keep your gunpowder dry!" - Cromwell

--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to