ZF-3841: Expand Zend_Dojo_Data to include custom parameters


The dojo.data.QueryReadStore requires a "numRows" parameter of the data JSON block. While patching this particular parameter would be easy, it might be better to allow a user-expandable array for any parameters they might want to add. I have implemented such in my extension of this class.

<?php class Dojoplus_Data extends Zend_Dojo_Data { public $extra_params = array(); public function set_extra_param($pKey, $pValue){ $this->extra_params[$pKey] = $pValue; } public function get_extra_param($pKey){ if(isset($this->extra_params[$pKey])): return $this->extra_params[$pKey]; else: return NULL; endif; } public function toArray(){ return array_merge($this->extra_params, parent::toArray()); } } ?>


Patch committed to trunk and 1.6 release branch. API is as follows:

// Set the "numRows" to 100
$data->setMetadata('numRows', 100);

// Set several items at once:
    'numRows' => 100,
    'sort'    => 'name',

// Inspect a single metadata value:
$numRows = $data->getMetadata('numRows');

// Inspect all metadata:
$metadata = $data->getMetadata();

// Remove a metadata item:

// Remove all metadata: