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

MasterSlaveFeature How-To

I currently have my Db Models using AbstractTableGateway and all my select/insert/update/delete queries are working just fine. But now I would like to add the MasterSlaveFeature and I'm a bit confused on how to do this. The documentation doesn't…
Diemuzi
  • 3,507
  • 7
  • 36
  • 61
3
votes
2 answers

Zend Framework - ORM relationships and optimization

I've been using ZF for few months and I'm really happy with it however I'm not completely sure about how to work with models relationships and at the same time avoid multiple queries to the db. Many people has this problem and no one seems to find a…
3
votes
1 answer

Zend_Db_Table joined queries vs database view

I was wondering what would be the best practices and the best way to achieve consistency while accessing your database data : Current structure goes as follow Data Access --> Business Logic --> Controller --> View My data access layer is composed…
JF Dion
  • 4,014
  • 2
  • 24
  • 34
3
votes
4 answers

Can I set the Database adapter to use permanently from within a Zend_Db_Table_Abstract Class?

I have 2 databases that my site uses including a central user database that relates to other site-specific databases. Sometimes it is adequate to call new User(array('db'=>'adapter1')); (but never convenient); other times, though, such as when…
Nicky Hajal
  • 1,584
  • 1
  • 15
  • 23
3
votes
1 answer

VARCHAR(4) storing more characters than four

I have a VARCHAR(4) column that receives data from an input that may be above 4 characters. This is okay, though, and I let MySQL naturally (or so I thought) cut off the end of the characters. Strangely enough, when I'm looking at the database row…
Andy Baird
  • 6,088
  • 4
  • 43
  • 63
3
votes
1 answer

Modelling in Zend framework

I'm working on a large project at the moment and am just wondering which is best practice, to model entities and sets of entities seperately or in one class? Currently I am implementing two classes for each entity (for example an 'author' and…
Rob Ganly
  • 403
  • 2
  • 5
  • 14
3
votes
2 answers

Any elegant solution how to make insertion to many to many table?

I got these tables: Tag - contains the tag names and id (Tag_ID, tag) TagReview - linking table between tags and reviews (Review_ID, Tag_ID) Review - holds reviews. (Review_ID, content, ...) Currently i have made an insertions when review is added…
Risto Novik
  • 8,199
  • 9
  • 50
  • 66
3
votes
3 answers

How to model multilingual database with Zend, l18n mysql?

I know this topic was discusses a couple of times, but none of them represents the ultimate solution for me. Situation I'm designing a relational mysql database which later should hold multilingual content. You know this from the Wikipedia or…
Manuel
  • 9,112
  • 13
  • 70
  • 110
3
votes
1 answer

Zend DB Table: All Values are Strings

I am using Zend DB Table and DB Table Row. When I get a row object for any of my tables, I see that the types have all been changed to strings, even the auto-incrementing primary key. Is that normal? Do I need to explicitly define the schema to get…
DatsunBing
  • 8,684
  • 17
  • 87
  • 172
3
votes
2 answers

Zend_Db_Table_Row error create new row

i have a table -- -- Table structure for table `pages` -- CREATE TABLE IF NOT EXISTS `pages` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(200) NOT NULL, `title` varchar(200) NOT NULL DEFAULT '', `text` longtext, …
ErgallM
  • 237
  • 3
  • 9
3
votes
1 answer

how to select only one particular field from model in zend framework

How to select only one field from table inside a model. For example: table1(field1, field2 , ..) and the select only field 1
S L
  • 14,262
  • 17
  • 77
  • 116
3
votes
1 answer

How to link Model with the specific database adapter in Zend Framework's multidb

The application was initially using single database, but now I am changing it so different groups of data sits in different database. I added the other database using multidb. Now some model's are using non-default database, but I don't know how to…
Bryan
  • 645
  • 1
  • 6
  • 18
3
votes
1 answer

When to use which Zend_Db class? Zend_Db_Select vs. Zend_Db_Table_Abstract

I think it's possible to write select queries with either Zend_Db_Select or Zend_Db_Table_Abstract, but I don't understand when to use which of the two. Is one more optimized for something than the other? Are joins "easier" with one or the…
Niels Bom
  • 8,728
  • 11
  • 46
  • 62
3
votes
2 answers

How to use limit and order by in a delete query in Zend2

I have following sql query and I need to write it in zend2. DELETE FROM test_table WHERE user_id = 2 ORDER BY id ASC LIMIT 10 I tried with this: $sql = new Sql($this->dbAdapter); $delete =…
3
votes
2 answers

How to define relationships in Zend Framework

I have two simple tables: Projects and SubProjects which I'd like to print every subproject with the respective project in a table. So I wrote this: class Admin_Model_Projects extends Zend_Db_Table_Abstract { protected $_name = 'main_projects'; …
Rodrigo Souza
  • 7,162
  • 12
  • 41
  • 72