You are probably looking to minimize the number of queries emitted in
favor of a more complex join. I originally explored this by trying to
add feature called 'composite rowsets' in my code- it could return
multiple result sets (from different tables), in a single join.
Unfortunately, i never completely fleshed out the API and feature yet
for ZF.
In the mean time, its probably best to use a mixture of Zend_Db_Table
and a DomainModel pattern to accomplish the blend of performance and
easy of use.
-ralph
Mathias Grub wrote:
> thank you for the answer.
>
> probably this will work, but at the cost of the doubled amount of
> database queries.
> Because the
>
> fetchDependentRowset() and fetchParentRow() methods of Zend_Db_Table_Row
>
> are mehtods of Zend_Db_Table_Row and not e.g. of Zend_Db_Table_Select
> first you have to query the parent row, and after that you are enabled
> to query dependend rows it.
>
> ok, but not ideal.
>
> anyway, thanks.
>
>
> pakmannen schrieb:
>> The fetchDependentRowset() and fetchParentRow() methods of Zend_Db_Table_Row
>> can take a Zend_Db_Select object as the third parameter, so use that to
>> specify any other criteria you need.
>>
>> /Jens Ljungblad
>>
>>
>> Mathias Grub-2 wrote:
>>
>>> Hello,
>>>
>>> I would like to use the zend framework api as far and mutch as possible.
>>> Now, concernig the zend_db_table and zend_db_table_row i wonder if i can
>>> use the depencies features at all:
>>>
>>> - you can specify dependend tables
>>> - you can specify a referential column map with as many columns as you
>>> want
>>>
>>> but
>>>
>>> - you cannot specify the operators to be used for the referntial
>>> columns, e.g =, <>, >, < or more complex operators like SQL function,
>>> or did I miss something?
>>> - you cannot pass SQL expressions or/and parameters to the rules, like a
>>> date or timestamp for comparison,
>>> or did I miss something?
>>> - you cannot extend the rule system by custom rules, can you?
>>>
>>> If I am right, the only possibility to accomplish these extended rules
>>> in ZEND_DB_TABLE relationships is to extend Zend_DB_Table and / or
>>> Zend_DB_Table_Row with custom logic.
>>> Am I right?
>>>
>>> Szenario:
>>> You want to select records of table B dependend on a parent record of
>>> table A.
>>> You don't have a simple FK constraint. Your RDB Model have a "valid
>>> record" model for every record.
>>> So you want to query only the valid records with:
>>>
>>> is_active = true
>>> valid_from <= timestamp (TYPE)
>>> valid_to >= timestamp (TYPE)
>>> parent_no = no of the parent record
>>>
>>> timestamp must be a parameter of type timestamp, in order to be able to
>>> query future or past dates.
>>> "no" and not "id" is used because the rule must be bidirectional, and
>>> for the parent record also always only the valid record should be
>>> selected, not the unique by id!
>>>
>>> any suggestions to get this out of zend_db_table or zend_db_table_row
>>> with its own rule system?
>>> if there is a rule system, i'd like to use it, instead of extending the
>>> classes in order to built my own rule system!
>>>
>>> thanx for any hints.
>>>
>>>
>>>
>>
>>
>
>
> pakmannen schrieb:
>> The fetchDependentRowset() and fetchParentRow() methods of Zend_Db_Table_Row
>> can take a Zend_Db_Select object as the third parameter, so use that to
>> specify any other criteria you need.
>>
>> /Jens Ljungblad
>>
>>
>> Mathias Grub-2 wrote:
>>
>>> Hello,
>>>
>>> I would like to use the zend framework api as far and mutch as possible.
>>> Now, concernig the zend_db_table and zend_db_table_row i wonder if i can
>>> use the depencies features at all:
>>>
>>> - you can specify dependend tables
>>> - you can specify a referential column map with as many columns as you
>>> want
>>>
>>> but
>>>
>>> - you cannot specify the operators to be used for the referntial
>>> columns, e.g =, <>, >, < or more complex operators like SQL function,
>>> or did I miss something?
>>> - you cannot pass SQL expressions or/and parameters to the rules, like a
>>> date or timestamp for comparison,
>>> or did I miss something?
>>> - you cannot extend the rule system by custom rules, can you?
>>>
>>> If I am right, the only possibility to accomplish these extended rules
>>> in ZEND_DB_TABLE relationships is to extend Zend_DB_Table and / or
>>> Zend_DB_Table_Row with custom logic.
>>> Am I right?
>>>
>>> Szenario:
>>> You want to select records of table B dependend on a parent record of
>>> table A.
>>> You don't have a simple FK constraint. Your RDB Model have a "valid
>>> record" model for every record.
>>> So you want to query only the valid records with:
>>>
>>> is_active = true
>>> valid_from <= timestamp (TYPE)
>>> valid_to >= timestamp (TYPE)
>>> parent_no = no of the parent record
>>>
>>> timestamp must be a parameter of type timestamp, in order to be able to
>>> query future or past dates.
>>> "no" and not "id" is used because the rule must be bidirectional, and
>>> for the parent record also always only the valid record should be
>>> selected, not the unique by id!
>>>
>>> any suggestions to get this out of zend_db_table or zend_db_table_row
>>> with its own rule system?
>>> if there is a rule system, i'd like to use it, instead of extending the
>>> classes in order to built my own rule system!
>>>
>>> thanx for any hints.
>>>
>>>
>>>
>>
>>
没有评论:
发表评论