Можно ли добавить индексы сущностей, встроенных в Doctrine? - PullRequest
0 голосов
/ 18 октября 2019

Я хотел бы знать, возможно ли добавить индексы встроенных сущностей, которые его определили, без записи его в родительскую сущность

App\Documents\Person\Domain\Parent:
  type: entity
  table: parent
  id:
    uuid:
      type: guid
  fields:
    id:
      type: integer
      unique: true
      nullable: true
      columnDefinition: INT NOT NULL AUTO_INCREMENT
  embedded:
    referenceUuid:
      class: App\Documents\Shared\Domain\ReferenceUuid
      columnPrefix: false
      useColumnPrefix: false
    user:
      class: App\Shared\Domain\Aggregate\User
      useColumnPrefix: false
      columnPrefix: false


App\Documents\Shared\Domain\ReferenceUuid:
  type: embeddable
  fields:
    value:
      type: guid
      nullable: true
      column: reference_uuid
  indexes:
    reference_uuid_index:
      columns: [reference_uuid]


App\Shared\Domain\Aggregate\User:
  type: embeddable
  embedded:
    uuid:
      class: App\Shared\Domain\Aggregate\UserUuid
      useColumnPrefix: true
      columnPrefix: user_
    name:
      class: App\Shared\Domain\Aggregate\UserName
      columnPrefix: user_
      useColumnPrefix: true
    role:
      class: App\Shared\Domain\Aggregate\UserRole
      useColumnPrefix: true
      columnPrefix: user_


App\Shared\Domain\Aggregate\UserUuid:
  type: embeddable
  fields:
    value:
      type: guid
      nullable: true
      column: uuid
  indexes:
    user_uuid_index:
      columns: [uuid]

Для того, чтобы индексы были сохранены в MySQLбазе данных, они должны быть определены в родительском объекте:

App\Documents\Person\Domain\Parent:
  type: entity
  table: parent
  id:
    uuid:
      type: guid
  fields:
    id:
      type: integer
      unique: true
      nullable: true
      columnDefinition: INT NOT NULL AUTO_INCREMENT
  embedded:
    referenceUuid:
      class: App\Documents\Shared\Domain\ReferenceUuid
      columnPrefix: false
      useColumnPrefix: false
    user:
      class: App\Shared\Domain\Aggregate\User
      useColumnPrefix: false
      columnPrefix: false

  indexes:
    reference_uuid_index:
      columns: [reference_uuid]
    user_uuid_index:
      columns: [uuid]

Я хотел бы, если есть способ обойти это, и использовать индексы, включенные во встроенные объекты.

Спасибо

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...