2009年7月10日星期五

Re: [fw-db] Complex relational dependencies with Zend_DB_TABLE

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.       
   

没有评论: