Skip to content

Commit 0013e31

Browse files
committed
Update entityStorageMapping examples in README
1 parent fecdf4c commit 0013e31

File tree

1 file changed

+40
-19
lines changed

1 file changed

+40
-19
lines changed

README.md

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,16 @@ directory using the `drupal.drupal_root` parameter.
9191

9292
```
9393
parameters:
94-
drupal:
95-
drupal_root: /path/to/drupal
94+
drupal:
95+
drupal_root: /path/to/drupal
9696
```
9797

9898
You can also use container parameters. For instance you can always set it to the current working directory.
9999

100100
```
101101
parameters:
102-
drupal:
103-
drupal_root: %currentWorkingDirectory%
102+
drupal:
103+
drupal_root: %currentWorkingDirectory%
104104
```
105105

106106
### Entity storage mappings.
@@ -111,23 +111,36 @@ default mapping can be found in `extension.neon`. For example:
111111

112112
```
113113
parameters:
114-
drupal:
115-
entityTypeStorageMapping:
116-
node: Drupal\node\NodeStorage
117-
taxonomy_term: Drupal\taxonomy\TermStorage
118-
user: Drupal\user\UserStorage
119-
block: Drupal\Core\Config\Entity\ConfigEntityStorage
114+
drupal:
115+
entityTypeStorageMapping:
116+
block:
117+
class: Drupal\block\Entity\Block
118+
storage: Drupal\Core\Config\Entity\ConfigEntityStorage
119+
node:
120+
class: Drupal\node\Entity\Node
121+
storage: Drupal\node\NodeStorage
122+
taxonomy_term:
123+
class: Drupal\taxonomy\Entity\Term
124+
storage: Drupal\taxonomy\TermStorage
125+
user:
126+
class: Drupal\user\Entity\User
127+
storage: Drupal\user\UserStorage
120128
```
121129

122130
To add support for custom entities, you may add the same definition in your project's `phpstan.neon`. See the following
123131
example for adding a mapping for Search API:
124132

125133
```
126134
parameters:
127-
drupal:
128-
entityTypeStorageMapping:
129-
search_api_index: Drupal\search_api\Entity\SearchApiConfigEntityStorage
130-
search_api_server: Drupal\search_api\Entity\SearchApiConfigEntityStorage
135+
drupal:
136+
entityTypeStorageMapping:
137+
block:
138+
search_api_index:
139+
class: Drupal\search_api\Entity\Index
140+
storage: Drupal\search_api\Entity\SearchApiConfigEntityStorage
141+
search_api_server:
142+
class: Drupal\search_api\Entity\Server
143+
storage: Drupal\search_api\Entity\SearchApiConfigEntityStorage
131144
```
132145

133146
Similarly, the `EntityStorageDynamicReturnTypeExtension` service helps to determine the type of the entity which is
@@ -145,11 +158,19 @@ The default mapping can be found in `extension.neon`:
145158
```neon
146159
parameters:
147160
drupal:
148-
entityStorageMapping:
149-
node: Drupal\node\Entity\Node
150-
taxonomy_term: Drupal\taxonomy\Entity\Term
151-
user: Drupal\user\Entity\User
152-
block: Drupal\block\Entity\Block
161+
entityTypeStorageMapping:
162+
block:
163+
class: Drupal\block\Entity\Block
164+
storage: Drupal\Core\Config\Entity\ConfigEntityStorage
165+
node:
166+
class: Drupal\node\Entity\Node
167+
storage: Drupal\node\NodeStorage
168+
taxonomy_term:
169+
class: Drupal\taxonomy\Entity\Term
170+
storage: Drupal\taxonomy\TermStorage
171+
user:
172+
class: Drupal\user\Entity\User
173+
storage: Drupal\user\UserStorage
153174
```
154175

155176
To add support for custom entities, you may add the same definition in your project's `phpstan.neon` likewise.

0 commit comments

Comments
 (0)