So, here is the basics of my setup.

   - There is a table of Locations.
      - Each Location has a type. (0=global, 1=national, 2=regional, 3=city,
      4=landmark)
      - Each Location has a parent_id allowing for you to chain locations.
      - The chain uses the type field to determine what is appropriate.
         - A global location will not have any parents.
         - A regional location can only have a national location as its
         parent.
         - A city location cannot have a national location as a parent.
         - A landmark cannot be a parent, but can be a child of any type.
            - It is possible to have a national landmark, yet not one in a
            city thus the reason this can exist under all locations.
         - Example Structure:
         - World (global)
         - United States (national)
            - California (regional)
               - San Francisco (city)
                  - Golden Gate Bridge (landmark)
                  - Colorado (regional)
                  - Mesa Verde (landmark)
                  - Denver (city)
                     - Mile High Stadium (landmark)
                     - United Kingdom (national)
               - England (regional)
                  - London (city)
                     - Westminster Abby (landmark)
                  - Stonehenge (landmark)
               - Scotland (regional)
            - There is a table of Domains.
      - A Domain is a collection of other domains and locations.
      - Each Domain shares the same structure and layout of the Locations
      with a few slight differences..
         - Domains have a type, but lack the landmark type.
         - A Domain has a parent_id like the Locations and can be chained
         like them.
         - A Domain also has locations assigned to it through a join table.
            - The join record not only contains the domain_id, and the
            location_id, but also mode.
               - Mode is a boolean.
                  - 1 = Add the Location (and all its children) to the
                  Domain
                  - 0 = Subtract the Location (and all its children) from
                  the Domain


Now for the find query.

   - I want to start with the id of a domain.
      - Grab all the children and the children of those children etc of that
      domain.
         - Grab the locations that belong to those domains
            - Grab all the children and the children of the children etc. of
            that location.
               - Return an array of all the location ids & names, in their
               parent hierarchy



I know that I could write something that would do many many searches, but I
would really like it if the database would do all the heavy lifting. Thanks.


~Michael

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to