@@ -57,7 +57,7 @@ Overview
5757
5858The ElasticSearch plugin makes it easier to interact with an elasticsearch index
5959and provides an interface similar to the `ORM
60- <https://book.cakephp.org/3 /en/orm.html> `__. To get started you should
60+ <https://book.cakephp.org/5 /en/orm.html> `__. To get started you should
6161create an ``Index `` object. ``Index `` objects are the "Repository" or table-like
6262class in elasticsearch::
6363
@@ -72,11 +72,11 @@ class in elasticsearch::
7272
7373You can then use your index class in your controllers::
7474
75- public function beforeFilter(Event $event)
75+ public function beforeFilter(\Cake\ Event\EventInterface $event): void
7676 {
7777 parent::beforeFilter($event);
78- // Load the Index using the 'Elastic' provider .
79- $this->loadModel(' Articles', 'Elastic ');
78+ // Load the Index using the IndexLocator .
79+ $this->Articles = $this->fetchIndex('Articles ');
8080 }
8181
8282 public function add()
@@ -93,7 +93,7 @@ You can then use your index class in your controllers::
9393
9494We would also need to create a basic view for our indexed articles::
9595
96- // in src/Template/ Articles/add.ctp
96+ // in templates/ Articles/add.php
9797 <?= $this->Form->create($article) ?>
9898 <?= $this->Form->control('title') ?>
9999 <?= $this->Form->control('body') ?>
@@ -122,7 +122,7 @@ plugin::
122122Outside of constructor logic that makes Documents work with data from
123123elasticsearch, the interface and functionality provided by ``Document `` are the
124124same as those in `Entities
125- <https://book.cakephp.org/3.0 /en/orm/entities.html> `__
125+ <https://book.cakephp.org/5 /en/orm/entities.html> `__
126126
127127Searching Indexed Documents
128128===========================
@@ -163,9 +163,9 @@ Validating Data & Using Application Rules
163163Like the ORM, the ElasticSearch plugin lets you validate data when marshalling
164164documents. Validating request data, and applying application rules works the
165165same as it does with the relational ORM. See the `validating request data
166- <https://book.cakephp.org/3.0 /en/orm/validation.html#validating-data-before-building-entities> `__
166+ <https://book.cakephp.org/5 /en/orm/validation.html#validating-data-before-building-entities> `__
167167and `Application Rules
168- <https://book.cakephp.org/3.0 /en/orm/validation.html#applying-application-rules> `__
168+ <https://book.cakephp.org/5 /en/orm/validation.html#applying-application-rules> `__
169169sections for more information.
170170
171171.. Need information on nested validators.
@@ -255,7 +255,7 @@ use ``embedOne`` and ``embedMany`` to define embedded documents::
255255
256256 class ArticlesIndex extends Index
257257 {
258- public function initialize()
258+ public function initialize(): void
259259 {
260260 $this->embedOne('User');
261261 $this->embedMany('Comments', [
@@ -293,7 +293,8 @@ index use which connections. This is the ``defaultConnectionName()`` method::
293293
294294 class ArticlesIndex extends Index
295295 {
296- public static function defaultConnectionName() {
296+ public static function defaultConnectionName(): string
297+ {
297298 return 'replica_db';
298299 }
299300 }
@@ -412,9 +413,6 @@ following::
412413 ];
413414 }
414415
415- .. versionchanged :: 3.4.0
416- Prior to CakePHP 4.3.0 schema was defined on each fixture in the ``$schema ``
417- property.
418416
419417
420418Once your fixtures are created you can use them in your test cases by including
0 commit comments