Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

ezurlobjectlink.php
Go to the documentation of this file.
1 <?php
18 class eZURLObjectLink extends eZPersistentObject
19 {
20 static function definition()
21 {
22 static $definition = array( 'fields' => array( 'url_id' => array( 'name' => 'URLID',
23 'datatype' => 'integer',
24 'default' => 0,
25 'required' => true,
26 'foreign_class' => 'eZURL',
27 'foreign_attribute' => 'id',
28 'multiplicity' => '1..*' ),
29 'contentobject_attribute_id' => array( 'name' => 'ContentObjectAttributeID',
30 'datatype' => 'integer',
31 'default' => 0,
32 'required' => true,
33 'foreign_class' => 'eZContentObjectAttribute',
34 'foreign_attribute' => 'id',
35 'multiplicity' => '1..*' ),
36 'contentobject_attribute_version' => array( 'name' => 'ContentObjectAttributeVersion',
37 'datatype' => 'integer',
38 'default' => 0,
39 'short_name' => 'contentobject_attr_version',
40 'required' => true ) ),
41 'keys' => array( 'url_id', 'contentobject_attribute_id', 'contentobject_attribute_version' ),
42 'sort' => array( 'url_id' => 'asc' ),
43 'class_name' => 'eZURLObjectLink',
44 'name' => 'ezurl_object_link' );
45 return $definition;
46 }
47
51 static function create( $urlID, $contentObjectAttributeID, $contentObjectAttributeVersion )
52 {
53 $row = array(
54 'url_id' => $urlID,
55 'contentobject_attribute_id' => $contentObjectAttributeID,
56 'contentobject_attribute_version' => $contentObjectAttributeVersion );
57 return new eZURLObjectLink( $row );
58 }
59
64 static function fetch( $urlID, $contentObjectAttributeID, $contentObjectAttributeVersion, $asObject = true )
65 {
66 return eZPersistentObject::fetchObject( eZURLObjectLink::definition(),
67 null,
68 array( 'url_id' => $urlID,
69 'contentobject_attribute_id' => $contentObjectAttributeID,
70 'contentobject_attribute_version' => $contentObjectAttributeVersion ),
71 $asObject );
72 }
73
78 static function hasObjectLinkList( $urlID )
79 {
80 return ( eZURLObjectLink::fetchObjectVersionCount( $urlID ) > 0 );
81 }
82
87 static function fetchObjectVersionList( $urlID, $parameters = false )
88 {
89 $objectVersionList = array();
90 $urlObjectLinkList = eZPersistentObject::fetchObjectList( eZURLObjectLink::definition(),
91 null,
92 array( 'url_id' => $urlID ),
93 null,
94 $parameters,
95 true );
96 $storedVersionList = array();
97 foreach ( $urlObjectLinkList as $urlObjectLink )
98 {
99 $objectAttributeID = $urlObjectLink->attribute( 'contentobject_attribute_id' );
100 $objectAttributeVersion = $urlObjectLink->attribute( 'contentobject_attribute_version' );
101 $objectAttribute = eZContentObjectAttribute::fetch( $objectAttributeID, $objectAttributeVersion );
102 if ( $objectAttribute ) // Object and version has been deleted
103 {
104 $objectID = $objectAttribute->attribute( 'contentobject_id' );
105 $objectVersion = $objectAttribute->attribute( 'version' );
106 $object = eZContentObject::fetch( $objectID );
107 if ( $object )
108 {
109 $versionObject = $object->version( $objectVersion );
110 if ( $versionObject and !in_array( $versionObject->attribute( 'id' ), $storedVersionList ) )
111 {
112 $objectVersionList[] = $versionObject;
113 $storedVersionList[] = $versionObject->attribute( 'id' );
114 }
115 }
116 }
117 }
118 return $objectVersionList;
119 }
120
125 static function fetchObjectVersionCount( $urlID )
126 {
127 $result = eZPersistentObject::fetchObjectList( eZURLObjectLink::definition(),
128 array(),
129 array( 'url_id' => $urlID ),
130 false,
131 null,
132 false,
133 false,
134 array( array( 'operation' => 'count( * )',
135 'name' => 'count' ) ) );
136 return $result[0]['count'];
137 }
138
144 static function removeURLlinkList( $contentObjectAttributeID, $contentObjectAttributeVersion )
145 {
146 $conditions = array( 'contentobject_attribute_id' => $contentObjectAttributeID );
147 if ( $contentObjectAttributeVersion !== false )
148 $conditions['contentobject_attribute_version'] = $contentObjectAttributeVersion;
149 eZPersistentObject::removeObject( eZURLObjectLink::definition(),
150 $conditions );
151 }
152
153
159 static function fetchLinkList( $contentObjectAttributeID, $contentObjectAttributeVersion, $asObject = true )
160 {
161 $linkList = array();
162
163 $urlObjectLinkList = self::fetchLinkObjectList( $contentObjectAttributeID, $contentObjectAttributeVersion, $asObject );
164
165 foreach ( $urlObjectLinkList as $urlObjectLink )
166 {
167 if ( $asObject )
168 {
169 $linkID = $urlObjectLink->attribute( 'url_id' );
170 $linkList[] = eZURL::fetch( $linkID );
171 }
172 else
173 {
174 $linkID = $urlObjectLink['url_id'];
175 $linkList[] = $linkID;
176 }
177 }
178 return $linkList;
179 }
180
190 static public function fetchLinkObjectList( $contentObjectAttributeID, $contentObjectAttributeVersion, $asObject = true )
191 {
192 $conditions = array( 'contentobject_attribute_id' => $contentObjectAttributeID );
193
194 if ( $contentObjectAttributeVersion !== false )
195 {
196 $conditions['contentobject_attribute_version'] = $contentObjectAttributeVersion;
197 }
198
199 return eZPersistentObject::fetchObjectList(
200 eZURLObjectLink::definition(),
201 null,
202 $conditions,
203 null,
204 null,
205 $asObject
206 );
207 }
208
213 static function clearCacheForObjectLink( $urlID )
214 {
215 $urlObjectLinkList = eZPersistentObject::fetchObjectList( eZURLObjectLink::definition(),
216 null,
217 array( 'url_id' => $urlID ),
218 null,
219 null,
220 true );
221 foreach ( $urlObjectLinkList as $urlObjectLink )
222 {
223 $objectAttributeID = $urlObjectLink->attribute( 'contentobject_attribute_id' );
224 $objectAttributeVersion = $urlObjectLink->attribute( 'contentobject_attribute_version' );
225 $objectAttribute = eZContentObjectAttribute::fetch( $objectAttributeID, $objectAttributeVersion );
226 if ( $objectAttribute )
227 {
228 $objectID = $objectAttribute->attribute( 'contentobject_id' );
229 $objectVersion = $objectAttribute->attribute( 'version' );
230 eZContentCacheManager::clearContentCacheIfNeeded( $objectID, $objectVersion );
231 }
232 }
233 }
234
235
237 public $URLID;
238 public $ContentObjectAttributeID;
239 public $ContentObjectAttributeVersion;
240 }
241 ?>
eZContentCacheManager\clearContentCacheIfNeeded
static clearContentCacheIfNeeded( $objectID, $versionNum=true, $additionalNodeList=false)
Definition: ezcontentcachemanager.php:1062
eZContentObjectAttribute\fetch
static fetch( $id, $version, $asObject=true, $field_filters=null)
Definition: ezcontentobjectattribute.php:136
eZContentObject\fetch
static fetch( $id, $asObject=true)
Definition: ezcontentobject.php:885
eZPersistentObject
Definition: ezpersistentobject.php:33
eZPersistentObject\fetchObject
static fetchObject( $def, $field_filters, $conds, $asObject=true, $grouping=null, $custom_fields=null)
Definition: ezpersistentobject.php:213
eZPersistentObject\removeObject
static removeObject( $def, $conditions=null, $extraConditions=null)
Definition: ezpersistentobject.php:271
eZPersistentObject\fetchObjectList
static fetchObjectList( $def, $field_filters=null, $conds=null, $sorts=null, $limit=null, $asObject=true, $grouping=false, $custom_fields=null, $custom_tables=null, $custom_conds=null)
Definition: ezpersistentobject.php:806
eZURLObjectLink
The class eZURLObjectLink does.
Definition: ezurlobjectlink.php:19
eZURLObjectLink\$ContentObjectAttributeID
$ContentObjectAttributeID
Definition: ezurlobjectlink.php:238
eZURLObjectLink\clearCacheForObjectLink
static clearCacheForObjectLink( $urlID)
Definition: ezurlobjectlink.php:213
eZURLObjectLink\create
static create( $urlID, $contentObjectAttributeID, $contentObjectAttributeVersion)
Definition: ezurlobjectlink.php:51
eZURLObjectLink\$ContentObjectAttributeVersion
$ContentObjectAttributeVersion
Definition: ezurlobjectlink.php:239
eZURLObjectLink\definition
static definition()
Definition: ezurlobjectlink.php:20
eZURLObjectLink\fetch
static fetch( $urlID, $contentObjectAttributeID, $contentObjectAttributeVersion, $asObject=true)
Definition: ezurlobjectlink.php:64
eZURLObjectLink\$URLID
$URLID
Definition: ezurlobjectlink.php:237
eZURLObjectLink\fetchLinkList
static fetchLinkList( $contentObjectAttributeID, $contentObjectAttributeVersion, $asObject=true)
Definition: ezurlobjectlink.php:159
eZURLObjectLink\fetchObjectVersionCount
static fetchObjectVersionCount( $urlID)
Definition: ezurlobjectlink.php:125
eZURLObjectLink\hasObjectLinkList
static hasObjectLinkList( $urlID)
Definition: ezurlobjectlink.php:78
eZURLObjectLink\removeURLlinkList
static removeURLlinkList( $contentObjectAttributeID, $contentObjectAttributeVersion)
Definition: ezurlobjectlink.php:144
eZURLObjectLink\fetchLinkObjectList
static fetchLinkObjectList( $contentObjectAttributeID, $contentObjectAttributeVersion, $asObject=true)
Definition: ezurlobjectlink.php:190
eZURLObjectLink\fetchObjectVersionList
static fetchObjectVersionList( $urlID, $parameters=false)
Definition: ezurlobjectlink.php:87
eZURL\fetch
static fetch( $id, $asObject=true)
Definition: ezurl.php:211
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.