|
eZ Publish
[4.0]
|
00001 <?php 00002 // 00003 // Definition of eZDiscountSubRule 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 eZDiscountSubRuleValue ezdiscountsubrule.php 00036 \brief The class eZDiscountSubRuleValue does 00037 00038 */ 00039 //include_once( "kernel/classes/ezpersistentobject.php" ); 00040 class eZDiscountSubRuleValue extends eZPersistentObject 00041 { 00042 /*! 00043 Constructor 00044 */ 00045 function eZDiscountSubRuleValue( $row ) 00046 { 00047 $this->eZPersistentObject( $row ); 00048 } 00049 00050 static function definition() 00051 { 00052 return array( "fields" => array( "discountsubrule_id" => array( 'name' => "DiscountSubRuleID", 00053 'datatype' => 'integer', 00054 'default' => 0, 00055 'required' => true, 00056 'foreign_class' => 'eZDiscountSubRule', 00057 'foreign_attribute' => 'id', 00058 'multiplicity' => '1..*' ), 00059 "value" => array( 'name' => "Value", 00060 'datatype' => 'integer', 00061 'default' => 0, 00062 'required' => true ), 00063 "issection" => array( 'name' => "IsSection", 00064 'datatype' => 'integer', 00065 'default' => 0, 00066 'required' => true ) ), 00067 "keys" => array( "discountsubrule_id", "value", "issection" ), 00068 "increment_key" => "discountsubrule_id", 00069 "class_name" => "eZDiscountSubRuleValue", 00070 "name" => "ezdiscountsubrule_value" ); 00071 } 00072 00073 static function fetchBySubRuleID( $discountSubRuleID, $isSection = 0, $asObject = true ) 00074 { 00075 return eZPersistentObject::fetchObjectList( eZDiscountSubRuleValue::definition(), 00076 null, 00077 array( "discountsubrule_id" => $discountSubRuleID, 00078 "issection" => $isSection ), 00079 null, 00080 null, 00081 $asObject ); 00082 } 00083 00084 static function fetchList( $asObject = true ) 00085 { 00086 return eZPersistentObject::fetchObjectList( eZDiscountSubRuleValue::definition(), 00087 null, null, null, null, 00088 $asObject ); 00089 } 00090 00091 static function create( $discountSubRuleID, $value, $isSection = false ) 00092 { 00093 $row = array( "discountsubrule_id" => $discountSubRuleID, 00094 "value" => $value, 00095 "issection" => $isSection ); 00096 return new eZDiscountSubRuleValue( $row ); 00097 } 00098 00099 /*! 00100 \note Transaction unsafe. If you call several transaction unsafe methods you must enclose 00101 the calls within a db transaction; thus within db->begin and db->commit. 00102 */ 00103 static function removeBySubRuleID ( $discountSubRuleID ) 00104 { 00105 eZPersistentObject::removeObject( eZDiscountSubRuleValue::definition(), 00106 array( "discountsubrule_id" => $discountSubRuleID ) ); 00107 } 00108 } 00109 ?>