eZ Community » Forums » Developer » Update ezmatrix with php

Update ezmatrix with php

Update ezmatrix with php

Wednesday 05 September 2012 6:31:56 pm - 2 replies

I'm sure you're already have this problem, I want to update an ezmatrix for an object.
For example : I've a contact form viewable by authenticated users and I want to save many data (firstname, lastname, ...) because their login / password is used by many collaborators on their company.
Have you got a parts of code who can me inspire to update an ezmatrix in php ?

Wednesday 05 September 2012 9:35:03 pm

This is based on the optionmatrix which is based on the matrix so it should be easy to modify:

                                      $db = eZDB::instance();
                                    $version = $vraagObject->version( 1 );
                                    $version->setAttribute( 'status', eZContentObjectVersion::STATUS_DRAFT );
                                    $vraagObjectID = $vraagObject->attribute( 'id' );
                                    $vraagDataMap = $vraagObject->fetchDataMap();
                                    $filter1 = $vraagDataMap['filter_1'];
                                    $matrix1 = new optionMatrix();
                                    $filter1->setAttribute('data_text','<optionmatrix type_value="0">
                                                            <name>Man of Vrouw</name>
                                                            <columns number="2">
                                                            <column num="0" id="optieidentifier">Optieidentifier</column>
                                                            <column num="1" id="optietext">Optietext</column>
                                                            <rows number="2"/>
                                    $contentObjectID = $vraagObject->attribute( 'id' );
                                    $operationResult = eZOperationHandler::execute( 'content', 'publish', array( 'object_id' => $contentObjectID, 'version' => 1  ) );
                                if ($operationResult)
                                    if ( $vraagObject )
                                        $vraagNode = eZContentObjectTreeNode::fetch($vraagObject->attribute('main_node_id')  );

Monday 10 September 2012 12:04:18 pm

Thanks for this answer.


I managed to set up a system allowing me to update my matrix.




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

36 542 Users on board!

Forums menu

Proudly Developed with from