eZ Community » Forums » Developer » How to update an eZBinary field in PHP?
expandshrink

How to update an eZBinary field in PHP?

How to update an eZBinary field in PHP?

Thursday 21 March 2013 10:09:43 am - 2 replies

Hi there,

Creating an object with a binary field is simple as:

$params = array();
$params['parent_node_id'] = 125;
$params['class_identifier'] = 'image';
$params['storage_dir'] = 'wherever_the_files_are_stored/';
 
$attributeData = array();
$attributeData['name'] = $name;
$attributeData['image'] = $file;
 
$params['attributes'] = $attributeData;
 
eZContentFunctions::createAndPublishObject( $params );

But I can't find how to update an existing binary file with PHP.

Could someone help me to do this?

 

Thanks,

 

Damien

Thursday 21 March 2013 10:59:12 am

Hi Damien,

You should look at eZContentFunctions::updateAndPublishObject(). It works the same way and allows to easily update any content object.

Cheers

Thursday 21 March 2013 4:47:32 pm

I tryed the function:

$videos = eZContentObjectTreeNode::subtreeByNodeId(
        array(
                'ClassFilterType' => 'include',
                'ClassFilterArray' => array( 'video' )
        ),
        18558
);
 
foreach ( $videos as $v )
{
 
        $params = array();
        $params['storage_dir'] = "extension/slingshot/stubs/videos/";
 
        $attributeData = array();
        $attributeData['image'] = "376_GARE_CENTRE.mp4";
 
        $params['attributes'] = $attributeData;
 
        eZContentFunctions::updateAndPublishObject( $v->object(), $params );
 
}

But nothing changed in my object...

expandshrink

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

36 542 Users on board!

Forums menu

Proudly Developed with from