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 include_once( "lib/ezdb/classes/ezdb.php" );
00035 include_once( "kernel/classes/ezpersistentobject.php" );
00036 include_once( "kernel/classes/ezcontentclassattribute.php" );
00037
00038
00039
00040
00041
00042
00043
00044 class eZEnumObjectValue extends eZPersistentObject
00045 {
00046
00047
00048
00049 function eZEnumObjectValue( $row )
00050 {
00051 $this->eZPersistentObject( $row );
00052 }
00053
00054 function definition()
00055 {
00056 return array( "fields" => array( "contentobject_attribute_id" => array( 'name' => "ContentObjectAttributeID",
00057 'datatype' => 'integer',
00058 'default' => 0,
00059 'required' => true,
00060 'foreign_class' => 'eZContentObjectAttribute',
00061 'foreign_attribute' => 'id',
00062 'multiplicity' => '1..*' ),
00063 "contentobject_attribute_version" => array( 'name' => "ContentObjectAttributeVersion",
00064 'datatype' => 'integer',
00065 'default' => 0,
00066 'required' => true,
00067 'short_name' => 'contentobject_attr_version' ),
00068 "enumid" => array( 'name' => "EnumID",
00069 'datatype' => 'integer',
00070 'default' => 0,
00071 'required' => true ),
00072 "enumelement" => array( 'name' => "EnumElement",
00073 'datatype' => 'string',
00074 'default' => '',
00075 'required' => true ),
00076 "enumvalue" => array( 'name' => "EnumValue",
00077 'datatype' => 'string',
00078 'default' => '',
00079 'required' => true ) ),
00080 "keys" => array( "contentobject_attribute_id", "contentobject_attribute_version", "enumid" ),
00081 "sort" => array( "contentobject_attribute_id" => "asc" ),
00082 "class_name" => "eZEnumObjectValue",
00083 "name" => "ezenumobjectvalue" );
00084 }
00085
00086 function create( $contentObjectAttributeID, $contentObjectAttributeVersion, $enumID, $enumElement, $enumValue )
00087 {
00088 $row = array( "contentobject_attribute_id" => $contentObjectAttributeID,
00089 "contentobject_attribute_version" => $contentObjectAttributeVersion,
00090 "enumid" => $enumID,
00091 "enumelement" => $enumElement,
00092 "enumvalue" => $enumValue );
00093 return new eZEnumObjectValue( $row );
00094 }
00095
00096 function removeAllElements( $contentObjectAttributeID, $contentObjectAttributeVersion )
00097 {
00098 if( $contentObjectAttributeVersion == null )
00099 {
00100 eZPersistentObject::removeObject( eZEnumObjectValue::definition(),
00101 array( "contentobject_attribute_id" => $contentObjectAttributeID ) );
00102 }
00103 else
00104 {
00105 eZPersistentObject::removeObject( eZEnumObjectValue::definition(),
00106 array( "contentobject_attribute_id" => $contentObjectAttributeID,
00107 "contentobject_attribute_version" => $contentObjectAttributeVersion ) );
00108 }
00109 }
00110
00111 function remove( $contentObjectAttributeID, $contentObjectAttributeVersion, $enumid )
00112 {
00113 eZPersistentObject::removeObject( eZEnumObjectValue::definition(),
00114 array( "enumid" => $enumid,
00115 "contentobject_attribute_id" => $contentObjectAttributeID,
00116 "contentobject_attribute_version" => $contentObjectAttributeVersion ) );
00117 }
00118
00119 function fetch( $contentObjectAttributeID, $contentObjectAttributeVersion, $enumid, $asObject = true )
00120 {
00121 return eZPersistentObject::fetchObject( eZEnumObjectValue::definition(),
00122 null,
00123 array( "contentobject_attribute_id" => $contentObjectAttributeID,
00124 "contentobject_attribute_version" => $contentObjectAttributeVersion,
00125 "enumid" => $enumid ),
00126 $asObject );
00127 }
00128
00129 function fetchAllElements( $contentObjectAttributeID, $contentObjectAttributeVersion, $asObject = true )
00130 {
00131 return eZPersistentObject::fetchObjectList( eZEnumObjectValue::definition(),
00132 null,
00133 array( "contentobject_attribute_id" => $contentObjectAttributeID,
00134 "contentobject_attribute_version" => $contentObjectAttributeVersion ),
00135 null,
00136 null,
00137 $asObject );
00138 }
00139
00140 var $ContentObjectAttributeID;
00141 var $ContentObjectAttributeVersion;
00142 var $EnumID;
00143 var $EnumElement;
00144 var $EnumValue;
00145 }
00146
00147 ?>