PHP fetch the options stored in an class attribute

Author Message

Felix Laate

Wednesday 22 March 2006 6:24:11 am

Hi all,

another php-related question for you all:

In an event, I need to fetch the options stored in an class attribute (of type ezSelection). I've fooled around with the <i>eZContentClassAttribute</i> class, doing something like this:

$classAtrribute =& eZContentClassAttribute::fetch(278);
$caContent =& $classAtrribute->content();
$caOptions =& $caContent['options'];

But it will not work.

Any help is helpful!

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Kristof Coomans

Wednesday 22 March 2006 9:31:36 am

Hi Felix

Did you fetch the right class attribute? Inspect it with

var_dump( $classAttribute );

If it's the right class attribute, take a look at it's content with

var_dump( $caContent );

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Betsy Gamrat

Wednesday 22 March 2006 10:30:15 am

eZ selections are stored as integers in data_int

$attribs =& $iObject->contentObjectAttributes();
	for($i=0;$i<count($attribs);$i++){
		switch($attribs[$i]->attribute("contentclass_attribute_identifier")) {
			case 'a':
	 			$attribs[$i]->setAttribute('data_int', $a );
	 			$attribs[$i]->store();
			break;
			case 'b':
				$attribs[$i]->setAttribute('data_int',$b);
				$attribs[$i]->store();
		}
	}

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 31 2025 06:21:48
Script start
Timing: Jan 31 2025 06:21:48
Module start 'layout'
Timing: Jan 31 2025 06:21:48
Module start 'content'
Timing: Jan 31 2025 06:21:48
Module end 'content'
Timing: Jan 31 2025 06:21:48
Script end

Main resources:

Total runtime0.0134 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0050 588.2656151.2266
Module start 'layout' 0.00500.0021 739.492236.6953
Module start 'content' 0.00710.0052 776.187590.2188
Module end 'content' 0.01220.0012 866.406333.9922
Script end 0.0134  900.3984 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002417.8575140.0002
Check MTime0.00118.1649140.0001
Mysql Total
Database connection0.00085.989710.0008
Mysqli_queries0.001914.466930.0006
Looping result0.00000.067410.0000
Template Total0.00096.610.0009
Template load0.00075.379410.0007
Template processing0.00021.162110.0002
Override
Cache load0.00053.929910.0005
General
dbfile0.001511.010880.0002
String conversion0.00000.037340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs