teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

試してみたこと#2 を追加しました。

2020/02/14 12:06

投稿

taoyagi
taoyagi

スコア4

title CHANGED
File without changes
body CHANGED
@@ -43,12 +43,47 @@
43
43
  }
44
44
  ```
45
45
 
46
- ### 試したこと
46
+ ### 試したこと#1
47
47
 
48
48
  ログを出力するように、beforeSaveメソッド内にログを埋め込みました。
49
49
  (該当のソースコード#1)
50
50
  しかし、ログファイルにログが出力されていませんでした。
51
51
 
52
+ ### 試したこと#2
53
+
54
+ $this->Articles をdebug関数にてログに出力しました。
55
+
56
+ ArticlesController.php
57
+ ```PHP
58
+ $this->log(debug($this->Articles));
59
+ if ($this->Articles->save($article)) {
60
+ ```
61
+
62
+ ログ
63
+ ```
64
+ 2020-02-14 11:46:32 Error: App\Model\Table\ArticlesTable Object
65
+ (
66
+ [registryAlias] => Articles
67
+ [table] => articles
68
+ [alias] => Articles
69
+ [entityClass] => App\Model\Entity\Article
70
+ [associations] => Array
71
+ (
72
+ [0] => users
73
+ [1] => tags
74
+ [2] => articlestags
75
+ )
76
+
77
+ [behaviors] => Array
78
+ (
79
+ [0] => Timestamp
80
+ )
81
+
82
+ [defaultConnection] => default
83
+ [connectionName] => default
84
+ )
85
+ ```
86
+
52
87
  ### 補足情報
53
88
 
54
89
  【バージョン情報】