typescript - 找不到 Company#companyTypesLinks 的实体元数据。检查您是否指定了正确的实体对象
问题描述
我的实体关系有问题,我已经尝试了所有方法,但仍然遇到同样的问题,这是我的脚本:
公司实体.ts
export class Company extends AppBaseEntity {
@Column('text', { name: 'nom', nullable: true })
nom: string;
@Column('varchar', { name: 'type_entite', length: 255, nullable: true })
typeEntite?: CompanyEntityType;
@Column('text', { name: 'note', nullable: true })
note: string;
@Column('varchar', { name: 'color', length: 15, nullable: true })
color?: string;
@Column('text', { name: 'textMailInvoices', nullable: true })
textMailInvoices?: string;
@Column('varchar', { name: 'subjectMailInvoices', length: 255, nullable: true })
subjectMailInvoices?: string;
@Column('tinyint', { name: 'archived', nullable: false, default: 0 })
archived: boolean;
@OneToMany(() => CompanyTypesLinks, companyTypesLink => companyTypesLink.company, { cascade: true, onUpdate: 'CASCADE' })
public companyTypesLinks?: CompanyTypesLinks[];
和公司类型-link.entity.ts
export class CompanyTypesLinks extends AppBaseEntity {
@Column('varchar', { name: 'typesId', length: 36, nullable: true })
typesId: string;
@ManyToOne(() => Company, company => company.companyTypesLinks, { cascade: true })
@JoinColumn({ name: 'companyId' })
public company?: Company;
@Column('varchar', { name: 'companyId', length: 36, nullable: true })
companyId: string;
@ManyToOne(() => CompanyTypes, companyTypes => companyTypes.companyTypesLinks)
@JoinColumn({ name: 'typesId' })
companyType?: CompanyTypes;
AppBaseEntity 包含 id
解决方案
我通过重命名公司类型链接文件解决了这个问题,实际上该文件是:
company-type-link.ts 而不是
公司类型-link.entity.ts
缺少实体术语
推荐阅读
- visual-studio-code - 命令“重新加载 Vibrancy”导致错误(运行贡献的命令:“extension.updateVibrancy”失败。)
- javascript - 在任何桌面上滑动的全屏 HTML 页面
- reactjs - 从 Flask 到 React.js 的回调函数
- javascript - 如何获取位于表 td 中的输入字段值
- python - 在条形图中保存绘图图像
- javascript - 为什么 getComputedStyle() 方法在我的 Nuxt 应用程序中无法正常工作?
- javascript - 在jQuery中获取复选框插入输入值
- php - Symfony 5.3 密码哈希从“$argon2id”改回“$2y$13”
- django - 如何在 IIS 10 上为 Django 服务器配置 HTTPS
- python - 如何将多边形的边缘作为 LineStrings?