File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -208,7 +208,7 @@ Possible values are:
208208The [ include names] ( http://fractal.thephpleague.com/transformers/#including-data ) that should be included for the current request, if any.
209209
210210``` php
211- 'includes' => craft() ->request->getQuery ('include'),
211+ 'includes' => Craft::$app ->request->getQueryParam ('include'),
212212```
213213
214214Note that this setting requires a custom transformer class that’s prepped to handle includes:
@@ -218,9 +218,9 @@ class MyTransformerClassName extends TransformerAbstract
218218{
219219 protected $availableIncludes = ['author'];
220220
221- public function includeAuthor(EntryModel $entry)
221+ public function includeAuthor(Entry $entry)
222222 {
223- return $this->item($entry->author, function(UserModel $author) {
223+ return $this->item($entry->author, function(User $author) {
224224 return [
225225 'id' => $author->id,
226226 'name' => $author->name,
Original file line number Diff line number Diff line change @@ -129,6 +129,13 @@ public function actionIndex(string $pattern)
129129 }
130130
131131 $ fractal ->setSerializer ($ serializer );
132+
133+ // Set the includes
134+ $ fractal ->parseIncludes ($ config ['includes ' ] ?? []);
135+
136+ // Set the excludes
137+ $ fractal ->parseExcludes ($ config ['excludes ' ] ?? []);
138+
132139 $ data = $ fractal ->createData ($ resource );
133140
134141 // Fire a 'beforeSendData' event
You can’t perform that action at this time.
0 commit comments