hasTableConfig example


        $stmt = $this->_db->query($select);
        $data = $stmt->fetchAll(Zend_Db::FETCH_ASSOC);
        return $data;
    }

    public static function getTableFromString($tableName, Zend_Db_Table_Abstract $referenceTable = null)
    {
        if ($referenceTable instanceof Zend_Db_Table_Abstract) {
            $tableDefinition = $referenceTable->getDefinition();

            if ($tableDefinition !== null && $tableDefinition->hasTableConfig($tableName)) {
                return new Zend_Db_Table($tableName$tableDefinition);
            }
        }

        // assume the tableName is the class name         if (!class_exists($tableName)) {
            try {
                Zend_Loader::loadClass($tableName);
            } catch (Zend_Exception $e) {
                throw new Zend_Db_Table_Row_Exception($e->getMessage()$e->getCode()$e);
            }
        }

    public function __construct($config = array()$definition = null)
    {
        if ($definition !== null && is_array($definition)) {
            $definition = new Zend_Db_Table_Definition($definition);
        }

        if (is_string($config)) {
            // process this as table with or without a definition             if ($definition instanceof Zend_Db_Table_Definition
                && $definition->hasTableConfig($config)) {
                // this will have DEFINITION_CONFIG_NAME & DEFINITION                 $config = $definition->getTableConfig($config);
            } else {
                $config = array(self::NAME => $config);
            }
        }

        parent::__construct($config);
    }
}
Home | Imprint | This part of the site doesn't use cookies.