[SF2][SF] Menu - Drzewo kategorii w oparciu o tree nested |
[SF2][SF] Menu - Drzewo kategorii w oparciu o tree nested |
13.01.2016, 00:48:17
Post
#1
|
|
Grupa: Zarejestrowani Postów: 159 Pomógł: 0 Dołączył: 21.08.2011 Ostrzeżenie: (0%) |
Witam.
Mam problem z uzyskaniem menu w formie drzewa. Korzystam z Tree nested i otrzymuję kod błędu: "Error: Call to a member function childrenHierarchy() on a non-object". Dopiero zaczynam przygode z SF2, dlatego prosze o wyrozumialosc. W kontrolerze mam taki zapis:
Categories.php
W plikach konfiguracyjnych mam odpowiednie wpisy, a mimo to nie dziala. Czy ktos z Was mial stycznosc z tree nested i mi pomoze? |
|
|
13.01.2016, 10:38:38
Post
#2
|
|
Grupa: Zarejestrowani Postów: 655 Pomógł: 73 Dołączył: 2.05.2014 Ostrzeżenie: (0%) |
W config.yml masz włączone tree? W bazie zapisuje prawidłowo lft, rgt, root i parent?
Czy findAll() zwraca prawidłowo zmapowane rekordy? czy są to obiekty Gedmo tree? Spróbuj zrobić custom query zamiast findAll() http://stackoverflow.com/questions/2850252...ns-gedmo-object I repozytorium zrób własne z extends na Gedmo\Tree\Entity\Repository\NestedTreeRepository -------------------- Overwatch24 - najbardziej zaawansowany Polski portal Overwatch od fanów dla fanów.
Fachowo.co Behance.net/fachowo |
|
|
14.01.2016, 11:33:53
Post
#3
|
|
Grupa: Zarejestrowani Postów: 159 Pomógł: 0 Dołączył: 21.08.2011 Ostrzeżenie: (0%) |
W pliku config.yml mam m.in. takie wpisy:
W pliku CategoriesRepository.php mam wpis następujący:
W bazie danych poprawnie zapisują się root, parent_id, lft, rgt, lvl, natomiast problem jest przy pobieraniu struktury drzewiastej przy użyciu Gedmo tree. |
|
|
18.01.2016, 07:19:40
Post
#4
|
|
Grupa: Zarejestrowani Postów: 162 Pomógł: 13 Dołączył: 16.06.2007 Ostrzeżenie: (0%) |
|
|
|
18.01.2016, 13:21:55
Post
#5
|
|
Grupa: Zarejestrowani Postów: 159 Pomógł: 0 Dołączył: 21.08.2011 Ostrzeżenie: (0%) |
Riggs, ta zmiana, ktora zasugerowales w klasie repozytorium nie dala oczekiwanych rezultatow. Problem istnieje nadal.
|
|
|
19.01.2016, 08:18:36
Post
#6
|
|
Grupa: Zarejestrowani Postów: 162 Pomógł: 13 Dołączył: 16.06.2007 Ostrzeżenie: (0%) |
Nie doczytałem dobrze błędu.
to daje ci wszystkie rekordy z tabeli Categories a nie repozytorium! Zamień to na , reszta bez zmian i powinno być ok. |
|
|
19.01.2016, 10:11:58
Post
#7
|
|
Grupa: Zarejestrowani Postów: 159 Pomógł: 0 Dołączył: 21.08.2011 Ostrzeżenie: (0%) |
Riggs, dzieki wielkie za pomoc. Popelnilem kilka bledow, ktore uniemozliwily wczytanie drzewa kategorii.
W tej chwili mam taki kod w kontrolerze:
Zawartość pliku CategoriesRepository.php
Juz wszystko dziala. Pozdrawiam |
|
|
Wersja Lo-Fi | Aktualny czas: 20.09.2024 - 06:17 |