|
eZ Publish
[4.0]
|
00001 <?php 00002 // 00003 // Definition of eZDiscountRule class 00004 // 00005 // Created on: <27-Nov-2002 13:05:59 wy> 00006 // 00007 // ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ## 00008 // SOFTWARE NAME: eZ Publish 00009 // SOFTWARE RELEASE: 4.0.x 00010 // COPYRIGHT NOTICE: Copyright (C) 1999-2008 eZ Systems AS 00011 // SOFTWARE LICENSE: GNU General Public License v2.0 00012 // NOTICE: > 00013 // This program is free software; you can redistribute it and/or 00014 // modify it under the terms of version 2.0 of the GNU General 00015 // Public License as published by the Free Software Foundation. 00016 // 00017 // This program is distributed in the hope that it will be useful, 00018 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 // GNU General Public License for more details. 00021 // 00022 // You should have received a copy of version 2.0 of the GNU General 00023 // Public License along with this program; if not, write to the Free 00024 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 00025 // MA 02110-1301, USA. 00026 // 00027 // 00028 // ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ## 00029 // 00030 00031 /*! \file ezdiscountrule.php 00032 */ 00033 00034 /*! 00035 \class eZDiscountRule ezdiscountrule.php 00036 \brief The class eZDiscountRule does 00037 00038 */ 00039 00040 //include_once( "kernel/classes/ezpersistentobject.php" ); 00041 00042 class eZDiscountRule extends eZPersistentObject 00043 { 00044 /*! 00045 Constructor 00046 */ 00047 function eZDiscountRule( $row ) 00048 { 00049 $this->eZPersistentObject( $row ); 00050 } 00051 00052 static 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 static function fetch( $id, $asObject = true ) 00069 { 00070 return eZPersistentObject::fetchObject( eZDiscountRule::definition(), 00071 null, 00072 array( "id" => $id ), 00073 $asObject ); 00074 } 00075 00076 static function fetchList( $asObject = true ) 00077 { 00078 return eZPersistentObject::fetchObjectList( eZDiscountRule::definition(), 00079 null, null, null, null, 00080 $asObject ); 00081 } 00082 00083 static 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 \note Transaction unsafe. If you call several transaction unsafe methods you must enclose 00093 the calls within a db transaction; thus within db->begin and db->commit. 00094 */ 00095 static function removeByID( $id ) 00096 { 00097 eZPersistentObject::removeObject( eZDiscountRule::definition(), 00098 array( "id" => $id ) ); 00099 } 00100 } 00101 ?>