diff --git a/en/orm/saving-data.rst b/en/orm/saving-data.rst index 2e9165c847..8f7e501209 100644 --- a/en/orm/saving-data.rst +++ b/en/orm/saving-data.rst @@ -34,6 +34,17 @@ passing it to the ``save()`` method in the ``Table`` class:: // The $article entity contains the id now $id = $article->id; } + +If your model (eg. ArticlesTable.php) is in a plugin you may find that TableRegistry::get() still works but that your validation rules or other callbacks in ArticlesTable.php may not be triggering. This is because TableRegistry::get() builds a default model for the table. Here are some examples for TableRegistry::get() that you may want to use when your class is in a plugin:: + +Plugin example (same as above except):: + + $articlesTable = TableRegistry::get('PluginName.Articles'); + +Composer installed plugin example (same as above except):: + + $articlesTable = TableRegistry::get('VendorName/PluginName.Articles'); + Updating Data -------------