chciałem zapytać jak należy definiować relacje w schema.yml?
czy należy wszędzie definiować relacje, tzn, jeżeli 'Artykul' ma relacje do 'Autor' to należy również zadbać o odwrotną relację w pliku schema.yml?
plik schema u mnie wygląda następująco:
Kod
---
detect_relations: true
options:
collate: utf8_polish_ci
charset: utf8
type: InnoDB
Artykul:
tableName: artykul
columns:
idArtykul:
primary: true
type: integer(4)
notnull: true
autoincrement: true
tytul:
type: string(45)
autorId:
type: integer(4)
notnull: true
relations:
Autor:
local: autorId
foreign: idAutor
foreignAlias: artykuly
Autor:
tableName: autor
columns:
idAutor:
primary: true
type: integer(4)
notnull: true
autoincrement: true
nazwa:
type: string(100)
relation:
Artykul:
local: idAutor
foreign: autorId
detect_relations: true
options:
collate: utf8_polish_ci
charset: utf8
type: InnoDB
Artykul:
tableName: artykul
columns:
idArtykul:
primary: true
type: integer(4)
notnull: true
autoincrement: true
tytul:
type: string(45)
autorId:
type: integer(4)
notnull: true
relations:
Autor:
local: autorId
foreign: idAutor
foreignAlias: artykuly
Autor:
tableName: autor
columns:
idAutor:
primary: true
type: integer(4)
notnull: true
autoincrement: true
nazwa:
type: string(100)
relation:
Artykul:
local: idAutor
foreign: autorId
jak pobrać artykuły wraz z ich autorami? próbowałem podobnie jak w jobeet ale za każdym razem otrzymuję inny błąd,
ostatnie wypociny to:
plik: ArtykulTable.class.php
public function getArticles(){ $q = $this->createQuery('art')->leftJoin('art.artykuly au ON art.autorid = autor.idautor')->execute(); return $q; }
Kod
500 | Internal Server Error | Doctrine_Table_Exception
Unknown relation alias artykuly
Unknown relation alias artykuly
może ktoś polecić jakąś książkę? mam "symfony w przykładach" i "programowanie z wykorzystaniem Symfony, CakePHP, Zend Framework"
ale obydwie opierają się o propel'a.
wiem że Polskich niema, ale to żaden problem, może być po angielsku.
poradziłem sobie już z joinem, ale pozostaje kwestia jak opisywać relacje i czy możecie polecić jakieś książki
