array( "db_id" => array( 'property' => 'id', 'phptype' => 'integer', 'default' => null, 'visibility' => 'public', 'required' => true ), "db_name" => array( 'property' => 'name', 'phptype' => 'string', 'default' => '', 'visibility' => 'public', 'required' => true ), "db_value" => array( 'property' => 'value', 'phptype' => 'string', 'default' => '', 'visibility' => 'private', 'required' => true ) ), "keys" => array( "id" ), "increment_key" => "id", "class_name" => "Setting", "sort" => array( "id" => "asc" ), "db_table" => "settings" ); } public function __get( $var ) { switch( $var ) { case "name": return $this->$_name; break; case "value": return $this->$_value; break; default: throw new ezcPersistentObjectException( "Illegal attribute: $var" ); break; } } public function __set( $var, $value ) { // you can of course do error checking etc here. switch( $value ) { case "name": $this->$_name = $value; break; case "value": $this->$_value = $value; break; default: throw new ezcPersistentObjectException( "Illegal attribute: $var" ); break; } // our data is now dirty, so we need to tell ezcPersistentObject // that it really has to save on store $this->$persistentDataDirty = true; } } /* In your database you would need a table that looks something like this: CREATE TABLE settings ( db_id not null auto_increment primary key, db_name varchar(20), db_name varchar(255) ); Now you can use your new Settings class. */ // create a new setting and save it $setting = new Setting(); $setting->$name = "color"; $setting->$value = "red"; $id = $setting->store(); // refetch it from the database $setting = new Setting( $id ); // delete it $setting->delete(); // fetch all settings that are set to "true" $settings = Setting::fetchObjects( Settings::definition(), array( "value" => "true" ) ); ?>