Note that there are some explanatory texts on larger screens.

plurals
  1. POController action with params returns 404 not found
    text
    copied!<p>I'm using Yii and I have a Controller named <code>User</code> and some actions for CRUD-operations. I have added a new action as follows:</p> <pre><code>public function actionEmbedded($field, $action, $id){ /* code */ } </code></pre> <p>To access this action the url should be</p> <pre><code>/user/embedded/field/logins/action/view/id/5542ab0cb0db0ab000000001 </code></pre> <p>But this returns a <code>404 Not found error</code>. </p> <p><strong>However</strong> when I change one of the parameters to <code>$_id</code> instead of <code>$id</code> ...</p> <pre><code>public function actionEmbedded($field, $action, $_id){ /* code */ } </code></pre> <p>... it is possible to access the action just like expected</p> <pre><code>/user/embedded/field/logins/action/view/_id/5542ab0cb0db0ab000000001 </code></pre> <p>Any ideas why? Is any of my parameter names reserved? I do use the <code>$id</code> in other actions, if that might be a reason to this behaviour.</p> <p><strong>UPDATE:</strong> Here's the urlManager-code from my config.php file.</p> <pre><code> 'urlManager'=&gt;array( 'urlFormat'=&gt;'path', 'showScriptName'=&gt; false, 'rules'=&gt;array( // Handles differen API versions 'api/1.0/&lt;action:\w+&gt;/*' =&gt; 'api_1_0_/&lt;action&gt;', array('api_1_1_/&lt;action&gt;', 'pattern'=&gt;'api/1.1/&lt;action:\w+&gt;', 'verb' =&gt; 'GET'), //array('api_1_1_/Post&lt;action&gt;', 'pattern'=&gt;'api/1.1/&lt;action:\w+&gt;/*', 'verb' =&gt; 'POST'), // User specific API calls (starts with users/me) array('api_1_1_/prices', 'pattern'=&gt;'api/1.1/prices/&lt;market:\w+&gt;/&lt;biddingArea:\w+&gt;/hour/&lt;period:\w+&gt;', 'verb' =&gt; 'GET'), array('api_1_1_/view/model/users/id/me', 'pattern'=&gt;'api/1.1/users/me', 'verb' =&gt; 'GET'), array('api_1_1_/listEmbeddedArray/model/users/id/me/array/contracts', 'pattern'=&gt;'api/1.1/users/me/meters', 'verb' =&gt; 'GET'), array('api_1_1_/view/model/units/id/&lt;id&gt;', 'pattern'=&gt;'api/1.1/users/me/meters/&lt;id:\w+&gt;', 'verb' =&gt; 'GET'), //array('api_1_1_/viewEmbeddedArray/model/users/id/me/array/contracts/ean/&lt;ean&gt;', 'pattern'=&gt;'api/1.1/users/me/meters/&lt;source:\w+&gt;/&lt;ean:\w+&gt;', 'verb' =&gt; 'GET'), //array('api_1_1_/series', 'pattern'=&gt;'api/1.1/users/me/meters/&lt;source:\w+&gt;/&lt;ean:\w+&gt;/series/&lt;query:\w+&gt;', 'verb' =&gt; 'GET'), //array('api_1_1_/series/source/&lt;source&gt;/ean/&lt;ean&gt;/resolution/&lt;resolution&gt;/query&lt;query&gt;', 'pattern'=&gt;'api/1.1/users/me/meters/&lt;source:\w+&gt;/&lt;ean:\w+&gt;/series/&lt;resolution:\w+&gt;/&lt;query:\w+&gt;', 'verb' =&gt; 'GET'), //array('api_1_1_/view/model/unit/id/&lt;id&gt;', 'pattern'=&gt;'api/1.1/users/me/meters/&lt;id:\w+&gt;', 'verb' =&gt; 'GET'), array('api_1_1_/series/id/&lt;id&gt;', 'pattern'=&gt;'api/1.1/users/me/series/&lt;id:\w+&gt;', 'verb' =&gt; 'GET'), array('api_1_1_/list', 'pattern'=&gt;'api/1.1/users/me/&lt;model:\w+&gt;', 'verb' =&gt; 'GET'), array('api_1_1_/view', 'pattern'=&gt;'api/1.1/users/me/&lt;model:\w+&gt;/&lt;id:\w+&gt;', 'verb' =&gt; 'GET'), array('api_1_1_/delete', 'pattern'=&gt;'api/1.1/users/me/&lt;model:\w+&gt;/&lt;id:\w+&gt;', 'verb' =&gt; 'DELETE'), // General API calls array('api_1_1_/download', 'pattern'=&gt;'api/1.1/download/&lt;model:\w+&gt;', 'verb' =&gt; 'GET'), array('api_1_1_/series', 'pattern'=&gt;'api/1.1/&lt;model:\w+&gt;/&lt;id:\w+&gt;/series', 'verb' =&gt; 'GET'), array('api_1_1_/listEmbeddedArray', 'pattern'=&gt;'api/1.1/&lt;model:\w+&gt;/&lt;id:\w+&gt;/&lt;array:\w+&gt;', 'verb' =&gt; 'GET'), array('api_1_1_/updateEmbeddedArray', 'pattern'=&gt;'api/1.1/&lt;model:\w+&gt;/&lt;id:\w+&gt;/&lt;array:\w+&gt;/&lt;ean:\w+&gt;', 'verb' =&gt; 'PUT'), array('api_1_1_/deleteEmbeddedArray', 'pattern'=&gt;'api/1.1/&lt;model:\w+&gt;/&lt;id:\w+&gt;/&lt;array:\w+&gt;/&lt;ean:\w+&gt;', 'verb' =&gt; 'DELETE'), array('api_1_1_/viewEmbeddedArray', 'pattern'=&gt;'api/1.1/&lt;model:\w+&gt;/&lt;id:\w+&gt;/&lt;array:\w+&gt;/&lt;ean:\w+&gt;', 'verb' =&gt; 'GET'), array('api_1_1_/createEmbeddedArray', 'pattern'=&gt;'api/1.1/&lt;model:\w+&gt;/&lt;id:\w+&gt;/&lt;array:\w+&gt;', 'verb' =&gt; 'POST'), array('api_1_1_/list', 'pattern'=&gt;'api/1.1/&lt;model:\w+&gt;', 'verb' =&gt; 'GET'), array('api_1_1_/view', 'pattern'=&gt;'api/1.1/&lt;model:\w+&gt;/&lt;id:\w+&gt;', 'verb' =&gt; 'GET'), array('api_1_1_/update', 'pattern'=&gt;'api/1.1/&lt;model:\w+&gt;/&lt;id:\w+&gt;', 'verb' =&gt; 'PUT'), array('api_1_1_/delete', 'pattern'=&gt;'api/1.1/&lt;model:\w+&gt;/&lt;id:\w+&gt;', 'verb' =&gt; 'DELETE'), array('api_1_1_/create', 'pattern'=&gt;'api/1.1/&lt;model:\w+&gt;', 'verb' =&gt; 'POST'), ), ), </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload