C O N O S C E N Z A
web data management
Il nostro è un team che si occupa ormai da piu' di un decennio della risoluzione delle problematiche informatiche, in particolare ci piace poter offrire la nostra competenza in ambito telematico, dalla progettazione su misura della vostra infrastruttura web, alla realizzazione del vostro software e dei vostri portali.
Zend Framework

Multiple primary key in 'Zend Db Table Abstract' model

09/04/2010

To use Multiple primary key in 'Zend Db Table Abstract' model we must use a $primary protected array like i made in the next attach model::

Per usare chiavi primarie multiple in un modello di tipo   'Zend Db Table Abstract' dobbiamo usare come chiave $primary protected un arry come è stato fatto nel modello che incollo di seguito::

 

 

MatchingFigure.php

 

 

<?php

class MatchingFigure extends Zend_Db_Table_Abstract
{
    protected $_name = 'matching_figure';
    protected $_primary = array('cod_figure', 'cod_consul');

   
}

?>

 

To use the find default  'Zend Db Table ' function we must pass multiple primary value as the follow:

    Zend_Loader::loadClass('MatchingFigure');   
    $MatchingFigure=new MatchingFigure;

    $MatchingFigureRows=$MatchingFigure->find('255','carlo');

 and print it to video screen

    MatchingFigureRows=MatchingFigureRows->toArray();
    zend_debug::dump($MatchingFigureRows);

Per usare la funzione di default find di  'Zend Db Table ' dobbiamo passare multipli valori primari come fatto sopra...ed eventualmente stampare a video i valori!