From 587daff6333ea0401213fc5f5581f3b6ce5f0865 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Pustu=C5=82ka?= Date: Fri, 21 Jul 2017 14:29:23 +0200 Subject: [PATCH] Remove TableRegistry mentions and examples. --- src/ORM/README.md | 10 +++++----- src/ORM/Table.php | 4 ++-- src/View/Form/EntityContext.php | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ORM/README.md b/src/ORM/README.md index 25bfb85621a..bea6e97d88c 100644 --- a/src/ORM/README.md +++ b/src/ORM/README.md @@ -58,9 +58,9 @@ complete examples. Once you've defined some table classes you can read existing data in your tables: ```php -use Cake\ORM\TableRegistry; +use Cake\ORM\Locator\LocatorAwareTrait; -$articles = TableRegistry::get('Articles'); +$articles = $this->getTableLocator()->get('Articles'); foreach ($articles->find() as $article) { echo $article->title; } @@ -76,7 +76,7 @@ Table objects provide ways to convert request data into entities, and then persi those entities to the database: ```php -use Cake\ORM\TableRegistry; +use Cake\ORM\Locator\LocatorAwareTrait; $data = [ 'title' => 'My first article', @@ -91,7 +91,7 @@ $data = [ ] ]; -$articles = TableRegistry::get('Articles'); +$articles = $this->getTableLocator()->get('Articles'); $article = $articles->newEntity($data, [ 'associated' => ['Tags', 'Comments'] ]); @@ -109,7 +109,7 @@ for more in-depth examples. Once you have a reference to an entity, you can use it to delete data: ```php -$articles = TableRegistry::get('Articles'); +$articles = $this->getTableLocator()->get('Articles'); $article = $articles->get(2); $articles->delete($article); ``` diff --git a/src/ORM/Table.php b/src/ORM/Table.php index dd35d789a99..da3254f1df5 100644 --- a/src/ORM/Table.php +++ b/src/ORM/Table.php @@ -297,10 +297,10 @@ public function __construct(array $config = []) * Get the default connection name. * * This method is used to get the fallback connection name if an - * instance is created through the TableRegistry without a connection. + * instance is created through the TableLocator without a connection. * * @return string - * @see \Cake\ORM\TableRegistry::get() + * @see \Cake\ORM\Locator\TableLocator::get() */ public static function defaultConnectionName() { diff --git a/src/View/Form/EntityContext.php b/src/View/Form/EntityContext.php index cafc718640f..555804657b3 100644 --- a/src/View/Form/EntityContext.php +++ b/src/View/Form/EntityContext.php @@ -112,7 +112,7 @@ public function __construct(ServerRequest $request, array $context) * Prepare some additional data from the context. * * If the table option was provided to the constructor and it - * was a string, ORM\TableRegistry will be used to get the correct table instance. + * was a string, TableLocator will be used to get the correct table instance. * * If an object is provided as the table option, it will be used as is. *