Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Use NestedSets for category ?
  • Hi,

    I wanted to create a model Category, which a Category has parent and childrens Category for create sub-category, sub-sub-category, etc... And they have attribute "position" for sort them.

    And i have see in the ORM docs : NestedSets. It sounds like interesting. You think it's a good way to use NestedSets for what i want to do ?
  • HarroHarro
    Accepted Answer
    Nested sets is a mechanism to store tree structures in a flat list, see for an explanation.

    If your catagory structure is a tree (which it probably is), then the answer is yes.
  • Thanks for confirmation ;-)

    Usually i use just an int attribut for "position". And in my backend, i sort objects with HTML table and JS Drag'n'drop for save the good "position".

    But i thinks here it's will be more difficult, i will use "next_sibling" and "previous_sibling" for manage position. 
  • i have finish my backend for manage Category with the Nested set model, it's work perfectly and simply !
    Thanks for this feature, really :-)
  • You're welcome. ;-)

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion