Loading...
 

History: Object References

Preview of version: 2

When creating object, auto-increment ids are used internally by Tikiwiki. Object references allow to track these object IDs during the profile creation to create relationships between the different objects. For example, when a tracker is created, the trackerId provided to it is arbitrary. Unless you know what that ID is, it is impossible to add fields or items to it in an automated way. It could be possible to force the ID to a certain value, but this could cause conflicts if multiple profiles decided to use th same value.

During profile installation, when a named object is encountered, the ID assigned to it is stored under the provided name. Other objects can access this value as a variable for any of their attributes.

The object block contains all objects to be created.

CategoryTreeProfile
objects: - type: category ref: profile_category data: name: Profiles - type: category ref: app_category data: name: Tracker Applications parent: $profile_category - type: category data: name: Site Samples parent: $profile_category


As you can see, the profile defined here will create three distinct categories. Profiles will be the parent category and contain two child categories. These child categories find their parent by using a reference ($profile_category). This internal reference uses the name defined by the ref attribute. For more information about the category object type, see CategoryHandler.

  • Reference attributes (ref)
    • are optional
    • must be unique inside a profile
    • can be useful to understand the ProfileHistory
  • Internal references ($object_name)
    • must refer to an existing object
    • act as a variable
    • must not cause circular dependencies between objects
  • Inter-profile references ($ProfileName:object_name)
    • must refer to an existing profile on the same site
    • must not cause circular dependencies between profiles
    • allow to refer to objects created by other profiles
    • will cause the other profile to be installed
  • Cross-site references ($example.com:ProfileName:object_name)
    • must refer to a valid Tikiwiki installation
    • allows to create custom profile extensions on a personal host

SampleDataProfile
objects: - type: wiki_page ref: sample_page data: name: SampleProfile category: $CategoryTreeProfile:app_category content: | ...


References don't have to be in a logical place. Profiles are a big data structure. Each part may or may not be interpreted depending on what features are supported.

MyConfigurationRepositoryProfile
dependencies: # Could also be called dummy - $profiles.tikiwiki.org:BugTrackerProfile:bug_tracker - $profiles.tikiwiki.org:ClientManagementProfile:client_tracker - $profiles.tikiwiki.org:SampleDataProfile:sample_page


By installing the MyConfigurationRepositoryProfile profile, the following profiles would be installed:
  1. ))BugTrackerProfile((
  2. ))ClientManagementProfile((
  3. ))CategoryTreeProfile((
  4. ))SampleDataProfile((
  5. ))MyConfigurationRepositoryProfile((

History

Advanced
Information Version
Tue 26 of Oct, 2010 02:20 GMT-0000 Nelson Ko remove confusing example 13
Tue 26 of Oct, 2010 01:58 GMT-0000 Nelson Ko Add clarification of example that does not work 12
Sun 19 of Sep, 2010 04:42 GMT-0000 lindon typo 11
Mon 13 of Sep, 2010 22:24 GMT-0000 Marc Laporte cleaner 10
Tue 06 of Apr, 2010 13:40 GMT-0000 idealpragmatist refactor dependencies to a separate page 9
Mon 29 of Mar, 2010 20:01 GMT-0000 idealpragmatist explain that ref: is what is meant. 8
Mon 30 of Nov, 2009 04:38 GMT-0000 lindon 7
Thu 16 of Apr, 2009 03:01 GMT-0000 Marc Laporte 6
Thu 16 of Oct, 2008 03:33 GMT-0000 Marc Laporte 5
Sat 23 of Aug, 2008 15:41 GMT-0000 Marc Laporte 4
Thu 26 of Jun, 2008 22:42 GMT-0000 System Administrator 3
Wed 04 of Jun, 2008 20:33 GMT-0000 System Administrator 2
Wed 04 of Jun, 2008 19:54 GMT-0000 System Administrator 1