Question

I have been taking a look, for if there any way to create a Zend_Db_Table_Select or Zend_Db_Select instance with a literal sql query. I mean, I've got a complex query and I want through this query create an object of that one. I have been reading the docs for this classes and I didn't find anything. I guess that this is not possible.

Do you know something about it?

Thank you very much.

Was it helpful?

Solution

I think your best bet would be to write this in your model:

public function customQuery ($table, $id) {
    return $this
        ->getDefaultAdapter()
        ->query("SELECT * FROM ? WHERE id = ?",
            array($table,$id)
        )
        ->fetchAll()
    ;
}

and also one more link would be very useful to you

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top