[ Index ] |
|
Code source de eZ Publish 3.9.0 |
1 <?php 2 // 3 // Definition of eZProductCollectionItemOption class 4 // 5 // Created on: <10-æÅ×-2003 16:04:18 sp> 6 // 7 // SOFTWARE NAME: eZ publish 8 // SOFTWARE RELEASE: 3.9.0 9 // BUILD VERSION: 17785 10 // COPYRIGHT NOTICE: Copyright (C) 1999-2006 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 29 /*! \file ezproductcollectionitemoption.php 30 */ 31 32 /*! 33 \class eZProductCollectionItemOption ezproductcollectionitemoption.php 34 \brief The class eZProductCollectionItemOption does 35 36 */ 37 38 class eZProductCollectionItemOption extends eZPersistentObject 39 { 40 /*! 41 Constructor 42 */ 43 function eZProductCollectionItemOption( $row ) 44 { 45 $this->eZPersistentObject( $row ); 46 47 } 48 49 function definition() 50 { 51 return array( "fields" => array( "id" => array( 'name' => 'ID', 52 'datatype' => 'integer', 53 'default' => 0, 54 'required' => true ), 55 'item_id' => array( 'name' => 'ItemID', 56 'datatype' => 'integer', 57 'default' => 0, 58 'required' => true, 59 'foreign_class' => 'eZProductCollectionItem', 60 'foreign_attribute' => 'id', 61 'multiplicity' => '1..*' ), 62 'option_item_id' => array( 'name' => 'OptionItemID', 63 'datatype' => 'integer', 64 'default' => 0, 65 'required' => true, 66 'foreign_class' => 'eZProductCollectionItemOption', 67 'foreign_attribute' => 'id', 68 'multiplicity' => '1..*' ), 69 'object_attribute_id' => array( 'name' => 'ObjectAttributeID', 70 'datatype' => 'integer', 71 'default' => 0, 72 'required' => true, 73 'foreign_class' => 'eZContentObjectAttribute', 74 'foreign_attribute' => 'id', 75 'multiplicity' => '1..*' ), 76 'name' => array( 'name' => 'Name', 77 'datatype' => 'string', 78 'default' => '', 79 'required' => true ), 80 'value' => array( 'name' => 'Value', 81 'datatype' => 'string', 82 'default' => '', 83 'required' => true ), 84 'price' => array( 'name' => 'Price', 85 'datatype' => 'float', 86 'default' => 0, 87 'required' => true ) ), 88 "keys" => array( "id" ), 89 "increment_key" => "id", 90 "class_name" => "eZProductCollectionItemOption", 91 "name" => "ezproductcollection_item_opt" ); 92 } 93 94 function create( $productCollectionItemID, $optionItemID, $optionName, $optionValue, $optionPrice, $attributeID ) 95 { 96 $row = array( 'item_id' => $productCollectionItemID, 97 'option_item_id' => $optionItemID, 98 'name' => $optionName, 99 'value' => $optionValue, 100 'price' => $optionPrice, 101 'object_attribute_id' => $attributeID ); 102 return new eZProductCollectionItemOption( $row ); 103 } 104 105 /*! 106 Clones the collection item option object and returns it. The ID of the clone is erased. 107 */ 108 function clone() 109 { 110 $item = $this; 111 $item->setAttribute( 'id', null ); 112 return $item; 113 } 114 115 /*! 116 Copies the collection object item option, 117 the new copy will point to the collection item \a $collectionItemID. 118 \return the new collection item option object. 119 \note The new collection item option will already be present in the database. 120 \note Transaction unsafe. If you call several transaction unsafe methods you must enclose 121 the calls within a db transaction; thus within db->begin and db->commit. 122 */ 123 function ©( $collectionItemID ) 124 { 125 $item = $this->clone(); 126 $item->setAttribute( 'item_id', $collectionItemID ); 127 $item->store(); 128 return $item; 129 } 130 131 function fetchList( $productCollectionItemID, $asObject = true ) 132 { 133 return eZPersistentObject::fetchObjectList( eZProductCollectionItemOption::definition(), 134 null, array( "item_id" => $productCollectionItemID ), 135 array( "id" => "ASC" ), 136 null, 137 $asObject ); 138 } 139 140 /*! 141 \static 142 Removes all product collections options which are related to the collection items specified in the array \a $itemIDList. 143 \note Transaction unsafe. If you call several transaction unsafe methods you must enclose 144 the calls within a db transaction; thus within db->begin and db->commit. 145 */ 146 function cleanupList( $itemIDList ) 147 { 148 $db =& eZDB::instance(); 149 $idText = $db->implodeWithTypeCast( ', ', $itemIDList, 'int' ); 150 $db->query( "DELETE FROM ezproductcollection_item_opt WHERE item_id IN ( $idText )" ); 151 } 152 153 } 154 155 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Feb 24 10:30:04 2007 | par Balluche grâce à PHPXref 0.7 |