Changeset 3021

Timestamp:
07/09/2008 09:51:03 PM (5 months ago)
Author:
Shadowhand
Message:

Added ORM2, which will replace ORM:

  • Primary keys can be defined per-model
  • Table names can be defined per-model, and can be plural or singular
  • Table columns can be defined per-model, as long as appropriate meta data is provided
  • New method meta() added, to provide read-only access to model attributes
  • New method reload() to force an object to reload itself from the database
  • New method foreign_key() added to determine foreign key names
  • The has() method has not been implemented (todo)
  • The save() method has not been implemented (todo)
  • The delete() method has not been implemented (todo)
  • The validate() method has not been implemented (todo)
  • Model aliases for has_one and belongs_to now work, eg: "user has_one address as billing_address", defined as: array('billing_address' => 'address')
  • many_to_many relationships "through" other objects are now supported, eg: "person has_many clubs through memberships", defined as: array('clubs' => 'memberships')
  • has_and_belongs_to_many relationships now work both ways, and the joining table is determined alphabetically
  • belongs_to_many relationship has been completely dropped, because has_many now works both ways
  • toString is now defined and returns the primary key value of the object
  • isset and unset are now defined
  • sleep and wakeup have been defined to only allow storing the object-specific (NOT class-specific) data when calling serialize(), this saves memory and prevents "stale" objects from being loaded
  • call acts ONLY as a pass-through to Database calls, and all magical call functions have been removed, eg: find_by_username_or_password
  • Loading of new objects has been split into load_result, load_values, and load_type, to allow greater flexibility for custom methods
  • Commenting needs to be added/updated (todo)
Files:
1 added