1
擁有User和UserProfile模型。用戶模型與UserProfile有一個關聯。 UserProfile mysql表是空的。當我做$ this-> User-> find('all',array('contains'=> array('UserProfile'))),而不是一個空的UserProfile數組時,我會得到一個數組字段對應架構:CakePHP hasOne關聯返回空字段數組,用於不存在的記錄
Array ( [0] => Array ( [User] => Array ( [id] => 1 [firstname] => Joe [surname] => Bloggs [email] => [email protected] [password] => $2a$10$re4r7AXWQcXgkKcabUqmtO6j.7p2bA1t2SLeG93eVsiDPBgGaeXRS [enabled] => 1 [user_group_id] => 1 [created] => 2014-06-26 15:01:38 [modified] => 2014-06-26 15:01:38 ) [UserProfile] => Array ( [id] => [job_title] => [user_id] => [enabled] => [created] => [modified] => ) )
任何人都看到了這一點,並知道如何解決它?
謝謝馬修。 – Progredi