Can anybody suggest me what's wrong with my code? Although insert(), update() and delete() are working absolutely fine. This is my first project on the Zend framework and I'm messing with it form past two days and not getting what's actually going wrong with it. I'm using Zend Framework 1.
This is my function body.
public function getMenuCategoryById(Application_Model_MenuCategories $MenuCategory) {
$where = array(
'mc_id' => (int) $MenuCategory->__get('mc_id')
);
$result = $this->_db_table->find($where);
echo '<pre';
print_r($result);
die();
if (count($result) == 0) {
return false;
}
$row = $result->current();
$menuCategory = new Application_Model_MenuCategories($row);
return $menuCategory;
}
This is not returning the rows. Instead, it gives Zend_Db_Table_Rowset bject as below:
Zend_Db_Table_Rowset Object (
[_data:protected] => Array
(
)
[_table:protected] => Application_Model_DbTable_MenuCategories Object
(
[_name:protected] => menu_categories
[_definition:protected] =>
[_definitionConfigName:protected] =>
[_db:protected] => Zend_Db_Adapter_Pdo_Mysql Object
(
[_pdoType:protected] => mysql
[_numericDataTypes:protected] => Array
(
[0] => 0
[1] => 1
[2] => 2
[INT] => 0
[INTEGER] => 0
[MEDIUMINT] => 0
[SMALLINT] => 0
[TINYINT] => 0
[BIGINT] => 1
[SERIAL] => 1
[DEC] => 2
[DECIMAL] => 2
[DOUBLE] => 2
[DOUBLE PRECISION] => 2
[FIXED] => 2
[FLOAT] => 2
)
[_defaultStmtClass:protected] => Zend_Db_Statement_Pdo
[_config:protected] => Array
(
[dbname] => test_db
[host] => localhost
[username] => root
[password] => Password@123
[charset] =>
[persistent] =>
[options] => Array
(
[caseFolding] => 0
[autoQuoteIdentifiers] => 1
[fetchMode] => 2
)
[driver_options] => Array
(
)
)
[_fetchMode:protected] => 2
[_profiler:protected] => Zend_Db_Profiler Object
(
[_queryProfiles:protected] => Array
(
)
[_enabled:protected] =>
[_filterElapsedSecs:protected] =>
[_filterTypes:protected] =>
)
[_defaultProfilerClass:protected] => Zend_Db_Profiler
[_connection:protected] => PDO Object
(
)
[_caseFolding:protected] => 0
[_autoQuoteIdentifiers:protected] => 1
[_allowSerialization:protected] => 1
[_autoReconnectOnUnserialize:protected] =>
)
[_schema:protected] =>
[_cols:protected] => Array
(
[0] => mc_id
[1] => category_name
)
[_primary:protected] => Array
(
[1] => mc_id
)
[_identity:protected] => 1
[_sequence:protected] => 1
[_metadata:protected] => Array
(
[mc_id] => Array
(
[SCHEMA_NAME] =>
[TABLE_NAME] => menu_categories
[COLUMN_NAME] => mc_id
[COLUMN_POSITION] => 1
[DATA_TYPE] => int
[DEFAULT] =>
[NULLABLE] =>
[LENGTH] =>
[SCALE] =>
[PRECISION] =>
[UNSIGNED] =>
[PRIMARY] => 1
[PRIMARY_POSITION] => 1
[IDENTITY] => 1
)
[category_name] => Array
(
[SCHEMA_NAME] =>
[TABLE_NAME] => menu_categories
[COLUMN_NAME] => category_name
[COLUMN_POSITION] => 2
[DATA_TYPE] => varchar
[DEFAULT] =>
[NULLABLE] =>
[LENGTH] => 255
[SCALE] =>
[PRECISION] =>
[UNSIGNED] =>
[PRIMARY] =>
[PRIMARY_POSITION] =>
[IDENTITY] =>
)
)
[_metadataCache:protected] =>
[_metadataCacheInClass:protected] => 1
[_rowClass:protected] => Zend_Db_Table_Row
[_rowsetClass:protected] => Zend_Db_Table_Rowset
[_referenceMap:protected] => Array
(
)
[_dependentTables:protected] => Array
(
)
[_defaultSource:protected] => defaultNone
[_defaultValues:protected] => Array
(
)
)
[_connected:protected] => 1
[_tableClass:protected] => Application_Model_DbTable_MenuCategories
[_rowClass:protected] => Zend_Db_Table_Row
[_pointer:protected] => 0
[_count:protected] => 0
[_rows:protected] => Array
(
)
[_stored:protected] => 1
[_readOnly:protected] => )