CakePHP1.3ããã¯ãVirtualFieldsãå©ç¨ã§ããã ããã¯SQL ã§ãã£ãã sql_function(hoge) as aliasã¨ãã£ãcolmunããã®ã¾ã¾ãã£ã¼ã«ãã¨ãã¦å©ç¨ã§ããæ©è½ã ã ããã§ã¯å®ä¾ã追ããªããé 次説æãã¦ãããã è¦æ±ï¼ ã°ã«ã¼ãã®ä¸è¦§ã表示ãããã ã¾ããã°ã«ã¼ãã«ã¯ä½äººåå ãã¦ããããéè¨ãã¦åæã«è¡¨ç¤ºããã é¢ä¿ Group hasAndBelongsToMany User Model <?php class Group extends AppModel { var $name = 'Group'; var $virtualFields = array( 'user_count' => 'count(GroupsUser.user_id)', ); var $hasAndBelongsToMany = array( 'User', );
{{#tags}}- {{label}}
{{/tags}}