{"id":85,"date":"2012-04-17T16:44:55","date_gmt":"2012-04-17T07:44:55","guid":{"rendered":"http:\/\/tech.eshima.info\/?p=85"},"modified":"2012-04-17T17:09:43","modified_gmt":"2012-04-17T08:09:43","slug":"cakephp%e3%81%aeafterfind","status":"publish","type":"post","link":"https:\/\/tech.eshima.info\/?p=85","title":{"rendered":"cakePHP\u306eafterFind"},"content":{"rendered":"<p>find\u3067\u53d6\u5f97\u3059\u308b\u30c7\u30fc\u30bf\u306b\u8868\u793a\u7528\u306e\u30c6\u30ad\u30b9\u30c8\u306a\u3069\u4ed8\u3051\u305f\u3044\u5834\u5408\u306fModel\u3067afterFind\u3002<\/p>\n<pre lang=\"php\">\r\n\tpublic $options = array(\r\n\t\t'flag' => array(\r\n\t\t\t1 => '\u30ab\u30c6\u30b4\u30eaA',\r\n\t\t\t2 => '\u30ab\u30c6\u30b4\u30eaB',\r\n\t\t),\r\n\t);\r\n\tpublic function afterFind($results) {\r\n\t\tforeach ($results as $key => $val) {\r\n\t\t\tif (isset($results[$key]['User']) && is_array($results[$key]['User'])) {\r\n\t\t\t\t$val = $results[$key]['User']['flag'];\r\n\t\t\t\t$results[$key]['User']['flag'] = array();\r\n\t\t\t\t$results[$key]['User']['flag']['val'] = $val;\r\n\t\t\t\t$results[$key]['User']['flag']['str'] = $this->options['flag'][$val];\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn $results;\r\n\t}\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>find\u3067\u53d6\u5f97\u3059\u308b\u30c7\u30fc\u30bf\u306b\u8868\u793a\u7528\u306e\u30c6\u30ad\u30b9\u30c8\u306a\u3069\u4ed8\u3051 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-85","post","type-post","status-publish","format-standard","hentry","category-cakephp"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/tech.eshima.info\/index.php?rest_route=\/wp\/v2\/posts\/85","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tech.eshima.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tech.eshima.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tech.eshima.info\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/tech.eshima.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=85"}],"version-history":[{"count":6,"href":"https:\/\/tech.eshima.info\/index.php?rest_route=\/wp\/v2\/posts\/85\/revisions"}],"predecessor-version":[{"id":92,"href":"https:\/\/tech.eshima.info\/index.php?rest_route=\/wp\/v2\/posts\/85\/revisions\/92"}],"wp:attachment":[{"href":"https:\/\/tech.eshima.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=85"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tech.eshima.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=85"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tech.eshima.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=85"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}