CakePHP3ã®findçµæã¯debugé¢æ°ã§è¦ãã¨è¯ã
CakePHP3ã触ãå§ãã¦ãã¾ããCake3ããfind()ã®çµæããªãã¸ã§ã¯ãã«ãªãã¾ããã
Cake2ã¾ã§ã¯é
åã ã£ãã®ã§pré¢æ°ã§è¦ã¦ãåé¡ãªãã£ãã®ã§ããããªãã¸ã§ã¯ãã«ãªãã¨prã¯è¾ããªãã¾ãã
CakePHP3ããã¯debugé¢æ°ã使ãã¨ä¸è¨ã®ããã«ãªã¬ã¼ã·ã§ã³å ã®ãã¼ã¿ã確èªã§ããããã«ãªãã¾ããdebugé¢æ°ã¯cakephpãæ¨æºã§ç¨æãã¦ããã°ãã¼ãã«é¢æ°ã§ããCakePHP2ã«ãããã¾ãã
debug( $this->Users->find()->contain(['Bookmarks'])->all() );
Users hasMany Bookmarksã®ç¶æ
ã§findããã¨ãä¸è¨ã®ãããªãã¼ã¿ãdebug()ãéãã¦ç¢ºèªã§ãã¾ãã
Usersãªãã¸ã§ã¯ãã®ä¸ã«itemsãã£ã¼ã«ããããããã®ä¸èº«ãä¸è¨ã«ãªãã¾ãã
ãªã¬ã¼ã·ã§ã³å
ã®ã¨ã³ãã£ãã£ãªãã¸ã§ã¯ããbookmarksãã£ã¼ã«ãã«å
¥ã£ã¦ãã¦ããã®å¤ã確èªã§ãã¾ãã
(int) 0 => object(App\Model\Entity\User) { 'properties' => [ 'id' => (int) 1, 'email' => '[email protected]', 'password' => 'xxxx', 'created' => object(Cake\I18n\Time) { 'time' => '2014-12-23T06:48:20+0000', 'timezone' => 'UTC', 'fixedNowTime' => false }, 'updated' => null, 'bookmarks' => [ (int) 0 => object(App\Model\Entity\Bookmark) { 'properties' => [ 'id' => (int) 1, 'user_id' => (int) 1, 'title' => 'aaa', 'description' => 'aaa', 'url' => '', 'created' => object(Cake\I18n\Time) { 'time' => '2014-12-23T07:11:21+0000', 'timezone' => 'UTC', 'fixedNowTime' => false }, 'updated' => null ], 'dirty' => [], 'original' => [], 'virtual' => [], 'errors' => [], 'repository' => 'Bookmarks' } ] ],
Debugç¨ã®ã¯ã©ã¹(Cake\Error\Debugger)ãªã©ä»ã«ãç¨æããã¦ãã¦ãããã¥ã¡ã³ããä¸è¨ã«ããã¾ãã
http://book.cakephp.org/3.0/en/development/debugging.html