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
3
votes
1 answer

How to fetch results in an array with ZF2

I am trying to get some distinct values from DB with ZF2 using Tablegateway. $select = $this->sql->select($tableGateway->getTable()); $select->columns(array('city')); $select->quantifier('DISTINCT'); $stm =…
Franck
  • 31
  • 2
3
votes
1 answer

How to test if table was updated in Zend Framework?

When user opens a form to modify a record, but instead of changing information, he just clicks the Update button. Which causes the update() function to return 0. However, I consider this case a valid update task. How would I test it, so I can assign…
AD.
  • 237
  • 2
  • 3
  • 12
3
votes
1 answer

Zend Framework - Database Table Singleton

I have found myself doing this in my code to 'cache' the work done when instantiating my Zend_Db_Table models: if (Zend_Registry::isRegistered('x_table')) { $x_table = Zend_Registry::get('x_table'); } else { $x_table = new…
Sonny
  • 8,204
  • 7
  • 63
  • 134
3
votes
2 answers

Zend Framework - applying order by on a nested query

This might be a very simple thing. Check out the normal sql query below (select * from shopping order by shopping_id desc limit 5) order by RAND() This query runs successfully in mysql - not sure if this is the right way of doing it - but it…
Gublooo
  • 2,550
  • 8
  • 54
  • 91
3
votes
3 answers

Zend Framework :: ORM - doctrine / propel over Zend_Db_Table

do anyone suggest using an external ORM like Doctrine/Propel over the defualt Zend_Db_Table in Zend Framework ? I think your answers with reasons would be valuable across the ZF community. -DevD
user274383
  • 121
  • 1
  • 7
3
votes
3 answers

How to change Zend_Db_Table name within a Model to insert in multiple tables

Using Zend Framework, I've created a Model to insert a record into a database. My question is, after $this->insert($data) how can I switch the active table so that I can insert a record into another table? Here's my code so far: class…
jwhat
  • 2,042
  • 23
  • 29
3
votes
1 answer

How to use Join in Zend Framework

i am using Join query in zend.. like $select = $table->select() ->from(array('e' => 'EducationHistory'), array('status_DataDictionary_id')) ->join(array('r' =>…
PHP Ferrari
  • 15,754
  • 27
  • 83
  • 149
3
votes
2 answers

How do I add a limit to update-query in Zend Framework?

How do I add the LIMIT 1 clause to an update when using Zend Framework? I'm kind of forced not to use Zend_Db_Table_Abstract::update() since it executes itself unlike the sweet Zend_Db_Select-classes. The reason to do this is just precaution and I…
chelmertz
  • 20,399
  • 5
  • 40
  • 46
3
votes
1 answer

Zend Framework 2: Getting an ordered SQL call

I've been trying to get an order ASC/DESC call for a field (let's say craeted), and I can't seem to figure out how to do it in ZF2. Where am I going wrong..? namespace Todo\Model; class TodoTable extends AbstractTableGateway { public function…
Yossi
  • 1,056
  • 2
  • 13
  • 22
3
votes
1 answer

zf2 form: populate select field with data coming from database

I'm learning zf2 and I'm facing a problem involving 2 (eventually more) modules working together. Note, I've carefully read this post (and the related one) which helped me a lot. I'm going to explain a bit the problem: Using the first module…
IamFraz
  • 136
  • 1
  • 1
  • 5
3
votes
1 answer

Join in Zend Framework using alias

How to do the query: $name = $this->_dbTable->info('name'); $result = $this->_dbTable->select()->from($name)->setIntegrityCheck(false); $result->join(array('t' => "$name.tipo")), "t.id = $name.id"); Where '$name.tipo' is the table name for join.
3
votes
2 answers

pdo_mysql vs mysqli when using Zend_Db

If I am using Zend_Db classes to abstract my queries from the backend database, does it make a difference which mysql driver I use, pdo_mysql vs. mysqli? My understanding of pdo_mysql is it is also to provide abstraction, so I'm assuming that if I…
user171837
3
votes
2 answers

Zend_db only gives a error in my main module and only when I use 'woningen' as table name

This is the code I use to update/insert data in my database. public function saveItem($post, $table) { unset($post['submit']); $this->_table = new Zend_Db_Table($table); exit; if (isset($post['id'])) { $where…
Kevin
  • 33
  • 4
3
votes
1 answer

Adodb Active Record vs Zend db_table

I use Adodb and Active Record for database abstraction. I have started to use Zend Framework, and one of the reasons I like it so much is due to it's "Use at Will" architecture which allows me to continue using Adodb rather than Zend's db_table…
JonB
  • 1,320
  • 2
  • 15
  • 30
3
votes
2 answers

Zend_Db_Table_Rowset to array of objects

I am not looking for $myRowset->toArray(); because I want to get an array of objects. What I want to do is to be able to merge $myRowset with an array of objects. $myOtherArray = [new Foo(), new Bar()]; $array = array_merge($myRowset,…
Matthieu Napoli
  • 48,448
  • 45
  • 173
  • 261