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 = array('Model_group');
protected $_referenceMap = array('Model_group' =>
array('col...
Hi there
I need to create something like this:
select name from table where active = 1 AND (name LIKE 'bla' OR description LIKE 'bla')
The first part is easy:
$sqlcmd = $db->select()
->from("table", "name")
->where("active = ?", 1)
Now comes the tricky part. How can I nest? I know that I can just write
->orWhere("name LIKE ? OR ...
The last time I worked with Zend_Db I recall I used to write SQL Queries manually. I've been searching for some ORM application, but, since I read something like Zend_Db is also capable of doing so, I started to try it, but I can't find neither a good tutorial explain it or a good documentation.
I read something lake Gateway pattern and...
I don't know if its possible but I'd like to make it a Zend_Db_Select object and I don't know how
SELECT *
FROM MyTable MT1
WHERE MT1.date = (
SELECT MAX(MT2.date)
FROM MyTable MT2
)
...
I have a model which is referenced to a table registries extending Zend_Db and some methods which bascially uses fetchAll() all the time.
What happens is: my table has a DATE field and I'd like it to output already formated when I call $row->reg_date. Is it possible by doing something in the model or do I have to manually format?
...
I have place model & entry model that entry is parent
everything is fine but how can I delete the result row $categoryPlacements
in place model:
$entryModel = new Model_EntryModel();
$entryRow = $entryModel->find ( $entryId )->current ();
$categoryPlacements = $entryRow->findDependentRowset($this);
in this case i want to delete ...
Is there a simple :) and efficient way or reading very large number of rows sequentially using Zend_Db?
Basically I need to process entire table, row by row. Table is large, primary key sequence is not guaranteed(i.e. not an autoincrement, but is UNSIGNED INT).
What's the best way to approach this?
Environment: PHP 5.2, Zend Framework...
I want to subtract a amount from a table's field in Zend Framework. I can run it with SQL using following query:
UPDATE `Person` SET credit=credit-50 where id=1
But how to write above SQL query in Zend Framework?
...
I'm using zend frame work zend form and zend db for my project.
The problem I have is, when the user enter some special characters in the text field (i.e "I'm"), it is saved in the database with the "\" character (i.e. "I\'"). I need to know how to fix this so it just saved as whatever the user entered.
...
Are Zend_Db_Select's where() method, when including the optional value to quite into, and Zend_Db_Adapte's quoteInto() methods basically the same as far as escaping SQL?
In other words, are these two pieces of quote identical and equally secure?
$select->where($this->getAdapter()->quoteInto('id = ?', 3));
$select->where(id = ?, 3);
...
I wonder if this possible with Zend_Db, but I am looking for something like SQL query logging similar to how Hibernate does it, where it shows you what SQL it generates in the log file.
...
I am using the insert() function from Zend_Db_Table_Abstract.
The data being inserted is user input, so naturally I am curious if ZF does the data cleansing for me, or if I should do it myself before I call the insert() function.
...
I have a normalized database that stores locations of files on the internet. A file may have multiple locations spread across different sites. I am storing the urls in two parts (Site.UrlStart, FileLocation.UrlEnd). The UrlEnd is the part unique to that file (for the site).
Simplified Db structure:
I am using Zend_Db as my ORM (If it...
Hi All,
I have a "small" table of 60400 rows with zipcode data, 6mb in total. I want to iterate through them all, update a column value, and then save it.
The following is part of my Zipcodes model which extends My_Db_Table that a totalRows function that - you guessed it.. returns the total number of rows in the table (60400 rows)
pub...
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 a admin or client object depending on the corresponding value in the db.
...
Hi All,
Example:
class Products extends Zend_Db_Table_Abstract
{
protected $_name = 'products';
protected $_referenceMap = array(
'Bug' => array(
'columns' => array('bug_id'),
'refTableClass' => 'Bugs',
'refColumns' => array('bug_id')
)
);
}
$obj...
All,
I have a PHP application written in Zend Framework with MVC style. I plan to use Zend_DB to connect to the MySQL database and process queries. I am looking for a wrapper class which makes it easy to use Zend_DB class. This wrapper class will have a constructor that connects to the Mysql db using Zend_DB. It will also have a method ...
How do you represent this query as a Zend_Db_Select?
select * from t where id = x'0cc175b9c0f1b6a831c399e269772661';
The database is MySQL, using either PDO or mysqli adapters.
...
Am looking for how I can extend the Zend_DB_Table below to accomodate a BETWEEN two dates syntax and LIMIT syntax
My current construct is
class Model_DbTable_Tablelist extends Zend_Db_Table_Abstract
{
protected $_name = 'mytable';
$select = $this->select()
->setIntegrityCheck(false)
->fr...
Hi,
I'm quite new to Zend and the database classes from it. I'm having problems mapping a Zend_Db_Table_Row_Abstract to my rows.
The problem is that whenever I try to map it to a class (Job) that extends the Zend_Db_Table_Row_Abstract class, the database data is not receivable anymore. I'm not getting any errors, trying to get data simp...