@@ -51,13 +51,13 @@ Once enabled, the following services may be injected into your controller action
5151use MixerApi\Crud\Interfaces\{CreateInterface, ReadInterface, UpdateInterface, DeleteInterface, SearchInterface};
5252```
5353
54- | Interface | Injected Service | Use-cases |
55- | ------------- | ------------- | ------------- |
56- | CreateInterface | MixerApi\Crud\Service\Create | ` add() ` actions |
57- | ReadInterface | MixerApi\Crud\Service\Read | ` view() ` actions |
58- | UpdateInterface | MixerApi\Crud\Service\Update | ` edit() ` actions |
54+ | Interface | Injected Service | Use-cases |
55+ | ----------------- | ------------------------------ | -------------------- |
56+ | CreateInterface | MixerApi\Crud\Service\Create | ` add() ` actions |
57+ | ReadInterface | MixerApi\Crud\Service\Read | ` view() ` actions |
58+ | UpdateInterface | MixerApi\Crud\Service\Update | ` edit() ` actions |
5959| DeleteInterface | MixerApi\Crud\Service\Delete | ` delete() ` actions |
60- | SearchInterface | MixerApi\Crud\Service\Search | ` index() ` actions |
60+ | SearchInterface | MixerApi\Crud\Service\Search | ` index() ` actions |
6161
6262All Crud services infer the table name from the controller, you can change the table name by calling the
6363` setTableName($name) ` method.
@@ -76,6 +76,16 @@ public function add(CreateInterface $create)
7676}
7777```
7878
79+ Note, ` save() ` with ` $options ` is supported.
80+
81+ ``` php
82+ return $create->save($this, [
83+ 'accessibleFields' => [
84+ 'password' => true,
85+ ]
86+ ]);
87+ ```
88+
7989### Read
8090
8191``` php
@@ -85,13 +95,18 @@ public function view(ReadInteface $read)
8595}
8696```
8797
98+ Note, ` read() ` with ` $options ` is supported.
99+
100+ ``` php
101+ return $read->save($this, ['contains' => ['OtherTable']]);
102+ ```
103+
88104Return a CakePHP ` Query ` object instead:
89105
90106``` php
91107$query = $read->query($this)
92108```
93109
94-
95110### Update
96111
97112``` php
@@ -101,6 +116,16 @@ public function edit(UpdateInterface $update)
101116}
102117```
103118
119+ Note, ` update() ` with ` $options ` is supported.
120+
121+ ``` php
122+ return $update->save($this, [
123+ 'accessibleFields' => [
124+ 'password' => true,
125+ ]
126+ ]);
127+ ```
128+
104129### Delete
105130
106131``` php
@@ -110,6 +135,12 @@ public function delete(DeleteInterface $delete)
110135}
111136```
112137
138+ Note, ` delete() ` with ` $options ` is supported.
139+
140+ ``` php
141+ return $delete->delete($this, ['atomic' => false]);
142+ ```
143+
113144### Search
114145
115146The Search service works with [ Pagination] ( https://book.cakephp.org/4/en/controllers/components/pagination.html ) and
@@ -153,13 +184,13 @@ operations and will not run for non-crud operations. See [Options](#plugin-optio
153184Allowed methods is handled by a ` Controller.initialize ` listener. See [ Plugin Options] ( #plugin-options ) for disabling or
154185modifying the defaults.
155186
156- | Action | HTTP method(s) |
157- | ------------- | ------------- |
158- | index() | GET |
159- | view() | GET |
160- | add() | POST |
161- | edit() | POST, PUT, and PATCH |
162- | delete() | DELETE |
187+ | Action | HTTP method(s) |
188+ | ----------| ---------------------- |
189+ | index() | GET |
190+ | view() | GET |
191+ | add() | POST |
192+ | edit() | POST, PUT, and PATCH |
193+ | delete() | DELETE |
163194
164195You may also call ` setAllowMethods($methods) ` on any service to overwrite the default behavior. This accepts a string
165196or any array as an argument just like the native ` $request->allowedMethods() ` .
0 commit comments