1 | <?php |
||
9 | class AssetsRepository |
||
10 | { |
||
11 | use Traits\EntryType; |
||
12 | |||
13 | /** |
||
14 | * Truncate all Assets related tables. |
||
15 | * |
||
16 | * @return void |
||
17 | */ |
||
18 | public function truncateRelatedTables() |
||
19 | { |
||
20 | Asset::query()->truncate(); |
||
21 | } |
||
22 | |||
23 | /** |
||
24 | * Map Contentful asset payload to an Eloquent one. |
||
25 | * |
||
26 | * @param array $asset |
||
27 | * @param \Illuminate\Support\Collection $locales |
||
28 | * @return void |
||
29 | */ |
||
30 | public function toContentfulModel(array $asset, Collection $locales) |
||
31 | { |
||
32 | $this->upsertEntryType($asset, 'asset'); |
||
33 | |||
34 | foreach ($locales as $locale) { |
||
35 | $this->upsertAsset($asset, $locale->code); |
||
36 | } |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * Delete asset with given Contentful ID. |
||
41 | * |
||
42 | * @param string $assetId |
||
43 | * @return void |
||
44 | */ |
||
45 | public function delete(string $assetId) |
||
51 | |||
52 | /** |
||
53 | * Return all locales in asset payload. |
||
54 | * |
||
55 | * @param array $asset |
||
56 | * @return array |
||
57 | */ |
||
58 | private function assetLocales(array $asset): array |
||
69 | |||
70 | /** |
||
71 | * Insert OR update given asset. |
||
72 | * |
||
73 | * @param array $asset |
||
74 | * @param string $locale |
||
75 | * @return \Distilleries\Contentful\Models\Asset |
||
76 | */ |
||
77 | private function upsertAsset(array $asset, string $locale): ?Asset |
||
108 | |||
109 | /** |
||
110 | * Map a Contentful asset to it's Eloquent model signature. |
||
111 | * |
||
112 | * @param array $asset |
||
113 | * @param string $locale |
||
114 | * @return array |
||
115 | */ |
||
116 | private function mapAsset(array $asset, string $locale): array |
||
124 | |||
125 | /** |
||
126 | * Return asset fields with locale OR locale fallback data. |
||
127 | * |
||
128 | * @param array $fields |
||
129 | * @param string $locale |
||
130 | * @return array |
||
131 | */ |
||
132 | private function fieldsWithFallback(array $fields, string $locale): array |
||
149 | |||
150 | protected function getFieldValue( |
||
161 | } |
||
162 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: