2008年11月20日星期四

Res: [fw-db] Foreign Keys in ZF

Hi,

Yes, you need to specify rules to use some Zend_Db facilities like methods findDependentRowset, findParentRow, some cascade operations and others you can see in:

http://framework.zend.com/manual/en/zend.db.table.relationships.html

But, if you don't want to use the facilities above, you don't need to populate the $_referenceMap, even if you have FK in DB.


I hope it helps you.

Best regards,
Luiz Fernando



De: Carlos Castro <carloscastro.carlos@gmail.com>
Para: fw-db@lists.zend.com
Enviadas: Quinta-feira, 20 de Novembro de 2008 20:24:57
Assunto: [fw-db] Foreign Keys in ZF

Hi everybody,
I need some help to understand the tables relations on ZF.
Through Programmers Reference Guide, i can see next example:

class Bugs extends Zend_Db_Table_Abstract
{
    protected $_name            = 'bugs';

    protected $_dependentTables = array('BugsProducts');

    protected $_referenceMap    = array(
        'Reporter' => array(
            'columns'           => 'reported_by',
            'refTableClass'     => 'Accounts',
            'refColumns'        => 'account_name '
        ),

My question is about $_referenceMap.  To represent the foreign keys of my DB, i need to specify rules (like, in this case, Reporter)? On DB, to create Foreign Keys, i don't need inserting some kind of data into tables.

Thanks by helping  me!




Veja quais são os assuntos do momento no Yahoo! + Buscados: Top 10 - Celebridades - Música - Esportes


Veja quais são os assuntos do momento no Yahoo! + Buscados: Top 10 - Celebridades - Música - Esportes

没有评论: