Source for file ViewMapper.php
Documentation is available at ViewMapper.php
* @copyright Copyright (c) 2007 Mirchev Ideas Ltd. All rights reserved.
* The view mapper controller class
* @copyright Copyright (c) 2007 Mirchev Ideas Ltd. All rights reserved.
* @param miRecord $record
* Create all view mapper objects
$dataFields =
$this->_view->getDataFields();
foreach ($dataFields as $dataField) {
if (isset
($dataField['modelStrategy']))
$viewMappers[] =
$dataField['modelStrategy'];
foreach ($viewMappers as $viewMapper)
* @return miView the view object
* Adds new view mapper object
* @param string $viewMapperName view mapper name
* @param miViewMapper $viewMapper the view mapper object
public function addViewMapper($viewMapperName, miViewMapper $viewMapper)
* Returns the view mapper with name $viewMapperName
* @param string $viewMapperName the view mapper name (optional). If not given returns the default view mapper
* @return miViewMapper object
* Updates the form with the newly submitted values
* @param miWebForm $webForm
$formData =
$webForm->getSubmittedDataRow();
$webForm->setFormDataRow($formData);
* @param string $operation 'read', 'insert', 'update', 'preDelete' or 'delete'
* Default View to Domain Object Mapper Controller
* @copyright Copyright (c) 2007 Mirchev Ideas Ltd. All rights reserved.
public function __construct(miView $view, miDomainObject $domainObj, $pkValue)
$dataFields =
$this->_view->getDataFields();
foreach ($dataFields as $dataField)
if ($dataField['data'] ==
$fieldName)
return $dataField['properties'];
$dataFields =
$this->_view->getDataFields();
foreach ($dataFields as $dataField)
if (isset
($dataField['modelStrategy']) and ($dataField['modelStrategy'] ==
$viewMapperName))
* Retrieve the data from the web form
$formData =
$this->_webForm->getSubmittedDataRow();
$dataFields =
$this->_view->getDataFields();
foreach ($dataFields as $dataField) {
if (!isset
($formData[$dataField['data']]))
$viewMapperName = isset
($dataField['modelStrategy']) ?
$dataField['modelStrategy'] :
'';
$viewMapper->set($dataField['data'], $formData[$dataField['data']]);
* Set the data to the web form
$dataFields =
$this->_view->getDataFields();
foreach ($dataFields as $dataField) {
$viewMapperName = isset
($dataField['modelStrategy']) ?
$dataField['modelStrategy'] :
'';
$this->_webForm->setFormData($dataField['data'], $viewMapper->get($dataField['data']));
* The View Mapper base class
* @copyright Copyright (c) 2007 Mirchev Ideas Ltd. All rights reserved.
public function __construct(miViewMapperController $viewMapperController)
public function get($fieldName) {}
public function set($fieldName, $fieldValue) {}
public function read() {}
* The view to domain object mapper default class
* @copyright Copyright (c) 2007 Mirchev Ideas Ltd. All rights reserved.
public function __construct(miViewMapperController $viewMapperController, miDomainObject $domainObj, $pkValue)
public function get($fieldName)
public function set($fieldName, $fieldValue)
* Read the model data from storage
* Insert the model data as new record
Documentation generated on Thu, 08 May 2008 16:57:58 +0300 by phpDocumentor 1.4.1