2008年8月4日星期一

Re: [fw-db] Delete, update and insert in joined table (model)

Thanks Bill karwin
it was a clear and to the point information,
so the best is to manually create objects of tables and apply CRUD
on each of them manually.

thanks for you time and help

best regards
Fossil


Bill Karwin wrote:
>
>
>
> fossil wrote:
>>
>> for example is there a way to fetch some data form joined table and
>> delete or update them with obj->save()
>>
>
> You can save() only associated Row objects that correspond to a single row
> in the database. A Row object that is the result of a join must be
> read-only, because Zend_Db isn't smart enough to track which columns
> correspond to which table.
>
> As long as each Row object is non-joined, i.e. you fetched it from a
> single table, you can save() that Row. It's okay to specify WHERE
> conditions, ORDER BY sorting, or LIMIT. It's also okay to save() Row
> objects that you fetch using the table-relationships methods.
>
> But any JOIN, GROUP BY or HAVING clause makes it potentially ambiguous
> which rows in the database correspond to those you call save() on, so Rows
> returned from queries with these clauses should be read-only. In this
> case, you must fashion the updates or deletes manually.
>
> Regards,
> Bill Karwin
>

--
View this message in context: http://www.nabble.com/Delete%2C-update-and-insert-in-joined-table-%28model%29-tp18790541p18824426.html
Sent from the Zend DB mailing list archive at Nabble.com.

没有评论: