I'm forced to work with the Zend-Framework in my current project, but I'm stuck at a specific point. Unfortunately, the documentation of the framework is horrible and doesn't really help me at the moment. The solution is probably extremely easy, but i can't figure it out on my own.
I'm just trying to get something from my database, which i try to achieve with this code:
BS_Model_Subshops.php:
class BS_Model_Subshops extends BS_Lib_Model
{
protected $_name = 'shops';
protected $_username = '';
protected $_password = '';
protected $_primary = 'id';
}
LoginController.php:
public function authAction() {
$shop= new BS_Model_Subshops();
$id= filter_var($this->getRequest()->getPost('id'));
$db_content= $shop->select()->where('id= '.$id);
Zend_Debug::dump($db_content);
... more code ...
}
This gives me the following object as a result (warning: Huge object incoming):
object(Zend_Db_Table_Select)#85 (7) {
["_info":protected] => array(10) {
["schema"] => NULL
["name"] => string(5) "shops"
["cols"] => array(8) {
[0] => string(2) "id"
[1] => string(4) "name"
[2] => string(8) "css_path"
[3] => string(3) "mmz"
[4] => string(17) "order_information"
[5] => string(11) "code_suffix"
}
["primary"] => array(1) {
[1] => string(2) "id"
}
["metadata"] => array(8) {
["id"] => array(14) {
["SCHEMA_NAME"] => NULL
["TABLE_NAME"] => string(5) "shops"
["COLUMN_NAME"] => string(2) "id"
["COLUMN_POSITION"] => int(1)
["DATA_TYPE"] => string(3) "int"
["DEFAULT"] => NULL
["NULLABLE"] => bool(false)
["LENGTH"] => NULL
["SCALE"] => NULL
["PRECISION"] => NULL
["UNSIGNED"] => bool(true)
["PRIMARY"] => bool(true)
["PRIMARY_POSITION"] => int(1)
["IDENTITY"] => bool(true)
}
["name"] => array(14) {
["SCHEMA_NAME"] => NULL
["TABLE_NAME"] => string(5) "shops"
["COLUMN_NAME"] => string(4) "name"
["COLUMN_POSITION"] => int(2)
["DATA_TYPE"] => string(7) "varchar"
["DEFAULT"] => NULL
["NULLABLE"] => bool(false)
["LENGTH"] => string(2) "60"
["SCALE"] => NULL
["PRECISION"] => NULL
["UNSIGNED"] => NULL
["PRIMARY"] => bool(false)
["PRIMARY_POSITION"] => NULL
["IDENTITY"] => bool(false)
}
["css_path"] => array(14) {
["SCHEMA_NAME"] => NULL
["TABLE_NAME"] => string(5) "shops"
["COLUMN_NAME"] => string(8) "css_path"
["COLUMN_POSITION"] => int(3)
["DATA_TYPE"] => string(7) "varchar"
["DEFAULT"] => NULL
["NULLABLE"] => bool(false)
["LENGTH"] => string(3) "100"
["SCALE"] => NULL
["PRECISION"] => NULL
["UNSIGNED"] => NULL
["PRIMARY"] => bool(false)
["PRIMARY_POSITION"] => NULL
["IDENTITY"] => bool(false)
}
["mmz"] => array(14) {
["SCHEMA_NAME"] => NULL
["TABLE_NAME"] => string(5) "shops"
["COLUMN_NAME"] => string(3) "mmz"
["COLUMN_POSITION"] => int(4)
["DATA_TYPE"] => string(14) "float unsigned"
["DEFAULT"] => NULL
["NULLABLE"] => bool(false)
["LENGTH"] => NULL
["SCALE"] => NULL
["PRECISION"] => NULL
["UNSIGNED"] => bool(true)
["PRIMARY"] => bool(false)
["PRIMARY_POSITION"] => NULL
["IDENTITY"] => bool(false)
}
["order_information"] => array(14) {
["SCHEMA_NAME"] => NULL
["TABLE_NAME"] => string(5) "shops"
["COLUMN_NAME"] => string(17) "order_information"
["COLUMN_POSITION"] => int(5)
["DATA_TYPE"] => string(4) "text"
["DEFAULT"] => NULL
["NULLABLE"] => bool(false)
["LENGTH"] => NULL
["SCALE"] => NULL
["PRECISION"] => NULL
["UNSIGNED"] => NULL
["PRIMARY"] => bool(false)
["PRIMARY_POSITION"] => NULL
["IDENTITY"] => bool(false)
}
["code_suffix"] => array(14) {
["SCHEMA_NAME"] => NULL
["TABLE_NAME"] => string(5) "shops"
["COLUMN_NAME"] => string(11) "code_suffix"
["COLUMN_POSITION"] => int(6)
["DATA_TYPE"] => string(7) "varchar"
["DEFAULT"] => NULL
["NULLABLE"] => bool(false)
["LENGTH"] => string(1) "6"
["SCALE"] => NULL
["PRECISION"] => NULL
["UNSIGNED"] => NULL
["PRIMARY"] => bool(false)
["PRIMARY_POSITION"] => NULL
["IDENTITY"] => bool(false)
}
... more unimportant stuff here ...
Now, for example, i just want the name or the css path. How can i get one of those? I'm not really familiar with Zend, even though I worked with laravel before, and I just have huge problems with understanding it since it's so complex and doesn't have a good documentation with examples.
The Webserver uses PHP 5.4 and Zend-Framework 1.9 if that's important.