Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

ezcontentclassedithandler.php
Go to the documentation of this file.
1 <?php
14 class eZContentClassEditHandler
15 {
16
24 public function store( eZContentClass $class, array $attributes, array &$unorderedParameters )
25 {
26 $oldClassAttributes = $class->fetchAttributes( $class->attribute( 'id' ), true, eZContentClass::VERSION_STATUS_DEFINED );
27 // Delete object attributes which have been removed.
28 foreach ( $oldClassAttributes as $oldClassAttribute )
29 {
31 $attributeExists = false;
32 $oldClassAttributeID = $oldClassAttribute->attribute( 'id' );
33 foreach ( $class->fetchAttributes( ) as $newClassAttribute )
34 {
35 if ( $oldClassAttributeID == $newClassAttribute->attribute( 'id' ) )
36 {
37 $attributeExists = true;
38 break;
39 }
40 }
41 if ( !$attributeExists )
42 {
43 foreach ( eZContentObjectAttribute::fetchSameClassAttributeIDList( $oldClassAttributeID ) as $objectAttribute )
44 {
45 $objectAttribute->removeThis( $objectAttribute->attribute( 'id' ) );
46 }
47
48 if( $oldClassAttribute->datatype() !== null )
49 $oldClassAttribute->datatype()->deleteNotVersionedStoredClassAttribute( $oldClassAttribute );
50 }
51 }
52 $class->storeDefined( $attributes );
53
54 // Add object attributes which have been added.
55 foreach ( $attributes as $newClassAttribute )
56 {
57 $attributeExists = false;
58 $newClassAttributeID = $newClassAttribute->attribute( 'id' );
59 foreach ( $oldClassAttributes as $oldClassAttribute )
60 {
61 if ( $newClassAttributeID == $oldClassAttribute->attribute( 'id' ) )
62 {
63 $attributeExists = true;
64 break;
65 }
66 }
67 if ( !$attributeExists )
68 {
69 $newClassAttribute->initializeObjectAttributes( $objects );
70 }
71 }
72 }
73 }
74
75 ?>
eZContentClassEditHandler
Definition: ezcontentclassedithandler.php:15
eZContentClass
Handles eZ Publish content classes.
Definition: ezcontentclass.php:20
eZContentClass\fetchAttributes
fetchAttributes( $id=false, $asObject=true, $version=eZContentClass::VERSION_STATUS_DEFINED)
Definition: ezcontentclass.php:1320
eZContentClass\VERSION_STATUS_DEFINED
const VERSION_STATUS_DEFINED
Definition: ezcontentclass.php:22
eZContentClass\storeDefined
storeDefined( $attributes)
Definition: ezcontentclass.php:993
eZContentObjectAttribute\fetchSameClassAttributeIDList
static fetchSameClassAttributeIDList( $contentClassAttributeID, $asObject=true, $version=false, $contentObjectID=false, $limit=null)
Definition: ezcontentobjectattribute.php:205
eZPersistentObject\attribute
attribute( $attr, $noFunction=false)
Definition: ezpersistentobject.php:1329
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.