Let me know what's wrong with this request in the zend framework

I have two user and asset tables, and the foreign key is user_id . I want users to drill down and count each user asset. Therefore, I wrote a request as shown below, but did not receive the record. Please help me.

$ users = $ this-> select ()
             -> from (array ('u' => 'users'),
                    array ('firstname'))
             -> joinLeft (array ('a' => 'assets'),
                    'u.id = a.user_id',
                    array ('asset_per_user' => 'COUNT (a.id)'))
             -> group ('u.id');        
+3
source share
3

'

, $this, , Zend_Db_Table . , Zend_Db_Table, ( Active Record ).

$users->setIntegrityCheck(false);

. SQL-, , .

+6
0

I faced the same problem. this is because you are connecting to a database table that is not associated with a specific table. Therefore, we need to disable the integrity check. You can view the detailed solution here .

-1
source

All Articles