function getRequestedRow($request, $args)
{
$isModified = isset($args['modify']);
if (isset($args['rowId']) && !$isModified) {
// A row ID was specified. Fetch it
$elementId = $args['rowId'];
// Retrieve row data for the requested row id
$dataElement = $this->getRowDataElement($request, $elementId);
if (is_null($dataElement)) {
// If the row doesn't exist then
// return null. It may be that the
// row has been deleted in the meantime
// and the client does not yet know about this.
$nullVar = null;
return $nullVar;
}
} elseif ($isModified) {
$elementId = null;
// The row is modified. The client may be asking
// for a formatted new entry, to be saved later, or
// for a representation of a modified row.
$dataElement = $this->getRowDataElement($request, $elementId);
if (isset($args['rowId'])) {
// the rowId holds the elementId being modified
$elementId = $args['rowId'];
}
}
// Instantiate a new row
return $this->_getInitializedRowInstance($request, $elementId, $dataElement, $isModified);
}