/** For polymorphic persistency a single peanut can be mapped to several tables.
* This funtion returns a specific fiedMap for each table
* Because a fields persistence can be PNT_READ_ONLY, the map for
* loading the object is not necessarily the same as the map for saving.
* This method returns the fieldmap for saving, this excludes fields whose
* propertyDescriptors' persistent === PNT_READ_ONLY
* @param String $tableName the name of the table to get the map for
* @return array fieldmap for saving, with fieldNames as keys and columnNames as values
*/
function ($tableName) {
$fieldMap = array();
$props = $this->();
if (empty($props))
return $fieldMap;
reset($props);
foreach ($props as $name => $prop) {
if (($prop->() == $tableName || $prop->() == 'id')
&& ($prop->() !== PNT_READ_ONLY))
$fieldMap[$prop->()] = $prop->();
}
return $fieldMap;
}
|