zend-db-table

Zend Framework and Mysql - very slow

Hi All. I am creating a web site using php, mysql and zend framework. When I try to run any sql query, page generation jumps to around 0.5 seconds. That's too high. If i turn of sql, page generation is 0.001. The amount of queries I run, doesn't really affect the page generation time (1-10 queries tested). Stays at 0.5 seconds I can't f...

Adodb Active Record vs Zend db_table

Hello 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 functionality. I have taken a look at Zend_DB_Table on paper, but really want to know...

Read-only delete problem Zend Row

What causes a row (Zend_Db_Table_Row) to be set to "readOnly?" I'm having trouble deleting rows in a loop: // this is set to some integers $ids = array(); // get the results $results = $table->fetchAll($select); foreach ($results as $result) { $value = $result->value; if (!in_array($value, $ids)) { // throws a "row...

Relationship between Table, Rowset and Rows in Zend Framework?

Hi, I'm working on a project that requires a fair bit of inserting/updating rows in MySQL tables using Zend_Form. I'm trying to simplify the insert/update procedure by extending Zend_Db, and it seems a lot of this has been done with Zend_Db_Table and Zend_Db_Table_Row. However, I can't understand how to link them together in the most ...

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 am using Zend_Db, then I would not be taking advantage of the extra features as part of mys...

How to do a joined query in the ZF tables interface?

Hi there, I have the db and my tables look like this: What I want to do is to get all models where manufacturers name column starts with A. Which means that that simple part of query should be like $manufacturers->fetchAll("name LIKE '$letter%'"); I am trying to accomplish this with ZF relations but it ain't going, so any kind of he...

Increment values using Zend_DB_Table Raw SQL

I have a website where a user can upload images for a real estate property. The table structure: image_id property_id userid filename thumbfilename display_order timestamp The scenario: When a user uploads multiple pictures, he / she SHOULD be able to set the primary photo from their uploaded images for the specified property. Th...

To get the complete row with join tables in Zend_Db_Table

This is my table structure. http://img6.imageshack.us/img6/8730/articlek.jpg I want to get a article row object from id with section and category names instead of section_id and category_id ,And user names instead of author_id and modified_by. Please help me. ...

Zend Framework relationships - defining column names in findManyToManyRowset()?

Hi, I'm working on an application developed using Zend Framework. I have defined relationships in models, and can use them happily, e.g: $rowset = $row->findManyToManyRowset('People', 'Jobs'); However, i've hit a problem where the rowset is returned has column names that are the same in 'People' and 'Jobs', and therefore, merges the...

array to Zend_Db_Table_Row zend framework

Hi, is there a way of automatic converting from array to Zend_Db_Table_Row or Zend_Db_Table_Rowset? Form Zend_Db_Table_Row you can get the array with toArray(), but I was wondering if there exits anything like opposite of that? Till now I have been implementing a function fill($data) which took the array and than set the atributes of Z...

zend relationships with select

I am new to zend. I have been asked to redevelop a website that was once written in plain PHP and put it into the zend framework. I am having a lot of trouble with database relationships, I cant seem to get my head round defining and querying relationships. I would like to find a Category. From that Category I would like to be able to ...

Zend_Db_Table_Abstract and Default Scope

Is there a way to add a default scope to a Zend_Db_Table_Abstract based model. I want to be able to query a model with some conditions taken as default. e.g. deleted = false order name asc ...

Zend_Db _Table_Abstract and Left Joins

Is there a way to do a left join within a Zend_Db_Table_Abstract based model. I would like to retrieve a record with a left join to another table so that I am able to query all the fields as if they were the same table. Any examples would be useful Thanks guys ...

No adapter for type Zend_Db_Table_Row error?

Hi, I have a project in which I use more than one adapter. So In ma models i created an abstract model abstract My_Config1_Model extends Zend_Db_Table_Abstract { public function init() { $db = Zend_Registry::get('dbcon')->getDb(Kiga_Data_Database::MASTER); $this->setDefaultAdapter($db); } } and then I inherit...

Using Zend Framework Db Tables without MVC

Hi All I am trying to use the Zend Framework without using the MVC structure, specifically the Db_Table classes. I have created a couple of classes representing my database tables i.e class DBTables_Templates extends Zend_Db_Table_Abstract { protected $_name = "templates"; } When I try to instantiate this class (it is included...

Saving row after populating from Array - Zend

Hi All Once again a Zend Framework question! Any help is appreciated. I have a DB table class which i want to use to insert/update rows when a form is posted, and i would like to use the save() method so it can all go through the same method. //Users Db Table class class DBTables_Users extends Zend_Db_Table_Abstract { protected ...

How to access a protected property of Zend_Db_Adapter

Hi all! I've to change the value of protected $_autoQuoteIdentifiers but I don't know how. class ZendX_Db_Adapter_Firebird extends Zend_Db_Adapter_Abstract { protected $_autoQuoteIdentifiers = true; . . . Okay, I can change it directly in the class, but this couln't be the the best way. My application.ini is: resources.db.adapte...

How to use bind variables with Zend_Db_Table->update() in the where clause

If I want to use the Zend_Db_Table->update() method to update my table with data, I cannot find anyway to use bind variables in the "where" clause. The method signature is: int update($data, array|string $where) Usually you will call the method like this: $table = new Bugs(); $data = array( 'updated_on' => '2007-03-23', ...

Zend_Db_Table subquery

Hi, I have a some SQL that I want to use with ZendFW, but I can't get it working and it's driving me crazy. I get the correct result with this query: SELECT DISTINCT e.festival_id FROM entries AS e, mail_log as m WHERE e.status = 1 AND e.festival_id NOT IN (SELECT m.entry_id FROM entries AS e, mail_log as m WHERE m.entry_id = e.festi...

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

Hey! 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 think Zend_Db_Table_Abstract::update()'s syntax makes more sense when found in code...