Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [Symfony] nestedSet - problem, Sf 1.4
janek9
post
Post #1





Grupa: Zarejestrowani
Postów: 121
Pomógł: 2
Dołączył: 22.03.2009

Ostrzeżenie: (0%)
-----


Witam, probuje uruchomic nestedtree zgodnie z dokumentacja dla propel 1.3. Utworzylem tabele tak jak jest tam opisane, natomiast przy probie zapisu do tej tabeli nie widzi funkcji: makeRoot(). Co jest grane..? Pomoże mi ktos..

  1.  
  2. root = new Menu();
  3. $root->setText('Google');
  4. $root->setLink('http://www.google.com');
  5.  
  6. $root->makeRoot();
  7. $root->setScopeIdValue(1); // Tree 1
  8. $root->save();
  9.  
  10. $menu = new Menu();
  11. $menu->setText('Google Mail');
  12. $menu->setLink('http://mail.google.com');
  13. $menu->insertAsLastChildOf($root);
  14. $menu->save();
  15.  
  16. // Create secund root node
  17. $root2 = new Menu();
  18. $root2->setText('Yahoo!');
  19. $root2->setLink('http://www.yahoo.com');
  20.  
  21. $root2->makeRoot();
  22. $root2->setScopeIdValue(2); // Tree 2
  23. $root2->save();
  24.  
  25. $menu = new Menu();
  26. $menu->setText('Yahoo! Mail');
  27. $menu->setLink('http://mail.yahoo.com');
  28. $menu->insertAsLastChildOf($root2);
  29. $menu->save();
  30.  



link do dokumentacji: nestedset propel1.3
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 4)
strife
post
Post #2





Grupa: Przyjaciele php.pl
Postów: 2 605
Pomógł: 96
Dołączył: 22.10.2004
Skąd: UK

Ostrzeżenie: (0%)
-----


A jak wygląda Twój model (chodzi mi o plik schema.yml) ? Spróbuj zrobić analogicznie do tego: http://www.agehrke.com/2009/04/nested-set-in-propel-13/

Jak to nie pomoże to będziemy myśleć dalej smile.gif


--------------------
Go to the top of the page
+Quote Post
janek9
post
Post #3





Grupa: Zarejestrowani
Postów: 121
Pomógł: 2
Dołączył: 22.03.2009

Ostrzeżenie: (0%)
-----


Cytat(strife @ 21.03.2010, 14:06:00 ) *
A jak wygląda Twój model (chodzi mi o plik schema.yml) ? Spróbuj zrobić analogicznie do tego: http://www.agehrke.com/2009/04/nested-set-in-propel-13/

Jak to nie pomoże to będziemy myśleć dalej smile.gif



Na wstepie dzieki za pomoc:). Wiec moja tabela do nestedtree wyglada nastepujaco w schema.yml:

  1.  
  2. menu:
  3. _attributes: { phpName: Menu, treeMode: NestedSet, idMethod: native }
  4. id: ~
  5. lft: { type: integer, required: true, default: 0, nestedSetLeftKey: true, index: true }
  6. rgt: { type: integer, required: true, default: 0, nestedSetRightKey: true, index: true }
  7. scope: { type: integer, required: true, default: 0, treeScopeKey: true, index: true }
  8. text: { type: varchar, size: 128, required: true, default: "" }
  9. link: { type: varchar, size: 255, required: true, default: "" }
  10.  


Poprostu chce przetestowac to dlatego uzylem takiej samej tabeli jak w dokumentacji..Naprawde nie wiem dlaczego nie widzi tego. Ale sprobuje za chwile zrobic tak jak podales mi w tym linku :-)
Go to the top of the page
+Quote Post
strife
post
Post #4





Grupa: Przyjaciele php.pl
Postów: 2 605
Pomógł: 96
Dołączył: 22.10.2004
Skąd: UK

Ostrzeżenie: (0%)
-----


Pamiętam, że model musi dziedziczyć pod jakiejś klasie NestedSet czy jakoś tak, aby to działało, spróbuj przebudować jeszcze raz model. U mnie jest tak, mam klasę Category:

lib/model/Category.php
  1. class Category extends BaseCategoryNestedSet


I mam w katalogu lib/model/om/BaseCategoryNestedSet.php wygenerowane, musisz do czegoś takiego dojść smile.gif


--------------------
Go to the top of the page
+Quote Post
janek9
post
Post #5





Grupa: Zarejestrowani
Postów: 121
Pomógł: 2
Dołączył: 22.03.2009

Ostrzeżenie: (0%)
-----


Dzieki za pomoc, poradzilem sobie juz:) Mialem zle zbudowana tabele oczywiscie.. Ale zainteresowalem sie pluginem: caPropelTreePlugin.

Pozdrawiam
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 19.08.2025 - 14:34