How to implement ManyToMany?
greenking19 opened this issue · 2 comments
greenking19 commented
I have two Entities, but I don't know how to implement ManyToMany in Curd
Category Entity
import { Entity, PrimaryGeneratedColumn, Column } from "typeorm"
@Entity()
export class Category {
@PrimaryGeneratedColumn()
id: number
@Column()
name: string
}
Question Entity
import {
Entity,
PrimaryGeneratedColumn,
Column,
ManyToMany,
JoinTable,
} from "typeorm"
import { Category } from "./Category"
@Entity()
export class Question {
@PrimaryGeneratedColumn()
id: number
@Column()
title: string
@Column()
text: string
@ManyToMany(() => Category)
@JoinTable()
categories: Category[]
}
How can I insert, update, find, and delete ManyToMany in Crud?
I haven't found a good solution at the moment🙁
zaro commented
@greenking19 Your example includes only entity definitions. If you have problem with TypeORM please redirect your question to a TypeORM related board.
Generally the library supports ManyToMany, if you think you have found a issue, please provide more specific example.
zaro commented
Closing stale issue, please reopen with more information if needed.