Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [Symfony]2 błąd przy generowaniu entities relacji manyToMany
Forum PHP.pl > Forum > PHP > Frameworki
duga
Tworzę sobie prosty blog w symfony2 dla przećwiczenia wiedzy (lub niewiedzy), przebrnąłem przez kontrolery i szablony, teraz doszedłem do doctrine. Zrobiłem sobie takie tabelki w yml:


article table

Kod
tpsa\StoreBundle\Entity\article:
  type: entity
  table: null
  fields:
    id:
      type: integer
      id: true
      generator:
        strategy: AUTO
    description:
      type: string
      length: '255'
    content:
      type: text
      length: '65535'
    created_at:
      type: datetime
      length: null
    updated_at:
      type: datetime
      length: null
  manyToOne:
    author:
      targetEntity: user
      joinColumn:
        name: user_id
        referencedColumnName: id
  manyToMany:
    tags:
      targetEnity: tag
      inversedBy: article
      joinTable:
        name: article_tag
        joinColumns:
          article_id:
            referencedColumnName: id
        inversedJoinColumns:
          tag_id:
            referencedColumnName: id

  lifecycleCallbacks: {  }


tag table:

Kod
tpsa\StoreBundle\Entity\tag:
  type: entity
  table: null
  fields:
    id:
      type: integer
      id: true
      generator:
        strategy: AUTO
    name:
      type: string
      length: 255
    created_at:
      type: datetime
    updated_at:
      type: datetime
  manyToMany:
    articles:
      targetEnity: article
      mappedBy: tags

  lifecycleCallbacks: {  }


Przykład ten robiłem wzorując się na dokumentacji ze strony:

[url link="http://www.doctrine-project.org/docs/orm/2.0/en/reference/association-mapping.html"]5. Association Mapping[/url]

Przy generowaniu entities wyskakuje mnie:

Cytat
[ErrorException]
Notice: Undefined index: targetEntity in /var/www/symfony/vendor/doctrine/lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php line 391


Co robie źle?
Crozin
Znajdź różnice: targetEnity - targetEntity.
duga
Dzięki, znalazłem jeszcze parę literówek ;-)
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.