# HMS.Entities.Role.dcm.yml
HMS\Entities\Role:
  type: entity
  repositoryClass: HMS\Repositories\RoleRepository
  table: roles
  indexes:
    name_index:
      columns: [ name ]
  gedmo:
    soft_deleteable:
      field_name: deletedAt
      time_aware: false
  id:
    id:
      type: integer
      options:
        unsigned: true
      generator:
        strategy: AUTO
  fields:
    name:
      type: string
      unique: true
    displayName:
      type: string
    description:
      type: text
    deletedAt:
      type: datetime
      nullable: true
    createdAt:
      type: datetime
      gedmo:
        timestampable:
          on: create
    updatedAt:
      type: datetime
      gedmo:
        timestampable:
          on: update
  manyToMany:
    permissions:
      targetEntity: LaravelDoctrine\ACL\Permissions\Permission
      joinTable:
        name: permission_role
        joinColumns:
          role_id:
            referencedColumnName: id
            onDelete: CASCADE
        inverseJoinColumns:
          permission_id:
            referencedColumnName: id
            onDelete: CASCADE
    users:
      targetEntity: User
      joinTable:
        name: role_user
        joinColumns:
          role_id:
            referencedColumnName: id
            onDelete: CASCADE
        inverseJoinColumns:
          user_id:
            referencedColumnName: id
            onDelete: CASCADE



# HMS.Entities.Role.dcm.yml
HMS\Entities\Role:
  type: entity
  repositoryClass: HMS\Repositories\RoleRepository
  table: roles
  indexes:
    name_index:
      columns: [ name ]
  gedmo:
    soft_deleteable:
      field_name: deletedAt
      time_aware: false
  id:
    id:
      type: integer
      options:
        unsigned: true
      generator:
        strategy: AUTO
  fields:
    name:
      type: string
      unique: true
    displayName:
      type: string
    description:
      type: text
    deletedAt:
      type: datetime
      nullable: true
    createdAt:
      type: datetime
      gedmo:
        timestampable:
          on: create
    updatedAt:
      type: datetime
      gedmo:
        timestampable:
          on: update
  manyToMany:
    permissions:
      targetEntity: LaravelDoctrine\ACL\Permissions\Permission
      joinTable:
        name: permission_role
        joinColumns:
          role_id:
            referencedColumnName: id
            onDelete: CASCADE
        inverseJoinColumns:
          permission_id:
            referencedColumnName: id
            onDelete: CASCADE
    users:
      targetEntity: User
      mappedBy: roles

Correct Role User many to many mapping Inverse mapping only needs to define the `mappedBy` pram We also don’t need the cascade delete’s as both User and Role are soft deletable the many to many does magic they won’t show
Correct Role User many to many mapping
Inverse mapping only needs to define the `mappedBy` pram
We also don’t need the cascade delete’s as both User and Role are soft deletable the many to many does magic they won’t show
