Próbuję zrobić profil po stronie aplikacji frontend. Utworzyłem tabelę sf_guard_user_profile w bazie danych z kolumnami:
id PK
user_id FK - połączenie z kolumna 'id' tabeli 'sf_guard_user'
imie
Potem wygenerowałem plik schema.yml
- tabela z profilem wygląda w pliku schema.yml w ten sposób:
<?php php symfony doctrine:build-schema ?>
SfGuardUserProfile: tableName: sf_guard_user_profile columns: id: type: integer(4) primary: true autoincrement: true user_id: type: integer(4) default: '' notnull: true imie: type: string(200) default: '' notnull: true relations: SfGuardUser: local: user_id foreign: id type: one
Oraz polecenia:
php symfony doctrine:build-model
php symfony doctrine:build-forms
php symfony cc
W module, którego strony są widoczne po zalogowaniu dałem w action.class.php w metodzie executeTajne:
<?php $this->name = $this->getUser()->getGuardUser()->getProfile()->getImie(); ?>
W tajnejneSuccess.php:
<?php ?>
Potem jeszcze polecenie:
php symfony cc
I jak po zalogowaniu wejdę na stronę 'tajne' to widzę stronę:
Oops! An Error Occurred
The server returned a "500 Internal Server Error".
Otwarcie tej samej strony jako developer daje informację: Unknown method sfGuardUser::getProfile - dlaczego ?