create-client
create-client copied to clipboard
Vuetify : error when entity are type entity_relatedentity
API Platform version(s) affected: 1.2
Description
First, thanks a lot for the great job with this generator, the code is great to read !
I've a problem with generated entities in Vuetify wich name is with an underscore.
How to reproduce
Make an entity Article and a ArticleCategory entity with a many to one relation.
If i want to go to check all the ArticleCategory, I've got multiple erros saying the store does'nt contains this.
It's like of the automatic crud generation does'nt work with 'article_category' because it contains an underscore.
Maybe it's something else.
Possible Solution
I've tryed to look for it with no solution for the moment.
@GRUXXKi can you provide the command you use for generating the code for your entities ?
Can you also show us your store/index.js
?
@GRUXXKi can you provide the command you use for generating the code for your entities ?
I've used the one into documentation
Can you also show us your
store/index.js
?
Got that kind of generated values :
import Vue from "vue";
import Vuex from "vuex";
import makeCrudModule from "./modules/crud";
import notifications from "./modules/notifications";
import fooService from "../services/foo";
import fooBarService from "../services/foobar";
import VuexPersistence from "vuex-persist";
const vuexPersist = new VuexPersistence({
key: 'mykey',
storage: localStorage
})
Vue.use(Vuex);
const store = new Vuex.Store({
modules: {
notifications,
userparameters,
foo: makeCrudModule({
service: fooService
}),
fooBar: makeCrudModule({
service: fooBarService
}),
},
strict: process.env.NODE_ENV !== "production",
plugins: [vuexPersist.plugin]
});
export default store;
@GRUXXKi can you provide the command you use for generating the code for your entities ?
I've used the one into documentation
Can you also show us your
store/index.js
?Got that kind of generated values :
import Vue from "vue"; import Vuex from "vuex"; import makeCrudModule from "./modules/crud"; import notifications from "./modules/notifications"; import fooService from "../services/foo"; import fooBarService from "../services/foobar"; import VuexPersistence from "vuex-persist"; const vuexPersist = new VuexPersistence({ key: 'mykey', storage: localStorage }) Vue.use(Vuex); const store = new Vuex.Store({ modules: { notifications, userparameters, foo: makeCrudModule({ service: fooService }), fooBar: makeCrudModule({ service: fooBarService }), }, strict: process.env.NODE_ENV !== "production", plugins: [vuexPersist.plugin] }); export default store;
Where is your service ? you need to declare your own service, like explain in the documentation.
import fooService from "../services/foo"; import fooBarService from "../services/foobar";
Here, no ?
yes, but your service articleService
and articleCategoryService
?
Sorry, I have like 30 services, so I've just made an example of the code I have.
But sure I have :
...
import animationService from "../services/animation";
import animationCategorieService from "../services/animationcategorie";
........
const store = new Vuex.Store({
modules: {
notifications,
animation: makeCrudModule({
service: animationService
}),
animationCategorie: makeCrudModule({
service: animationCategorieService
}),
........
I also found it weird, but it's ok ^^
If I remember correctly, I also had this error at the beginning. And I believe, that I just declared the name of my module in lowercase. Exactly like the service filename. Can you try?
exemple:
...
import animationService from "../services/animation";
import animationCategorieService from "../services/animationcategorie";
........
const store = new Vuex.Store({
modules: {
notifications,
animation: makeCrudModule({
service: animationService
}),
animationcategorie: makeCrudModule({
service: animationCategorieService
}),
........