多对多symfony 1.4和主义schema.yml的关系

时间:2018-08-24 23:45:56

标签: symfony-1.4 doctrine-1.2

我有一个带有symfony 1.4和理论的旧项目,我想对其进行转换。表工作人员和职位之间存在很多关系,其中一个工作人员有多个职位,一个职位有多个工人。我想保存工作人员数据,并通过列表框为每个工作人员设置几个位置。

SmtPositions:
 actAs: { Timestampable: ~ }
columns:
  post: { type: string(100), notnull: true }

表数据工作者

SmtDataworkers:
  actAs: { Timestampable: ~ }
  columns:
    dep_id:    { type: integer, notnull: true }
    name: { type: string(100), notnull: true }
    fname: { type: string(100), notnull: true }
    lname: { type: string(100), notnull: true }
    phone: { type: int(10), notnull: true, unique: true }
    address: { type: string(100), notnull: true }
    skillslevel: { type: int(1), notnull: true }
    ppen: { type: int(3), notnull: true }
    knifen: { type: int(3), notnull: true }
  attributes:
    export: all
  relations:
    SmtDepartments:   { onDelete: CASCADE, local: dep_id, foreign: id, foreignAlias: SmtDataworkers }
    SmtPositions:   { onDelete: CASCADE, foreignAlias: SmtDataworkers, class: SmtPositions, refClass: SmtPositionWorker }

SmtPositionWorker:
  actAs: { Timestampable: ~ }
  columns:
    post_id:    { type: integer, primary: true, notnull: true }
    worker_id:    { type: integer, primary: true, notnull: true }
  relations:
    SmtDataworkers:   { onDelete: CASCADE, local: worker_id, foreign: id, foreignAlias: SmtPositionWorker }
    SmtPositions:   { onDelete: CASCADE, local: post_id, foreign: id, foreignAlias: SmtPositionWorker, class: SmtPositions }

0 个答案:

没有答案