00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 include_once( "kernel/classes/ezpersistentobject.php" );
00041
00042 class eZDiscountRule extends eZPersistentObject
00043 {
00044
00045
00046
00047 function eZDiscountRule( $row )
00048 {
00049 $this->eZPersistentObject( $row );
00050 }
00051
00052 function definition()
00053 {
00054 return array( "fields" => array( "id" => array( 'name' => 'ID',
00055 'datatype' => 'integer',
00056 'default' => 0,
00057 'required' => true ),
00058 "name" => array( 'name' => "Name",
00059 'datatype' => 'string',
00060 'default' => '',
00061 'required' => true ) ),
00062 "keys" => array( "id" ),
00063 "increment_key" => "id",
00064 "class_name" => "eZDiscountRule",
00065 "name" => "ezdiscountrule" );
00066 }
00067
00068 function fetch( $id, $asObject = true )
00069 {
00070 return eZPersistentObject::fetchObject( eZDiscountRule::definition(),
00071 null,
00072 array( "id" => $id ),
00073 $asObject );
00074 }
00075
00076 function fetchList( $asObject = true )
00077 {
00078 return eZPersistentObject::fetchObjectList( eZDiscountRule::definition(),
00079 null, null, null, null,
00080 $asObject );
00081 }
00082
00083 function create()
00084 {
00085 $row = array(
00086 "id" => null,
00087 "name" => ezi18n( "kernel/shop/discountgroup", "New discount group" ) );
00088 return new eZDiscountRule( $row );
00089 }
00090
00091
00092
00093
00094
00095 function remove( $id )
00096 {
00097 eZPersistentObject::removeObject( eZDiscountRule::definition(),
00098 array( "id" => $id ) );
00099 }
00100 }
00101 ?>