# App.php -\> public static function className

**URL:** <https://discourse.cakephp.org/t/app-php-public-static-function-classname/6430>\
**Category:** Need Help\
**Created:** [July 29, 2019, 3:49pm UTC](https://discourse.cakephp.org/t/app-php-public-static-function-classname/6430 "2019-07-29T15:49:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![danger2k7](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/danger2k7/32/46_2.png) [@danger2k7](https://discourse.cakephp.org/u/danger2k7)\
**Post date:** [July 29, 2019, 3:49pm UTC](https://discourse.cakephp.org/t/app-php-public-static-function-classname/6430/1 "2019-07-29T15:49:51Z")

</div>

Hi there,

I’m a bit stuck and would like to see anyone has a solution for me.

I have a CakePHP 3 (3.8) application, which contains several plugins that act each one as an “application”.  
I have a lot of common code that reside in src (common Controllers, Models, etc).

What I want to achieve ism if a controller does not exist in the plugin, the controller from src should be used.  
The problem is the the function className() from App class, only searches within the plugin (if a plugin is set) or the Cake namespace.

Has anyone encountered this problem or anyone has an idea ?

Thank you !

---

<div class="post-metadata">

**Author:** ![Schlaefer](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/schlaefer/32/1001_2.png) [@Schlaefer](https://discourse.cakephp.org/u/Schlaefer)\
**Post date:** [July 29, 2019, 4:35pm UTC](https://discourse.cakephp.org/t/app-php-public-static-function-classname/6430/2 "2019-07-29T16:35:32Z")

</div>

I’m not sure if I grasp the setup and the arising issue completely. From what I understand you would set-up plugin-routes (pointing to existing plugin-controllers) and then a generic route which is handled by the main application which catches everything not caught by the plugin-routes?
