Every BEdita object is represented by a model that has to extend BEAppObjectModel class or its sublcasses and that has to define some class attributes.

Usually is preferable to extend a subclass of BEAppObjectModel where attributes and base associations are already defined. You can find a complete set of them in bedita/bedita-app/app_model.php file.

Every model of BEdita object has to be associated by a "hasOne" relation with models that manage base object tables (BEObject, that uses objects table).

So having a look at Image model located in bedita/bedita-app/models/objects/content/image.php we can see that it extends BeditaStreamModel that has an hasOne relation with BEObject, Content and Stream ie with the tables objects, contents and streams.

Required class attributes

array $modelBindings
It defines bindings with other models used in method find() of CakePHP. For example the "detailed" key is used automatically when you view an object detail in BEdita backend. This attribute is used by Containable behavior of CakePHP.

array $actsAs
It defines the behaviors used by model. Define it as an empty array if you don't need it.

array $objectTypesGroups
It contains a list of groups of object type.

  • "leafs" tells if an object can be put on the publication tree structure
  • "related" tells if an object will appear in the relation list when not specific list of object types is been defined (free semantic relation).
  • "multimedia" tells if an object is a multimedia object

Define as an empty array if you don't need it.

array $searchFields
It contains the score/importance of database fields used for full text search (only MySQL now) in a 1-10 range. For example:

public $searchFields = array(
   "title" => 10,
   "creator" => 6,
   "description" => 6,
   "subject" => 4,
   "abstract" => 4,
   "body" => 4


Meaning that "title" field is more important (10) than "description" (6) which is more important than "abstract" (4).