0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CakePHPのModelの自由定義メソッドについて

0
Posted at

短いですが。

CakePHPではModelに自由なメソッドを作ることができますよね。

例えば、取得したデータをちょっといじって取得する特殊なfindなんかを定義できます。

ですが、この前遭遇したエラーがこちら。。

Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '{method名}' at line 1

....は?

なんでsql流したことになってんの???

原因

これは気づきませんでした。

CakePHP2系では未定義のメソッドをコールすると自動でquery()に流れる

あ。。。。(察し

また知識が一つ増えました。

因みにmethod名が間違ってただけでしたw

baserの500エラーだと早いんですがデータベースエラーになるとviewのレンダリングクッソ遅いんですよね。。。。

ありがとうございました

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?