# CakePHP3 Controller without a model

**URL:** <https://discourse.cakephp.org/t/cakephp3-controller-without-a-model/3231>\
**Category:** Uncategorized\
**Created:** [September 19, 2017, 4:40am UTC](https://discourse.cakephp.org/t/cakephp3-controller-without-a-model/3231 "2017-09-19T04:40:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kasemo](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/kasemo/32/811_2.png) [@Kasemo](https://discourse.cakephp.org/u/Kasemo)\
**Post date:** [September 19, 2017, 4:40am UTC](https://discourse.cakephp.org/t/cakephp3-controller-without-a-model/3231/1 "2017-09-19T04:40:40Z")

</div>

I noticed another user mentioned that they wanted to create a Model-less Controller, however there was not an answer on how-to. I’ve checked the book, I’ve checked all over , no dice. I could always create Views in the DB … but would rather get this done in Cake.

I’ve tried a variety of ways to accomplish this - but haven’t been successful. As for my “why” - I’d like to create indices/navigation elements that are independent of the model - or bring in data from elsewhere similar to a DB view.

Also, functionality that lives outside of the regular site would be implemented this way ( eg: An API + AJAX handlers. )

Some of my database structure does not conveniently fit in a “package” that would make sense in with a (example) “Items” controller to represent it.

If this is possible simply by telling the model I want to work with “none” (preferably) or specify alternate default table(s) … that’s the goal.

---

<div class="post-metadata">

**Author:** ![raul338](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/raul338/32/69_2.png) [@raul338](https://discourse.cakephp.org/u/raul338)\
**Post date:** [September 19, 2017, 2:42pm UTC](https://discourse.cakephp.org/t/cakephp3-controller-without-a-model/3231/2 "2017-09-19T14:42:44Z")

</div>

You can send a empty response with [withStringBody](https://book.cakephp.org/3.0/en/controllers/request-response.html#setting-the-body) sending an empty string.  
Or you can use Json Views if you want generate a view from certain variables

---

<div class="post-metadata">

**Author:** ![Kasemo](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/kasemo/32/811_2.png) [@Kasemo](https://discourse.cakephp.org/u/Kasemo)\
**Post date:** [September 19, 2017, 3:07pm UTC](https://discourse.cakephp.org/t/cakephp3-controller-without-a-model/3231/3 "2017-09-19T15:07:51Z")

</div>

Sorry about that ; my title said view but should have said model like the text.

When I refer to “view” in my message, I’m referring to virtual tables in the rdbms.
