zend-db-table

Zend_Db subquery

Hi Everyone, I've been trying to construct a sql query with ZendFW, but I cant seem to get it to function like I want to (or function at all). This is the query that works that I'm trying to build with zend_db select() SELECT tc.trip_title, td.ID, td.trip_id, (SELECT count(*) FROM 'trips_invites' ti WHERE ti.destination_id=td.ID ...

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 possible to join tables inside my Users class so I use: $query = $db->select(); ...

Zend DB Selecting constants - columns that do not exist in table

Hey I'm trying to do this query using Zend DB select but I'm not able to do so This is the sql query select shopping_id,shopping_details,"friend" as type from shopping Notice here how I'm specifying "friend" as type and friend is not a column in the shopping table. Now how do I do this in Zend. I have tried this but it gives me an...

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() { $select = $this->select(); $select->setIntegrityCheck(false) ->from(...

Zend_Db : Retaining \n (newline) characters for output

I am building an application based on the Zend Framework, and my issue is that whenever I grab data from the database (from inside the respective model class) using the fetchAll() method, despite the fact that \n characters are stored in the database for the string I'm trying to fetch, when I output the variable to the view script, there...

Zend Framework: How Do I 'auto' generate a SQL query correctly

I want to generate the following SQL: SELECT `rc`.*, `c`.`name` FROM `RunConfigurations` AS `rc` INNER JOIN `Clients` AS `c` ON rc.client_id = c.id WHERE (rc.client_id = ?) ORDER BY `rc`.`config_name` ASC However I am getting: SELECT `rc`.*, `c`.* FROM `RunConfigurations` AS `rc` INNER JOIN `Clients` AS `c` ON rc.client_id = c.id WHE...

Zend Db Table Abstract fetchRow add new objects to it

Hello my friends. I have a fetchRow, that is done like it: $db = new Database(); $data = $db->fetchRow($db->select()->where('id = ?',$id)); Done it, I would like to retrieve all the files from the file table, like this: $files = new Database(); $photos = $files->fetchAll($files->select()->where('id = ?',$data->id)); But it return...

Cannot refresh row as parent is missing. Zend Framework

i am getting the error "Cannot refresh row as parent is missing" when I try to save. Here is my code abstract class Webapp_Model_Resource_Db_Table_Abstract extends Zend_Db_Table_Abstract { /** * Save a row to the database * * * @param array $info The data to insert/update * @param Zend_DB_Table_R...

How to write a custom row class (extends Zend_Db_Table_Row) for a Db_Table class in Zend Framework

I have separate db_table classes for books, book_sections and users (system end users). in book table has columns for book_title, section_id(book_section) , data_entered_user_id(who entered book info). go to this url to see the image(I'm not allow to post images bacause I'm new to stackoverflow) img685.imageshack.us/img685/9978/7093228...

Zend db table find just like fetchRow

Hello my friends, I´m using find() to retrieve a value from the database, but It returns an array with the objects, I would like that it return to me just the object like fetchRow returns, is there any change or similar thing to do? Thanks, and best regard´s. ...

Very simple Zend_Db_Table question

Hi, 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 columns: customerId and name. What should I do to select just those two columns and ...

Get Loaded Config In Controller

Hello guys, How do i get the already loaded options in the controller file in a zend framework installation without creating a new Zend_Config([ ** ]); instance. ...

zend framework components DB can't find class Zend_Paginator_Adapter_DbTableSelect

I'm using some Zend libraries outside of the Zend Framework in a small project. I'm using Zend_Db and Zend_Paginator but when I'm trying to set up the pagination using Zend_Paginator_Adapter_DbTableSelect I get an error that it can't find the class. Fatal error: Class 'Zend_Paginator_Adapter_DbTableSelect' not found in C:\xampp\htdocs\...

findDependentRowset returning all rows

I have these two models: class Application_Model_List extends Zend_Db_Table_Abstract { protected $_name = 'list'; protected $_primary = 'list_id'; protected $_dependentTables = array('Application_Model_Task'); public function getUserLists($user) { $select = $this->select()->from($this->_name)->where('list_us...

Get maximum value with Zend_Db_Table

Hi, Ive got a Zend_Db_Table Now I want to get the maximum available value of a field. Is there a way to get the MAX(number) value or do I need to use basic SQL? Thanks! ...

zend framework select join error getTable()

I am trying to implement this method in my model: class Application_Model_MenuProfilesProducts extends Zend_Db_Table_Abstract { protected $_name = 'menu_profiles_products'; public function fetchProducts($profileID) { $select = Zend_Db_Table::getDefaultAdapter()->select() ->from(array('mpp' => 'men...

How does one query a Zend_Db_Table_Row

Is it possible to run an SQL (Zend_Db_Select) query against a Zend_Db_Table_Row object? What about joining two Zend_Db_Table_Row objects? I know it sounds a bit retarded, but I'm processing hundreds and thousands of rows. I already have the row object that I'm manipulating, so I don't want to query the db again. I hope that's clear. If...

Smarty or PHTML In Zend Framework

WHich is faster? Using smarty or the regular .phtml view files in the zend framework? Which do you recommend? I don't really like using libraries that don't follow zend coding standards [i know it's stupid :D] ...

$_referenceMap Relationships with Zend_Db_Table_Abstract creates too many queries

This is my first time using Zend Framework for an application and i don't know if I completely have by head around Models. I have four tables: shopping_cart, product, product_unit, distributor. shopping cart has an cart_id, product_id, unit_id and dist_id (shopping cart joins on the other tables with their corresponding id). Before Zen...

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'; protected $_primary = 'mai_id'; protected $_sequence = true; protected $_dep...