# How load model in another model in beforeSave() function?

**URL:** <https://discourse.cakephp.org/t/how-load-model-in-another-model-in-beforesave-function/1559>\
**Category:** Need Help\
**Created:** [November 17, 2016, 10:48am UTC](https://discourse.cakephp.org/t/how-load-model-in-another-model-in-beforesave-function/1559 "2016-11-17T10:48:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SATHISH](https://avatars.discourse-cdn.com/v4/letter/s/858c86/32.png) [@SATHISH](https://discourse.cakephp.org/u/SATHISH)\
**Post date:** [November 17, 2016, 10:48am UTC](https://discourse.cakephp.org/t/how-load-model-in-another-model-in-beforesave-function/1559/1 "2016-11-17T10:48:09Z")

</div>

How to load another model in beforeSave() function ?

---

<div class="post-metadata">

**Author:** ![rrd](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/rrd/32/113_2.png) [@rrd](https://discourse.cakephp.org/u/rrd)\
**Post date:** [November 17, 2016, 11:26am UTC](https://discourse.cakephp.org/t/how-load-model-in-another-model-in-beforesave-function/1559/2 "2016-11-17T11:26:41Z")

</div>

If it is an associated model you can access it as normal. Otherwise you break MVC if you want to load an other model.

---

<div class="post-metadata">

**Author:** ![zmurphy](https://avatars.discourse-cdn.com/v4/letter/z/cc9497/32.png) [@zmurphy](https://discourse.cakephp.org/u/zmurphy)\
**Post date:** [November 17, 2016, 1:31pm UTC](https://discourse.cakephp.org/t/how-load-model-in-another-model-in-beforesave-function/1559/3 "2016-11-17T13:31:52Z")

</div>

As pointed out, it breaks MVC, but if you really need to without associations, use the TableRegistry:  
[http://book.cakephp.org/3.0/en/orm/table-objects.html#getting-instances-of-a-table-class](http://book.cakephp.org/3.0/en/orm/table-objects.html#getting-instances-of-a-table-class)
