}
$res = $this->database->exec_SELECTquery(
- '*', // TODO limit fetched fields (CH: should we do that? JR: Not needed; only existing properties will be mapped)
+ '*',
$from,
$where . $enableFields,
$groupBy,
$orderBy,
$limit
);
-
+
$fieldMap = $this->getFieldMapFromResult($res);
$rows = $this->getRowsFromResult($res);
-
$this->database->sql_free_result($res);
-
+
// SK: Do we want to make it possible to ignore "enableFields"?
// TODO language overlay; workspace overlay
$objects = array();
protected function getRowsFromResult($res) {
$rows = array();
if ($res !== FALSE) {
- while($rows[] = $this->database->sql_fetch_row($res));
+ while($rows[] = $this->database->sql_fetch_assoc($res));
array_pop($rows);
}
return $rows;
*/
// SK: I Need to check this method more thoroughly.
// SK: Are loops detected during reconstitution?
- protected function reconstituteObjects($dataMap, &$fieldMap, array $rows) {
+ protected function reconstituteObjects(Tx_ExtBase_Persistence_Mapper_DataMap $dataMap, &$fieldMap, array $rows) {
$objects = array();
foreach ($rows as $row) {
- $properties = array();
- foreach ($dataMap->getColumnMaps() as $columnMap) {
- $fieldValue = $row[$fieldMap[$dataMap->getTableName()][$columnMap->getColumnName()]];
- $properties[$columnMap->getPropertyName()] = $dataMap->convertFieldValueToPropertyValue($columnMap->getPropertyName(), $fieldValue);
- }
+ $properties = $this->getProperties($dataMap, $row);
$object = $this->reconstituteObject($dataMap->getClassName(), $properties);
foreach ($dataMap->getColumnMaps() as $columnMap) {
if ($columnMap->getTypeOfRelation() === Tx_ExtBase_Persistence_Mapper_ColumnMap::RELATION_HAS_ONE) {
}
return $objects;
}
+
+ protected function getProperties(Tx_ExtBase_Persistence_Mapper_DataMap $dataMap, array $row) {
+ $properties = array();
+ foreach ($dataMap->getColumnMaps() as $columnMap) {
+ $fieldValue = $row[$columnMap->getColumnName()];
+ $properties[$columnMap->getPropertyName()] = $dataMap->convertFieldValueToPropertyValue($columnMap->getPropertyName(), $fieldValue);
+ }
+ return $properties;
+ }
/**
* Reconstitutes the specified object and fills it with the given properties.
* @return String $content The processed content
*/
public function dispatch($content, $configuration) {
+ // TODO Remove debug statement
+ // $start_time = microtime(TRUE);
+
$parameters = t3lib_div::_GET();
$extensionName = $configuration['extension'];
$controllerName = $configuration['controller'];
}
// TODO Handle $response->getStatus()
// SK: Call sendHeaders() on the response
+
+ // TODO Remove debug statements
+ // $end_time = microtime(TRUE);
+ // debug($end_time - $start_time, -1);
+
return $response->getContent();
}