/**
* @access private
*
* Maps the supplied properties such that they will be loaded in the given relational request.
*
* @param \Storm\Core\Mapping\IEntityRelationalMap $EntityRelationalMap The relational map of the entity
* @param \Storm\Core\Relational\Request $RelationalRequest The request to add to
* @param array|null $Properties The array of properties to map or null if all properties should be mapped
* @return void
*/
private function MapPropetiesToRelationalRequest(IEntityRelationalMap $EntityRelationalMap, Relational\Request $RelationalRequest, array $Properties = null)
{
if ($Properties === null) {
$Properties = $EntityRelationalMap->GetMappedProperties();
}
$DataPropertyColumnMappings = $EntityRelationalMap->GetDataPropertyColumnMappings();
$EntityPropertyToOneRelationMappings = $EntityRelationalMap->GetEntityPropertyToOneRelationMappings();
$CollectionPropertyToManyRelationMappings = $EntityRelationalMap->GetCollectionPropertyToManyRelationMappings();
foreach ($Properties as $PropertyIdentifier => $Property) {
if (isset($DataPropertyColumnMappings[$PropertyIdentifier])) {
$RelationalRequest->AddColumns($DataPropertyColumnMappings[$PropertyIdentifier]->GetReviveColumns());
} else {
if (isset($EntityPropertyToOneRelationMappings[$PropertyIdentifier])) {
$EntityPropertyToOneRelationMappings[$PropertyIdentifier]->AddToRelationalRequest($this, $RelationalRequest);
} else {
if (isset($CollectionPropertyToManyRelationMappings[$PropertyIdentifier])) {
$CollectionPropertyToManyRelationMappings[$PropertyIdentifier]->AddToRelationalRequest($this, $RelationalRequest);
}
}
}
}
}