cakePHP get self hasMany array

Posted by openprojdevel on Stack Overflow See other posts from Stack Overflow or by openprojdevel
Published on 2010-06-08T06:32:33Z Indexed on 2010/06/08 7:32 UTC
Read the original article Hit count: 249

Filed under:

I have an table with fields like:
empid,empname,empcode,department_id ...


I need an array like
[Model]
-------[department_id 1]
--------------[0]
--------------------[empid]
--------------------[empname]
--------------------[empcode]

--------------[1]
--------------------[empid]
--------------------[empname]
--------------------[empcode]

--------------[2]
--------------------[empid]
--------------------[empname]
--------------------[empcode]


-------[department_id 2]
--------------[0]
--------------------[empid]
--------------------[empname]
--------------------[empcode]

--------------[1]
--------------------[empid]
--------------------[empname]
--------------------[empcode]

--------------[2]
--------------------[empid]
--------------------[empname]
--------------------[empcode]

-------[department_id 3]
--------------[0]
--------------------[empid]
--------------------[empname]
--------------------[empcode]

--------------[1]
--------------------[empid]
--------------------[empname]
--------------------[empcode]


Regards,

© Stack Overflow or respective owner

Related posts about cakephp