![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 236 Pomógł: 0 Dołączył: 27.10.2012 Ostrzeżenie: (0%) ![]() ![]() |
hej
próbuje zrobić mapowanie dla trzech tabel: posts / tabela przechowująca newsy itp ----------- id title slug content dateAdd menu / tabela z kategoriami - każdy news może być przyporządkowany do kilku kategorii ----------- id parentId category_name slug connector / tabela łącząca rekordy z tabel: posts i menu ------------- id menuId postId Post.php
Connector.php
w kontrolerze mam:
w twigu mam:
no i to mapowanie działa, np.: jak usune posta to usuwa mi również jego kategorie z tabeli connector. ale za piernika nie wiem jak w tej pętli wyświetlić jeszcze informacje z tabeli posts ![]() ![]() musze jakieś mapowanie jeszcze zrobić? Prosze o pomoc. Dzięki Ten post edytował dopelganger 9.05.2017, 13:32:44 |
|
|
![]() |
![]()
Post
#2
|
|
![]() Grupa: Zarejestrowani Postów: 279 Pomógł: 42 Dołączył: 10.10.2011 Ostrzeżenie: (0%) ![]() ![]() |
|
|
|
![]()
Post
#3
|
|
Grupa: Zarejestrowani Postów: 236 Pomógł: 0 Dołączył: 27.10.2012 Ostrzeżenie: (0%) ![]() ![]() |
|
|
|
![]()
Post
#4
|
|
![]() Grupa: Zarejestrowani Postów: 279 Pomógł: 42 Dołączył: 10.10.2011 Ostrzeżenie: (0%) ![]() ![]() |
działa ![]() aż mi wstyd ![]() Z tego co wiem to gdy Twig wywołuje {{ entity.id }} to wyświetli Ci id a gdy pole jest protected/private to automatycznie szuka metody getId(), ale nie dam głowy uciąć. więc {{ c.post }} działa jak $c->getPost(); co z kolei zwróci Ci encję Post i dalej .title = getTitle(); Ten post edytował Puszy 9.05.2017, 13:47:44 |
|
|
![]()
Post
#5
|
|
![]() Grupa: Zarejestrowani Postów: 744 Pomógł: 118 Dołączył: 14.02.2009 Skąd: poziome Ostrzeżenie: (0%) ![]() ![]() |
Implementation
For convenience's sake foo.bar does the following things on the PHP layer: check if foo is an array and bar a valid element; if not, and if foo is an object, check that bar is a valid property; if not, and if foo is an object, check that bar is a valid method (even if bar is the constructor - use __construct() instead); if not, and if foo is an object, check that getBar is a valid method; if not, and if foo is an object, check that isBar is a valid method; if not, and if foo is an object, check that hasBar is a valid method; if not, return a null value. foo['bar'] on the other hand only works with PHP arrays: check if foo is an array and bar a valid element; if not, return a null value. -------------------- śmieszne obrazki
Kryzys: Ser jem spleśniały, wino piję stare i samochód mam bez dachu.. |
|
|
![]() ![]() |
![]() |
Aktualny czas: 21.08.2025 - 22:48 |