Developer manual/Models

From Group-Office Groupware and CRM Documentation
Jump to: navigation, search

Group-Office uses models to interact with the database. Group-Office models come with a lot of built in functionality such as:

  • Automatic handling of permissions with Access Control Lists
  • Searchable with the Group-Office global search function
  • Models are linkable to eachother
  • Extendable with custom fields

Creating a model

Each model that interacts with the database must extend the GO_Base_Db_ActiveRecord class. The following code is the minimal required for a model:

class GO_Notes_Model_Note extends GO_Base_Db_ActiveRecord {
	 * Returns a static model of itself
	 * @param String $className
	 * @return GO_Notes_Model_Note 
	public static function model($className=__CLASS__)
		return parent::model($className);
	public function getLocalizedName(){
		return GO::t('note','notes');
	public function aclField(){
		return 'category.acl_id';	
	public function tableName(){
		return 'no_notes';