/** * Create mapper object * @param AM_Model_Db_Abstract $oModel * @param string $sProvider * @param array $aOptions * @return AM_Mapper_Abstract */ public static final function factory(AM_Model_Db_Abstract $oModel, $sProvider, $aOptions = array()) { $sModelTableName = $oModel->getTableName(); $sProvider = ucfirst(Zend_Filter::filterStatic($sProvider, 'Word_UnderscoreToCamelCase')); $sModelTableName = ucfirst(Zend_Filter::filterStatic($sModelTableName, 'Word_UnderscoreToCamelCase')); $sMapperClassName = 'AM_Mapper_' . $sProvider . "_" . $sModelTableName; $sFile = str_replace('_', DIRECTORY_SEPARATOR, $sMapperClassName) . '.php'; if (!AM_Tools_Standard::isReadable($sFile)) { throw new AM_Mapper_Exception(sprintf('Mapper class "%s" not found', $sMapperClassName), 503); } $oMapper = new $sMapperClassName($oModel, $aOptions); return $oMapper; }