{"id":45,"date":"2018-08-20T14:15:04","date_gmt":"2018-08-20T14:15:04","guid":{"rendered":"https:\/\/dapliw.wordpress.com\/?p=45"},"modified":"2018-08-20T14:15:04","modified_gmt":"2018-08-20T14:15:04","slug":"cakephp-3-pasar-un-array-de-opciones-a-una-consulta-de-la-base-de-datos","status":"publish","type":"post","link":"https:\/\/saemas.com\/sitio_web\/cakephp-3-pasar-un-array-de-opciones-a-una-consulta-de-la-base-de-datos\/","title":{"rendered":"Cakephp 3 &#8211; Pasar un array de opciones a una consulta de la base de datos"},"content":{"rendered":"<p>En el controlador, cuando se llama a la funci\u00f3n de consulta se agrega el array. Ejemplo:<\/p>\n<pre>$query = $employeepayments-&gt;find('payroll', ['idPaysheet' =&gt; $idPaysheet]);<\/pre>\n<p>Y en table:<\/p>\n<pre>public function findPayroll(Query $query, array $options)\n{\n   $query\n   -&gt;where([['paysheet_id' =&gt; $options['idPaysheet']];\n\n   return $query;\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>En el controlador, cuando se llama a la funci\u00f3n de consulta se agrega el array. Ejemplo: $query = $employeepayments-&gt;find(&#8216;payroll&#8217;, [&#8216;idPaysheet&#8217; =&gt; $idPaysheet]); Y en table: public function findPayroll(Query $query, array $options) { $query -&gt;where([[&#8216;paysheet_id&#8217; =&gt; $options[&#8216;idPaysheet&#8217;]]; return $query; }<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"material-hide-sections":[],"footnotes":""},"categories":[11],"tags":[12],"class_list":["post-45","post","type-post","status-publish","format-standard","hentry","category-cakephp","tag-cakephp"],"_links":{"self":[{"href":"https:\/\/saemas.com\/sitio_web\/wp-json\/wp\/v2\/posts\/45","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/saemas.com\/sitio_web\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/saemas.com\/sitio_web\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/saemas.com\/sitio_web\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/saemas.com\/sitio_web\/wp-json\/wp\/v2\/comments?post=45"}],"version-history":[{"count":0,"href":"https:\/\/saemas.com\/sitio_web\/wp-json\/wp\/v2\/posts\/45\/revisions"}],"wp:attachment":[{"href":"https:\/\/saemas.com\/sitio_web\/wp-json\/wp\/v2\/media?parent=45"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/saemas.com\/sitio_web\/wp-json\/wp\/v2\/categories?post=45"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/saemas.com\/sitio_web\/wp-json\/wp\/v2\/tags?post=45"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}