Fluid style/chained select() statement in Zend Framework yields warning

I noticed that when I construct a chained call to generate a query using Zend_Db, the IDE seems to improperly detect a wrong class type being passed to the next function.

For example:

        $select = $this->select(); // this is detected as Zend_Db_Table_Select
        $select->where('orientation = ?', $orientation) // function inherited from Zend_Db_Select
                ->limit($count) // function inherited from Zend_Db_Select
                ->order('activity_id DESC'); // function inherited from Zend_Db_Select
        return $this->fetchAll($select); // inherited from Zend_Db_Table

works fine, and everything checks out (no warnings or errors).

However, I get a type warning with the following:

        $select = $this->select() // function defined in Zend_Db_Table_Select
                 ->where('orientation = ?', $orientation) // function inherited from Zend_Db_Select
                 ->limit($count) // function inherited from Zend_Db_Select
                 ->order('activity_id DESC'); // function inherited from Zend_Db_Select
         return $this->fetchAll($select);

It appears that WI is checking the subsequent chained calls for return value when it is the $this->select() object that should be referenced. Note that Zend_Db_Table_Select extends Zend_Db_Select.

Is this a bug?

4 comments

Please provide the signature of class referenced by $this and the version of ZendFramework you are using, so we can reproduce your case for investigation.

0

Here's the basic class definition using Zend Framework 1.10

<?php

class Application_Model_Resources_Activity extends Zend_Db_Table_Abstract
{
    /**
     * The default table name
     */
    protected $_name = 'activity';
    protected $_primary = 'activityId';

    public function getActivityByLatest($count, $orientation = 'S')
    {
        $select = $this->select()->where('orientation = ?', $orientation)
                ->limit($count)
                ->order('activityId DESC');
        return $this->fetchAll($select); // this is where warning occurs underlining $select
    }
}

0

Thanks for complete code. I was able to reproduce this on WI-94.149 but my current sources work correctly. Next EAP build will be published in 2-3 of days.

0

Terrific, can't wait for the build.

0

Please sign in to leave a comment.