# Cakephp 4.x Function with underscore

**URL:** <https://discourse.cakephp.org/t/cakephp-4-x-function-with-underscore/9229>\
**Category:** Need Help\
**Created:** [April 13, 2021, 8:37am UTC](https://discourse.cakephp.org/t/cakephp-4-x-function-with-underscore/9229 "2021-04-13T08:37:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Johnshiva](https://avatars.discourse-cdn.com/v4/letter/j/e79b87/32.png) [@Johnshiva](https://discourse.cakephp.org/u/Johnshiva)\
**Post date:** [April 13, 2021, 8:37am UTC](https://discourse.cakephp.org/t/cakephp-4-x-function-with-underscore/9229/1 "2021-04-13T08:37:35Z")

</div>

Cakephp is automatically changing may function name .  
In first picture my function name is “customer\_logs\_\_index”.  
But in the second picture it becomes “customerLogsIndex”.  
How to avoid this sudden change in my function name ?

![image](https://canada1.discourse-cdn.com/flex029/uploads/cakephp/original/2X/2/25778e856ce6bc5c6d107d01d47a212026443707.png)

 ![image](https://canada1.discourse-cdn.com/flex029/uploads/cakephp/original/2X/1/155c51beed704a672d95d33e2f7d67ae14ad0c5b.png)

---

<div class="post-metadata">

**Author:** ![dirk](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/dirk/32/2174_2.png) [@dirk](https://discourse.cakephp.org/u/dirk)\
**Post date:** [April 13, 2021, 8:50am UTC](https://discourse.cakephp.org/t/cakephp-4-x-function-with-underscore/9229/2 "2021-04-13T08:50:09Z")

</div>

I think this is due to the Cake Conventions, described here:  
[https://book.cakephp.org/4/en/intro/conventions.html#view-conventions](https://book.cakephp.org/4/en/intro/conventions.html#view-conventions)

What maybe could help, if you want to keep the name of your controller action, is to define routes to the controller action.

---

<div class="post-metadata">

**Author:** ![Johnshiva](https://avatars.discourse-cdn.com/v4/letter/j/e79b87/32.png) [@Johnshiva](https://discourse.cakephp.org/u/Johnshiva)\
**Post date:** [April 14, 2021, 12:52am UTC](https://discourse.cakephp.org/t/cakephp-4-x-function-with-underscore/9229/3 "2021-04-14T00:52:55Z")

</div>

@dirk Thanks for the reference , this is exactly the problem i am trying to fix .  
Can you help me how can i disable the Cake convention for methods .

 ![image](https://canada1.discourse-cdn.com/flex029/uploads/cakephp/original/2X/4/45d7ab569cafba3140efb6bb52d50a4419d040df.png)

---

<div class="post-metadata">

**Author:** ![Jawfin](https://avatars.discourse-cdn.com/v4/letter/j/dbc845/32.png) [@Jawfin](https://discourse.cakephp.org/u/Jawfin)\
**Post date:** [April 14, 2021, 2:36am UTC](https://discourse.cakephp.org/t/cakephp-4-x-function-with-underscore/9229/4 "2021-04-14T02:36:21Z")

</div>

I don’t suppose conforming to the standard is an option?

There are many discussions between camel-case, double-humped camel-case (Pascal style), and underscore separated - but the answer is use the style that the language designers intended. There can be unexpected repercussions when not. For instance underscore has certain meanings in some languages, especially if your variable/procedure starts with one.

From looking at your example you have underscores in a URL, of which the world says: don’t! [google.com/search?q=underscore+in+url](http://google.com/search?q=underscore+in+url) Maybe using a dash if you must use anything - but I don’t know what Cake would do to that either!

---

<div class="post-metadata">

**Author:** ![Johnshiva](https://avatars.discourse-cdn.com/v4/letter/j/e79b87/32.png) [@Johnshiva](https://discourse.cakephp.org/u/Johnshiva)\
**Post date:** [April 14, 2021, 3:02am UTC](https://discourse.cakephp.org/t/cakephp-4-x-function-with-underscore/9229/5 "2021-04-14T03:02:42Z")

</div>

I guess i don’t have a choice but to follow the standard option . Thank you
