- Fixed #16160: Call to undefined function ezi18n()
[tinyz:tinyz.git] / kernel / classes / ezdiscountrule.php
1 <?php
2 //
3 // Definition of eZDiscountRule class
4 //
5 // Created on: <27-Nov-2002 13:05:59 wy>
6 //
7 // ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
8 // SOFTWARE NAME: eZ Publish
9 // SOFTWARE RELEASE: 4.1.x
10 // COPYRIGHT NOTICE: Copyright (C) 1999-2010 eZ Systems AS
11 // SOFTWARE LICENSE: GNU General Public License v2.0
12 // NOTICE: >
13 //   This program is free software; you can redistribute it and/or
14 //   modify it under the terms of version 2.0  of the GNU General
15 //   Public License as published by the Free Software Foundation.
16 //
17 //   This program is distributed in the hope that it will be useful,
18 //   but WITHOUT ANY WARRANTY; without even the implied warranty of
19 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 //   GNU General Public License for more details.
21 //
22 //   You should have received a copy of version 2.0 of the GNU General
23 //   Public License along with this program; if not, write to the Free
24 //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
25 //   MA 02110-1301, USA.
26 //
27 //
28 // ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
29 //
30
31 /*! \file
32 */
33
34 /*!
35   \class eZDiscountRule ezdiscountrule.php
36   \brief The class eZDiscountRule does
37
38 */
39
40 class eZDiscountRule extends eZPersistentObject
41 {
42     /*!
43      Constructor
44     */
45     function eZDiscountRule( $row )
46     {
47         $this->eZPersistentObject( $row );
48     }
49
50     static function definition()
51     {
52         return array( "fields" => array( "id" => array( 'name' => 'ID',
53                                                          'datatype' => 'integer',
54                                                          'default' => 0,
55                                                          'required' => true ),
56                                          "name" => array( 'name' => "Name",
57                                                          'datatype' => 'string',
58                                                          'default' => '',
59                                                          'required' => true ) ),
60                       "keys" => array( "id" ),
61                       "increment_key" => "id",
62                       "class_name" => "eZDiscountRule",
63                       "name" => "ezdiscountrule" );
64     }
65
66     static function fetch( $id, $asObject = true )
67     {
68         return eZPersistentObject::fetchObject( eZDiscountRule::definition(),
69                                                 null,
70                                                 array( "id" => $id ),
71                                                 $asObject );
72     }
73
74     static function fetchList( $asObject = true )
75     {
76         return eZPersistentObject::fetchObjectList( eZDiscountRule::definition(),
77                                                     null, null, null, null,
78                                                     $asObject );
79     }
80
81     static function create()
82     {
83         $row = array(
84             "id" => null,
85             "name" => ezpI18n::translate( "kernel/shop/discountgroup", "New discount group" ) );
86         return new eZDiscountRule( $row );
87     }
88
89     /*!
90      \note Transaction unsafe. If you call several transaction unsafe methods you must enclose
91      the calls within a db transaction; thus within db->begin and db->commit.
92      */
93     static function removeByID( $id )
94     {
95         eZPersistentObject::removeObject( eZDiscountRule::definition(),
96                                           array( "id" => $id ) );
97     }
98 }
99 ?>