Skip to content

Commit a613861

Browse files
committed
chore(pinia-orm)!: Remove mapRepos composable
1 parent c52f99a commit a613861

File tree

5 files changed

+3
-107
lines changed

5 files changed

+3
-107
lines changed

docs/content/1.guide/3.relationships/1.getting-started.md

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -180,37 +180,6 @@ userRepo.with('posts', (query) => {
180180
}).load(users)
181181
```
182182

183-
Note that the `load` method will mutate the given models, therefore, it is advised to use the method within a single `computed` property.
184-
185-
```js
186-
import { mapRepos } from 'pinia-orm'
187-
import User from '@/models/User'
188-
189-
export default {
190-
data () {
191-
return {
192-
condition: false
193-
}
194-
},
195-
196-
computed: {
197-
...mapRepos({
198-
userRepo: User
199-
}),
200-
201-
users () {
202-
const users = this.userRepo.all()
203-
204-
if (this.condition) {
205-
this.userRepo.with('posts').load(users)
206-
}
207-
208-
return users
209-
}
210-
}
211-
}
212-
```
213-
214183
### Loading All Relationships
215184

216185
To load all relationships, you may use the `withAll` and `withAllRecursive` methods.

docs/content/1.guide/4.repository/1.getting-started.md

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -53,34 +53,6 @@ export default {
5353
}
5454
```
5555

56-
### Map Repositories Helper
57-
58-
In addition to use `this.$store.$repo` to retrieve repositories, Pinia ORM provides a convenience helper function called `mapRepos` to retrieve multiple repositories at once.
59-
60-
The `mapRepos` helper will receive a list of models with its name as a key. The repositories is going to be injected to the `this` context within Vue Component.
61-
62-
```js
63-
import { mapRepos } from 'pinia-orm'
64-
import User from '@/models/User'
65-
import Post from '@/models/Post'
66-
67-
export default {
68-
computed: {
69-
...mapRepos({
70-
userRepo: User,
71-
postRepo: Post
72-
})
73-
},
74-
75-
methods: {
76-
someMethod () {
77-
this.userRepo // <- the user repository.
78-
this.postRepo // <- the post repository.
79-
}
80-
}
81-
}
82-
```
83-
8456
## Interacting With Store
8557

8658
As mentioned earlier, you may use repositories to retrieve, insert, update, and delete data in the store. Please refer to the corresponding pages to learn more about how to interact with the store.

docs/content/1.guide/4.repository/2.retrieving-data.md

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,12 @@ When querying the data from the store, in most cases, you want to query data ins
1717
</ul>
1818
</template>
1919

20-
<script>
21-
import { mapRepos } from 'pinia-orm'
20+
<script setup>
2221
import User from '@/models/User'
2322
2423
export default {
25-
computed: {
26-
...mapRepos({
27-
userRepo: User
28-
}),
29-
30-
users () {
31-
return this.userRepo.all()
32-
}
33-
}
24+
const userRepo = useRepo(User)
25+
const users = computed(() => this.userRepo.all())
3426
}
3527
</script>
3628
```

packages/pinia-orm/src/composables/mapRepos.ts

Lines changed: 0 additions & 36 deletions
This file was deleted.

packages/pinia-orm/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ export * from './data/Data'
22
export * from './composables/useRepo'
33
export * from './composables/useStoreActions'
44
export * from './composables/useDataStore'
5-
export * from './composables/mapRepos'
65
export * from './store/Config'
76
export * from './store/Plugins'
87
export * from './store/Store'

0 commit comments

Comments
 (0)