2017-11-08から1日間の記事一覧

CakePHP3: アソシエーションしているテーブルのデータを`extract`や`select`したい場合

こんな需要があるのかどうかわからないのですが、実験していて出来たので共有です 前提条件 データ 得たい結果 動くケース matchingとextractを使う場合 matchingとselectを使う場合 leftJoinWithとselectを使う場合 動かないケース containでextractもしく…

A function whose declared type is neither 'void' nor 'any' must return a value.

表題のエラーは、戻り値を指定している関数において何もreturnしなかった場合に発生します。 例: getHero(id: number): Promise<Hero> { this.getHeroes().then( promised_heroes => promised_heroes.find( hero => hero.id === id)); // returnが抜けている }</hero>