Closed KristinaErdman closed 2 years ago
I am also having the same issue. Followed the same as provided in documentations and added RelationId in ManyToOne but the relationId in AdminJS is empty
Add @Column()
decorator above your foreign key, i. e.:
@RelationId((value: FeatureValue) => value.feature)
@Column()
featureId: number;
@Column()
Thank you so much! It worked! How can I add related resources to a page? For example, on a Feature page, can I add all the FeatureValues related to it?
Add
@Column()
decorator above your foreign key, i. e.:@RelationId((value: FeatureValue) => value.feature) @Column() featureId: number;
1:m
and m:n
relations are currently not populated by default. I'm trying to figure out how to implement this while supporting different ORMs. Meanwhile, you can create your own custom components and actions to handle that.
1:m
andm:n
relations are currently not populated by default. I'm trying to figure out how to implement this while supporting different ORMs. Meanwhile, you can create your own custom components and actions to handle that.
Thank you
1:m
andm:n
relations are currently not populated by default. I'm trying to figure out how to implement this while supporting different ORMs. Meanwhile, you can create your own custom components and actions to handle that.
Any news on this?
Add
@Column()
decorator above your foreign key, i. e.:@RelationId((value: FeatureValue) => value.feature) @Column() featureId: number;
another way to go about it is to add {eager: true}
to the relation options (if you don't mind the related entity being loaded as well) like so:
@ManyToOne((type) => Feature, (feature) => feature.values, {
cascade: true,
onDelete: 'CASCADE',
onUpdate: 'CASCADE',
nullable: false,
eager: true,
})
feature: Feature;
then you can remove "featuredId" entirely if it's not useful in your application logic.
Found this helpful in my case.
Hi, I tried to display related resources in the admin panel. NestJs and TypeOrm. Entitties:
In app.module.ts
Creation and filtering work correctly.
But when you browse, you don't see any linked resources.
An error occurs during the update.