public function process($processor) {
        if (!$processor instanceof base_processor) { // No correct processor, throw exception
            throw new base_element_struct_exception('incorrect_processor');
        }

        $iterator = $this->get_iterator($processor); // Get the iterator over backup-able data

        foreach ($iterator as $key => $values) { // Process each "ocurrrence" of the nested element (recordset or array)

            // Fill the values of the attributes and final elements with the $values from the iterator
            $this->fill_values($values);

            // Perform pre-process tasks for the nested_element
            $processor->pre_process_nested_element($this);

            // Delegate the process of each attribute
            foreach ($this->get_attributes() as $attribute) {
                $attribute->process($processor);
            }

            // Main process tasks for the nested element, once its attributes have been processed
            $processor->process_nested_element($this);

            // Delegate the process of each final_element
            foreach ($this->get_final_elements() as $final_element) {
                $final_element->process($processor);
            }

            // Delegate the process to the optigroup
            if ($this->get_optigroup()) {
                $this->get_optigroup()->process($processor);
            }

            // Delegate the process to each child nested_element
            foreach ($this->get_children() as $child) {
                $child->process($processor);
            }

            // Perform post-process tasks for the nested element
            $processor->post_process_nested_element($this);

            // Everything processed, clean values before next iteration
            $this->clean_values();

            // Increment counter for this element
            $this->counter++;

            // For root element, check we only have 1 element
            if ($this->get_parent() === null && $this->counter > 1) {
                throw new base_element_struct_exception('root_only_one_ocurrence', $this->get_name());
            }
        }
        // Close the iterator (DB recordset / array iterator)
        $iterator->close();
    }
public function process($processor) {
        if (!$processor instanceof base_processor) { // No correct processor, throw exception
            throw new base_element_struct_exception('incorrect_processor');
        }

        $iterator = $this->get_iterator($processor); // Get the iterator over backup-able data

        foreach ($iterator as $key => $values) { // Process each "ocurrrence" of the nested element (recordset or array)

            // Fill the values of the attributes and final elements with the $values from the iterator
            $this->fill_values($values);

            // Perform pre-process tasks for the nested_element
            $processor->pre_process_nested_element($this);

            // Delegate the process of each attribute
            foreach ($this->get_attributes() as $attribute) {
                $attribute->process($processor);
            }

            // Main process tasks for the nested element, once its attributes have been processed
            $processor->process_nested_element($this);

            // Delegate the process of each final_element
            foreach ($this->get_final_elements() as $final_element) {
                $final_element->process($processor);
            }

            // Delegate the process to the optigroup
            if ($this->get_optigroup()) {
                $this->get_optigroup()->process($processor);
            }

            // Delegate the process to each child nested_element
            foreach ($this->get_children() as $child) {
                $child->process($processor);
            }

            // Perform post-process tasks for the nested element
            $processor->post_process_nested_element($this);

            // Everything processed, clean values before next iteration
            $this->clean_values();

            // Increment counter for this element
            $this->counter++;

            // For root element, check we only have 1 element
            if ($this->get_parent() === null && $this->counter > 1) {
                throw new base_element_struct_exception('root_only_one_ocurrence', $this->get_name());
            }
        }
        // Close the iterator (DB recordset / array iterator)
        $iterator->close();
    }
public function process ( $ processor ) { if ( ! $ processor instanceof base_processor ) { // No correct processor, throw exception throw new base_element_struct_exception ( 'incorrect_processor' ) ; } $ iterator = $ this -> get_iterator ( $ processor ) ; // Get the iterator over backup-able data foreach ( $ iterator as $ key => $ values ) { // Process each "ocurrrence" of the nested element (recordset or array) // Fill the values of the attributes and final elements with the $values from the iterator $ this -> fill_values ( $ values ) ; // Perform pre-process tasks for the nested_element $ processor -> pre_process_nested_element ( $ this ) ; // Delegate the process of each attribute foreach ( $ this -> get_attributes ( ) as $ attribute ) { $ attribute -> process ( $ processor ) ; } // Main process tasks for the nested element, once its attributes have been processed $ processor -> process_nested_element ( $ this ) ; // Delegate the process of each final_element foreach ( $ this -> get_final_elements ( ) as $ final_element ) { $ final_element -> process ( $ processor ) ; } // Delegate the process to the optigroup if ( $ this -> get_optigroup ( ) ) { $ this -> get_optigroup ( ) -> process ( $ processor ) ; } // Delegate the process to each child nested_element foreach ( $ this -> get_children ( ) as $ child ) { $ child -> process ( $ processor ) ; } // Perform post-process tasks for the nested element $ processor -> post_process_nested_element ( $ this ) ; // Everything processed, clean values before next iteration $ this -> clean_values ( ) ; // Increment counter for this element $ this -> counter ++ ; // For root element, check we only have 1 element if ( $ this -> get_parent ( ) === null && $ this -> counter > 1 ) { throw new base_element_struct_exception ( 'root_only_one_ocurrence' , $ this -> get_name ( ) ) ; } } // Close the iterator (DB recordset / array iterator) $ iterator -> close ( ) ; }
Process the nested element

@param object $processor the processor
@return void
Process the nested element