CodeIgniter Forums
Documentation error | Limit the Routes Made - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forum-30.html)
+--- Thread: Documentation error | Limit the Routes Made (/thread-76174.html)



Documentation error | Limit the Routes Made - MatheusCastro - 04-18-2020

Hello, where can i report errors in the documentation?

In topic Limit the Routes MadeĀ on the link:
https://codeigniter.com/user_guide/incoming/restful.html#limit-the-routes-made

PHP Code:
$routes->resource('photos', ['except' => 'new,edit']); 

I believe it should be:

PHP Code:
$routes->resource('photos', ['except' => ['new''edit']]); 

I performed a test and it is not working as in the documentation, changing only the code above.

Or am I mistaken?


RE: Documentation error | Limit the Routes Made - jreklund - 04-19-2020

According to the documentation both of those options should be viable. So they bug would be why , dosen't work.
You can open an Issue at our Github page, if there aren't any of that specific topic already.

https://github.com/codeigniter4/CodeIgniter4/issues


RE: Documentation error | Limit the Routes Made - MatheusCastro - 04-19-2020

(04-19-2020, 06:26 AM)jreklund Wrote: According to the documentation both of those options should be viable. So they bug would be why , dosen't work.
You can open an Issue at our Github page, if there aren't any of that specific topic already.

https://github.com/codeigniter4/CodeIgniter4/issues

Hello, jreklund

The problem was this:

PHP Code:
$routes->resource('photos', ['only' => 'index, show']); 

The space between items in the string

Do you think it would be interesting to prevent this? Or better leave it as is?


RE: Documentation error | Limit the Routes Made - jreklund - 04-19-2020

Hi MatheusCastro,

Personally I would not classify this as a bug, as many of our function require you to have no space between a comma separated list (if matched with an absolute value). Or | separated list.

We don't know if you wanted that space there to begin with. :-)

It can technically be fixed by trimming white space characters. Personally I don't know why we even support that, in that function. The only place I can see the use are in the validation, as you pass it along as an complete string. I don't see why this weren't just designed to accept an array as it's a complete new function, not a legacy one.