Questions tagged [zend-db]

Database access component for the Zend Framework.

for PHP 5 includes a database access component, referred to as Zend\Db.

The Zend\Db component includes features such as:

  • Database connection factory class.
  • Adapter for multiple brands of database, closely matching the interface, and also supporting other non-PDO database interfaces such as mysqli and oci.
  • Simple query builder for generic SELECT syntax.
  • statement profiler and logger.
  • Table Data Gateway and Row Data Gateway classes. Together these are similar to the popular Active Record pattern.

Resources:

  1. Github repository
1092 questions
5
votes
5 answers

how to get last inserted Id of a Sqlite database using Zend_Db

I'm trying to fetch the last inserted row Id of a Sqlite DB in my PHP application. I'm using Zend Framework's PDO Sqlite adapter for database handling. the lastInsertId() method is supposed to give me the results, but it wouldn't. In PDO…
farzad
  • 8,775
  • 6
  • 32
  • 41
5
votes
4 answers

Zend PDO error - how can I debug it?

I have a weird problem using Zend Framework and Mysql. I generated a query: SELECT events.idUser, szForename, szLastname, readers.szName, idZoneFrom, events.dtTime FROM events, users, readers WHERE events.idUser = users.idUser AND events.idReader =…
Tomasz Kapłoński
  • 1,320
  • 4
  • 24
  • 49
5
votes
1 answer

Zend_Db subquery

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, …
user387302
  • 395
  • 1
  • 4
  • 13
5
votes
4 answers

Zend Framework: How to check an additional column while using DbTable Auth Adapter?

Currently, I'm getting a regular DbTable Auth Adapter: protected function _getAuthAdapter($formData) { $dbAdapter = Zend_Db_Table::getDefaultAdapter(); $authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter); …
Andrew
  • 227,796
  • 193
  • 515
  • 708
5
votes
2 answers

ZF2 - BjyAuthorize - How to Get Rules and Guards from a Database

I'm using BjyAuthorize with Zend Framework2 to implement authorization and was able to successfully integrate roles from database. Now I want to get my Rules and Guards also from data base tables. How can I do this?
Nisal Gunawardana
  • 1,345
  • 16
  • 20
5
votes
2 answers

Best way to do an Inner Join using the Zend Framework?

It seems like there's a few different ways to join two tables using the Zend Framework, but I've never done it before so I don't know which is the best way to do it. This is what I'm trying to do... I have 3 tables in my database: users ( id ,…
Andrew
  • 227,796
  • 193
  • 515
  • 708
5
votes
2 answers

zf2 - Zend\Db - What do Model, Entity, Hydrator, Mapper, TableGateway do and how it all links together?

Please explain what Model Entity TableGateway Mapper Hydrator do and how it all works together in zf2 application. please don't give links to blogs articles. I need simple big picture explenation. As far as I understand these are the…
wormhit
  • 3,687
  • 37
  • 46
5
votes
2 answers

Convert Zend\Db\ResultSet\HydratingResultSet to Array of Objects

In my Mapper class I'm extending AbstractDbMapper from ZfcBase to fetch rows from the database. A simple example would be code like this: class MyMapper extends AbstractDbMapper { //... public function fetchAll() { $select =…
Karl Lorey
  • 1,536
  • 17
  • 21
5
votes
3 answers

like in where query in zend framework 2

I am using the Zend framework 2.x and facing the problem as I have search a lot. I want to use the like clause in query but each time gives the errors: Here is my efforts: $sql = new Sql($this->adapter); $select =…
Code Lღver
  • 15,573
  • 16
  • 56
  • 75
5
votes
2 answers

Zend_Db_Select order by random, compatible in mssql / mysql

Alright here's the situation, I have an application written in the Zend_Framework, that is compatible with both MySQL and MSSQL as the backend. Now, ZF is pretty good at solving a lot of the SQL discrepancies/differences between the two languages,…
Jesta
  • 1,458
  • 1
  • 13
  • 14
5
votes
1 answer

How to get more info on this PDO MySql error with Zend

In my PHP script I run an update statement as follows: $this->_db->update('names', $data, $this->_db->quoteInto('id = ?', $obj->id)); The db handle is a Zend_Db_Adapter_Abstract instance (of the PDO MySql variety). The problem is that the update is…
DatsunBing
  • 8,684
  • 17
  • 87
  • 172
5
votes
4 answers

Zend Framework Db Select Join table help

I have this query: SELECT g.title, g.asin, g.platform_id, r.rank FROM games g INNER JOIN ranks r ON ( g.id = r.game_id ) ORDER BY r.rank DESC LIMIT 5` Now, this is my JOIN using Zend_Db_Select but it gives me array…
tester2001
  • 1,053
  • 3
  • 14
  • 24
5
votes
2 answers

Zend: Two Objects, one Row

I've recently started using Zend Framework (1.8.4), to provide admin tools for viewing the orders of a shopping cart site. What I'd like to do is to efficiently create multiple model (Zend_Db_Table_Row_Abstract) objects from a single database result…
Matt Hucke
  • 673
  • 1
  • 6
  • 12
5
votes
2 answers

zf2 \Zend\Db\Sql\Sql using predicate in where condition

i really don't get the point how to use predicates in zend framework 2. this is what i got: $sql->select() ->columns(array('GroupedColum' ,'minValue' => new Expression('min(ValueColumn)'))) ->from('ValueTable') …
RomanKonz
  • 1,027
  • 1
  • 8
  • 15
5
votes
1 answer

How Zend DB Manage Database Connections

I am using Zend Framework for my PHP developments and here is a small function I used to execute a query. This is not about an error. The code and everything works fine. But I want to know some concept behind this. /** * Get dataset by…
Prasad Rajapaksha
  • 6,118
  • 10
  • 36
  • 52