Share » Forums » Developer » Fetch a class attribute by is ID...

Fetch a class attribute by is ID only, in PHP

Fetch a class attribute by is ID only, in PHP

Thursday 12 March 2009 3:45:27 am - 3 replies

Modified on Thursday 12 March 2009 8:35:45 am by Olivier Portier

Author Message

Olivier Portier

Thursday 12 March 2009 8:33:02 am

The attribute ID is a ContentClassAttribute not a ContentObjectAttribute.
So to get the identifier of this attribute, i just have to do this :

        $reverse_attribute = eZContentClassAttribute::fetch( $attribute_id );
        $attribute_identifier = $reverse_attribute->attribute('identifier');

I reached my goal !!!
Olivier

André R.

Thursday 12 March 2009 9:54:47 am

In 4.1 you can also use eZContentClassAttribute::classAttributeIdentifierByID / classAttributeIDByIdentifier, this is cached so no db calls are done.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Olivier Portier

Friday 13 March 2009 1:39:49 am

Great, it is much better like this :

    $reverse_attribute = eZContentClassAttribute::classAttributeIdentifierByID( 391 );

Thanks André

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu