Questions tagged [zend-db-table]

Object-oriented interface to database tables

The Zend_Db_Table class is an object-oriented interface to database tables. It provides methods for many common operations on tables. The base class is extensible, so you can add custom logic.

The Zend_Db_Table solution is an implementation of the Table Data Gateway pattern. The solution also includes a class that implements the Row Data Gateway pattern.

Official documentation

437 questions
2
votes
1 answer

Hand made queries vs findDependentRowset

I have built a pretty big application with Zend and i was wondering which would be better, building query by hand (using the Zend object model) $db->select() ->form('table') ->join('table2', 'table.id = table2.table_id') or going…
JF Dion
  • 4,014
  • 2
  • 24
  • 34
2
votes
1 answer

select queries with Zend_DB_Table

I have a code something like following class Application_Model_Company extends Zend_Db_Table_Abstract { protected $_name = 'companies'; private $id; private $name; private $shortName; private $description; public static function…
codezgeek
  • 74
  • 1
  • 7
2
votes
1 answer

Datamapper DB Pattern With ZF: Managing a Relational Database

I am creating an application using Zend Framework and I want to use the data mapper design pattern for managing my database. What I don't understand is how to use the pattern with a relational database. Suppose I have a table containing posts with…
2
votes
3 answers

Zend_Db_Table_Abstract - How to do a SUM?

I can't find here: http://framework.zend.com/manual/en/zend.db.select.html any reference to SUM using mysql. How can we perform a simple: SELECT SUM(mark) as total_mark FROM `student` Using Zend_Db_Table_Abstract ? Tried: this->select(SUM…
MEM
  • 30,529
  • 42
  • 121
  • 191
2
votes
3 answers

Very simple Zend_Db_Table question

I know this sounds rediculously easy but there is simply no documentation about this subject findable on google. I'd like to to select two columns from the database. I made a Zend_Db_Table object and point it to my table. Now I like to select two…
baklap
  • 2,145
  • 6
  • 28
  • 41
2
votes
2 answers

Why isn't this randomising the order?

I'm using Zend framework and trying to get the results to be in a random order. This returns the results but doesn't seem to vary the order. Any ideas? class Model_DBTable_Tblquotes extends Zend_Db_Table { public function getQuotes() { …
Andrew
  • 9,967
  • 10
  • 64
  • 103
2
votes
1 answer

How can I join tables in Zend while using a class that inherits from Zend_Db_Table_Row_Abstract?

I have a class that extends Zend_Db_Table lets call it 'Users' that uses the class 'User' (inheriting from Zend_Db_Table_Row_Abstract) as its rowClass. I need it this way because User has additional methods that I use. As far as I know it is not…
Omar Kohl
  • 1,372
  • 2
  • 15
  • 32
2
votes
1 answer

row specific class

How do I create a Zend_Db_Table which returns a different class for each row.? Example UserTable has id,name and type Type contains class names (admin,client,etc...) The classes admin, client are all subclasses of user If I call fetch I need to get…
michiel
  • 6,036
  • 1
  • 18
  • 13
2
votes
1 answer

How to map underscored table columns to camelcased model class properties in ZF2?

I'm developing an Apigility driven web application based on Zend Framework 2. For the model layer I'm using the ZfcBase DbMapper. Currently the columns in my DB tables are named exactly like the correspondent model properties. For both I'm using…
automatix
  • 14,018
  • 26
  • 105
  • 230
2
votes
1 answer

One-to-many relationship in the same table in zend

I have groupTable(group_id,group_name,group_date,group_parent_id) in face each group have many group child. I create groupModel and I want to begin coding is this right code to handle? protected $_name = 'group'; protected $_dependentTables =…
3ehrang
  • 619
  • 1
  • 7
  • 22
2
votes
3 answers

Zend_Db_Select: regrouping conditions in where clause

I would like to do something like this: $select = $myTbl->select() ->from('download_log') ->joinLeft(...... etc........ ->joinLeft(...... etc........ ->joinLeft(...... etc........); //Filter all configured bots (Google, Yahoo,…
pvledoux
  • 973
  • 1
  • 10
  • 23
2
votes
1 answer

How to establish DB connection only once using zend frame work

I am newbie to the zend framework. I am using Zend_Db_Table_Abstract for doing database operations. Now, i want to know that Zend_Db_Table_Abstract will make single db connection for through out the application or will it create for every…
2
votes
1 answer

Zend_Db_Table - Update don't work

The code seems not working. // $counter is an instance of Zend_Db_Table_Abstract $counter->update(array('hits' => 'hits+1'), '"id" = 1'); I took a look into the DB profiler and find the following query: UPDATE `downloads` SET `hits` = ? WHERE ("id"…
Poru
  • 8,254
  • 22
  • 65
  • 89
2
votes
2 answers

Extending Zend_Db_Table_Row_Abstract

I want to extend Zend_Db_Table_Row_Abstract to have some additional fields besides those from table. Example. I have class Automobili_Model_Car extends Zend_Db_Table_Abstract { protected $_name = 'car'; protected $_rowClass =…
umpirsky
  • 9,902
  • 13
  • 71
  • 96
2
votes
3 answers

Zend_Db_Table UTF-8 Characters

Tables in my database are created with a correct UTF-8 charset like this: CREATE TABLE users ( id INT NOT NULL AUTO_INCREMENT, ... ... ... ... ... PRIMARY KEY (id) ) ENGINE = INNODB CHARACTER SET utf8 COLLATE utf8_slovak_ci; However, when I use…
Richard Knop
  • 81,041
  • 149
  • 392
  • 552