Changeset 593

Show
Ignore:
Timestamp:
09/28/07 12:18:25 (1 year ago)
Author:
laurentj
Message:

fixed bug #285: jControllerDaoCrud has now a property to indicate the jDb profil to use for the dao, and it is filled automatically by the createdaocrud command.
Added also a parameter to methods of jFormsBase: initFromDao, saveToDao, initControlFromDao, saveControlToDao

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.0beta3.x/lib/jelix-scripts/commands/createdaocrud.cmd.php

    r590 r593  
    5353        $agcommand = jxs_load_command('createdao'); 
    5454        $options = array(); 
     55        $profil = ''; 
    5556        if ($this->getOption('-profil')) { 
    56             $options = array('-profil'=>$this->getOption('-profil')); 
     57            $profil = $this->getOption('-profil'); 
     58            $options = array('-profil'=>$profil); 
    5759        } 
    5860        $agcommand->init($options,array('module'=>$this->_parameters['module'], 'name'=>$ctrlname,'table'=>$table)); 
     
    6567        $this->createDir($path.'controllers/'); 
    6668        $this->createFile($path.'controllers/'.$ctrlname.'.classic.php','controller.daocrud.tpl',array('name'=>$ctrlname,  
    67                 'module'=>$this->_parameters['module'], 'table'=>$table)); 
     69                'module'=>$this->_parameters['module'], 'table'=>$table, 'profil'=>$profil)); 
    6870    } 
    6971} 
  • branches/1.0beta3.x/lib/jelix-scripts/commands/createdaocrud.cmd.php

    r590 r593  
    5353        $agcommand = jxs_load_command('createdao'); 
    5454        $options = array(); 
     55        $profil = ''; 
    5556        if ($this->getOption('-profil')) { 
    56             $options = array('-profil'=>$this->getOption('-profil')); 
     57            $profil = $this->getOption('-profil'); 
     58            $options = array('-profil'=>$profil); 
    5759        } 
    5860        $agcommand->init($options,array('module'=>$this->_parameters['module'], 'name'=>$ctrlname,'table'=>$table)); 
     
    6567        $this->createDir($path.'controllers/'); 
    6668        $this->createFile($path.'controllers/'.$ctrlname.'.classic.php','controller.daocrud.tpl',array('name'=>$ctrlname,  
    67                 'module'=>$this->_parameters['module'], 'table'=>$table)); 
     69                'module'=>$this->_parameters['module'], 'table'=>$table, 'profil'=>$profil)); 
    6870    } 
    6971} 
  • branches/1.0beta3.x/lib/jelix-scripts/templates/controller.daocrud.tpl

    r575 r593  
    1515    protected $form = '{$module}~{$name}'; 
    1616 
     17    protected $dbProfil = '{$profil}'; 
     18 
    1719} 
    1820?> 
  • branches/1.0beta3.x/lib/jelix-scripts/templates/controller.daocrud.tpl

    r575 r593  
    1515    protected $form = '{$module}~{$name}'; 
    1616 
     17    protected $dbProfil = '{$profil}'; 
     18 
    1719} 
    1820?> 
  • branches/1.0beta3.x/lib/jelix/controllers/jControllerDaoCrud.class.php

    r571 r593  
    8989 
    9090    /** 
     91     * the jDb profil to use with the dao 
     92     */ 
     93    protected $dbProfil = ''; 
     94 
     95    /** 
    9196     * Returned a simple html response to display CRUD contents. You can override this 
    9297     * method to return a personnalized response 
     
    124129        $rep = $this->_getResponse(); 
    125130 
    126         $dao = jDao::get($this->dao); 
     131        $dao = jDao::get($this->dao, $this->dbProfil); 
    127132        $results = $dao->findBy(jDao::createConditions(),$offset,$this->listPageSize); 
    128133        $pk = $dao->getPrimaryKeyNames(); 
     
    184189 
    185190        if($form->check() && $this->_checkDatas($form)){ 
    186             $id = $form->saveToDao($this->dao); 
     191            $id = $form->saveToDao($this->dao, $this->dbProfil); 
    187192            $form->saveAllFiles($this->uploadsDirectory); 
    188193            $rep->action = $this->_getAction('view'); 
     
    211216 
    212217        try { 
    213             $form->initFromDao($this->dao); 
     218            $form->initFromDao($this->dao, null, $this->dbProfil); 
    214219        }catch(Exception $e){ 
    215220            $rep->action = $this->_getAction('index'); 
     
    260265 
    261266        if($form->check() && $this->_checkDatas($form)){ 
    262             $id = $form->saveToDao($this->dao); 
     267            $id = $form->saveToDao($this->dao, $this->dbProfil); 
    263268            $form->saveAllFiles($this->uploadsDirectory); 
    264269            $rep->action = $this->_getAction('view'); 
     
    286291        // labels with each values. 
    287292        $form = jForms::create($this->form, $this->pseudoFormId); 
    288         $form->initFromDao($this->dao, $id); 
     293        $form->initFromDao($this->dao, $id, $this->dbProfil); 
    289294 
    290295        $tpl = new jTpl(); 
     
    304309        $id = $this->param('id'); 
    305310        if( $id !== null ){ 
    306             $dao = jDao::get($this->dao); 
     311            $dao = jDao::get($this->dao, $this->dbProfil); 
    307312            $dao->delete($id); 
    308313        } 
  • branches/1.0beta3.x/lib/jelix/controllers/jControllerDaoCrud.class.php

    r571 r593  
    8989 
    9090    /** 
     91     * the jDb profil to use with the dao 
     92     */ 
     93    protected $dbProfil = ''; 
     94 
     95    /** 
    9196     * Returned a simple html response to display CRUD contents. You can override this 
    9297     * method to return a personnalized response 
     
    124129        $rep = $this->_getResponse(); 
    125130 
    126         $dao = jDao::get($this->dao); 
     131        $dao = jDao::get($this->dao, $this->dbProfil); 
    127132        $results = $dao->findBy(jDao::createConditions(),$offset,$this->listPageSize); 
    128133        $pk = $dao->getPrimaryKeyNames(); 
     
    184189 
    185190        if($form->check() && $this->_checkDatas($form)){ 
    186             $id = $form->saveToDao($this->dao); 
     191            $id = $form->saveToDao($this->dao, $this->dbProfil); 
    187192            $form->saveAllFiles($this->uploadsDirectory); 
    188193            $rep->action = $this->_getAction('view'); 
     
    211216 
    212217        try { 
    213             $form->initFromDao($this->dao); 
     218            $form->initFromDao($this->dao, null, $this->dbProfil); 
    214219        }catch(Exception $e){ 
    215220            $rep->action = $this->_getAction('index'); 
     
    260265 
    261266        if($form->check() && $this->_checkDatas($form)){ 
    262             $id = $form->saveToDao($this->dao); 
     267            $id = $form->saveToDao($this->dao, $this->dbProfil); 
    263268            $form->saveAllFiles($this->uploadsDirectory); 
    264269            $rep->action = $this->_getAction('view'); 
     
    286291        // labels with each values. 
    287292        $form = jForms::create($this->form, $this->pseudoFormId); 
    288         $form->initFromDao($this->dao, $id); 
     293        $form->initFromDao($this->dao, $id, $this->dbProfil); 
    289294 
    290295        $tpl = new jTpl(); 
     
    304309        $id = $this->param('id'); 
    305310        if( $id !== null ){ 
    306             $dao = jDao::get($this->dao); 
     311            $dao = jDao::get($this->dao, $this->dbProfil); 
    307312            $dao->delete($id); 
    308313        } 
  • branches/1.0beta3.x/lib/jelix/forms/jFormsBase.class.php

    r579 r593  
    132132     * @param string $daoSelector the selector of a dao file 
    133133     * @param string $key the primary key for the dao. if null, takes the form ID as primary key 
     134     * @param string $dbProfil the jDb profil to use with the dao 
    134135     * @see jDao 
    135136     */ 
    136     public function initFromDao($daoSelector, $key = null){ 
     137    public function initFromDao($daoSelector, $key = null, $dbProfil=''){ 
    137138        if($key === null) 
    138139            $key = $this->_container->formId; 
    139         $dao = jDao::create($daoSelector); 
     140        $dao = jDao::create($daoSelector, $dbProfil); 
    140141        $daorec = $dao->get($key); 
    141142        if(!$daorec) 
     
    164165     * it call insert or update depending the value of the formId stored in the container 
    165166     * @param string $daoSelector the selector of a dao file 
     167     * @param string $dbProfil the jDb profil to use with the dao 
    166168     * @return mixed  the primary key of the new record in a case of inserting 
    167169     * @see jDao 
    168170     */ 
    169     public function saveToDao($daoSelector){ 
    170         $dao = jDao::create($daoSelector); 
    171         $daorec = jDao::createRecord($daoSelector); 
     171    public function saveToDao($daoSelector, $dbProfil=''){ 
     172        $dao = jDao::create($daoSelector, $dbProfil); 
     173        $daorec = jDao::createRecord($daoSelector, $dbProfil); 
    172174        $prop = $dao->getProperties(); 
    173175        foreach($this->_controls as $name=>$ctrl){ 
     
    217219     * @param string $daoSelector the selector of a dao file 
    218220     * @param mixed  $primaryKeyNames list of field corresponding to primary keys (optional) 
     221     * @param string $dbProfil the jDb profil to use with the dao 
    219222     * @see jDao 
    220223     */ 
    221     public function initControlFromDao($controlName, $daoSelector, $primaryKeyNames=null){ 
     224    public function initControlFromDao($controlName, $daoSelector, $primaryKeyNames=null, $dbProfil=''){ 
    222225 
    223226        if(!$this->_controls[$controlName]->isContainer()){ 
     
    233236            $primaryKey =array($primaryKey); 
    234237 
    235         $dao = jDao::create($daoSelector); 
    236         $daorec = jDao::createRecord($daoSelector); 
     238        $dao = jDao::create($daoSelector, $dbProfil); 
     239        $daorec = jDao::createRecord($daoSelector, $dbProfil); 
    237240 
    238241        $conditions = jDao::createConditions(); 
     
    279282     * @param mixed  $primaryKey the primary key if the form have no id. (optional) 
    280283     * @param mixed  $primaryKeyNames list of field corresponding to primary keys (optional) 
     284     * @param string $dbProfil the jDb profil to use with the dao 
    281285     * @see jDao 
    282286     */ 
    283     public function saveControlToDao($controlName, $daoSelector, $primaryKey = null, $primaryKeyNames=null){ 
     287    public function saveControlToDao($controlName, $daoSelector, $primaryKey = null, $primaryKeyNames=null, $dbProfil=''){ 
    284288 
    285289        if(!$this->_controls[$controlName]->isContainer()){ 
  • branches/1.0beta3.x/lib/jelix/forms/jFormsBase.class.php

    r579 r593  
    132132     * @param string $daoSelector the selector of a dao file 
    133133     * @param string $key the primary key for the dao. if null, takes the form ID as primary key 
     134     * @param string $dbProfil the jDb profil to use with the dao 
    134135     * @see jDao 
    135136     */ 
    136     public function initFromDao($daoSelector, $key = null){ 
     137    public function initFromDao($daoSelector, $key = null, $dbProfil=''){ 
    137138        if($key === null) 
    138139            $key = $this->_container->formId; 
    139         $dao = jDao::create($daoSelector); 
     140        $dao = jDao::create($daoSelector, $dbProfil); 
    140141        $daorec = $dao->get($key); 
    141142        if(!$daorec) 
     
    164165     * it call insert or update depending the value of the formId stored in the container 
    165166     * @param string $daoSelector the selector of a dao file 
     167     * @param string $dbProfil the jDb profil to use with the dao 
    166168     * @return mixed  the primary key of the new record in a case of inserting 
    167169     * @see jDao 
    168170     */ 
    169     public function saveToDao($daoSelector){ 
    170         $dao = jDao::create($daoSelector); 
    171         $daorec = jDao::createRecord($daoSelector); 
     171    public function saveToDao($daoSelector, $dbProfil=''){ 
     172        $dao = jDao::create($daoSelector, $dbProfil); 
     173        $daorec = jDao::createRecord($daoSelector, $dbProfil); 
    172174        $prop = $dao->getProperties(); 
    173175        foreach($this->_controls as $name=>$ctrl){ 
     
    217219     * @param string $daoSelector the selector of a dao file 
    218220     * @param mixed  $primaryKeyNames list of field corresponding to primary keys (optional) 
     221     * @param string $dbProfil the jDb profil to use with the dao 
    219222     * @see jDao 
    220223     */ 
    221     public function initControlFromDao($controlName, $daoSelector, $primaryKeyNames=null){ 
     224    public function initControlFromDao($controlName, $daoSelector, $primaryKeyNames=null, $dbProfil=''){ 
    222225 
    223226        if(!$this->_controls[$controlName]->isContainer()){ 
     
    233236            $primaryKey =array($primaryKey); 
    234237 
    235         $dao = jDao::create($daoSelector); 
    236         $daorec = jDao::createRecord($daoSelector); 
     238        $dao = jDao::create($daoSelector, $dbProfil); 
     239        $daorec = jDao::createRecord($daoSelector, $dbProfil); 
    237240 
    238241        $conditions = jDao::createConditions(); 
     
    279282     * @param mixed  $primaryKey the primary key if the form have no id. (optional) 
    280283     * @param mixed  $primaryKeyNames list of field corresponding to primary keys (optional) 
     284     * @param string $dbProfil the jDb profil to use with the dao 
    281285     * @see jDao 
    282286     */ 
    283     public function saveControlToDao($controlName, $daoSelector, $primaryKey = null, $primaryKeyNames=null){ 
     287    public function saveControlToDao($controlName, $daoSelector, $primaryKey = null, $primaryKeyNames=null, $dbProfil=''){ 
    284288 
    285289        if(!$this->_controls[$controlName]->isContainer()){ 
  • trunk/lib/jelix-scripts/commands/createdaocrud.cmd.php

    r590 r593  
    5353        $agcommand = jxs_load_command('createdao'); 
    5454        $options = array(); 
     55        $profil = ''; 
    5556        if ($this->getOption('-profil')) { 
    56             $options = array('-profil'=>$this->getOption('-profil')); 
     57            $profil = $this->getOption('-profil'); 
     58            $options = array('-profil'=>$profil); 
    5759        } 
    5860        $agcommand->init($options,array('module'=>$this->_parameters['module'], 'name'=>$ctrlname,'table'=>$table)); 
     
    6567        $this->createDir($path.'controllers/'); 
    6668        $this->createFile($path.'controllers/'.$ctrlname.'.classic.php','controller.daocrud.tpl',array('name'=>$ctrlname,  
    67                 'module'=>$this->_parameters['module'], 'table'=>$table)); 
     69                'module'=>$this->_parameters['module'], 'table'=>$table, 'profil'=>$profil)); 
    6870    } 
    6971} 
  • trunk/lib/jelix-scripts/commands/createdaocrud.cmd.php

    r590 r593  
    5353        $agcommand = jxs_load_command('createdao'); 
    5454        $options = array(); 
     55        $profil = ''; 
    5556        if ($this->getOption('-profil')) { 
    56             $options = array('-profil'=>$this->getOption('-profil')); 
     57            $profil = $this->getOption('-profil'); 
     58            $options = array('-profil'=>$profil); 
    5759        } 
    5860        $agcommand->init($options,array('module'=>$this->_parameters['module'], 'name'=>$ctrlname,'table'=>$table)); 
     
    6567        $this->createDir($path.'controllers/'); 
    6668        $this->createFile($path.'controllers/'.$ctrlname.'.classic.php','controller.daocrud.tpl',array('name'=>$ctrlname,  
    67                 'module'=>$this->_parameters['module'], 'table'=>$table)); 
     69                'module'=>$this->_parameters['module'], 'table'=>$table, 'profil'=>$profil)); 
    6870    } 
    6971} 
  • trunk/lib/jelix-scripts/templates/controller.daocrud.tpl

    r575 r593  
    1515    protected $form = '{$module}~{$name}'; 
    1616 
     17    protected $dbProfil = '{$profil}'; 
     18 
    1719} 
    1820?> 
  • trunk/lib/jelix-scripts/templates/controller.daocrud.tpl

    r575 r593  
    1515    protected $form = '{$module}~{$name}'; 
    1616 
     17    protected $dbProfil = '{$profil}'; 
     18 
    1719} 
    1820?> 
  • trunk/lib/jelix/controllers/jControllerDaoCrud.class.php

    r571 r593  
    8989 
    9090    /** 
     91     * the jDb profil to use with the dao 
     92     */ 
     93    protected $dbProfil = ''; 
     94 
     95    /** 
    9196     * Returned a simple html response to display CRUD contents. You can override this 
    9297     * method to return a personnalized response 
     
    124129        $rep = $this->_getResponse(); 
    125130 
    126         $dao = jDao::get($this->dao); 
     131        $dao = jDao::get($this->dao, $this->dbProfil); 
    127132        $results = $dao->findBy(jDao::createConditions(),$offset,$this->listPageSize); 
    128133        $pk = $dao->getPrimaryKeyNames(); 
     
    184189 
    185190        if($form->check() && $this->_checkDatas($form)){ 
    186             $id = $form->saveToDao($this->dao); 
     191            $id = $form->saveToDao($this->dao, $this->dbProfil); 
    187192            $form->saveAllFiles($this->uploadsDirectory); 
    188193            $rep->action = $this->_getAction('view'); 
     
    211216 
    212217        try { 
    213             $form->initFromDao($this->dao); 
     218            $form->initFromDao($this->dao, null, $this->dbProfil); 
    214219        }catch(Exception $e){ 
    215220            $rep->action = $this->_getAction('index'); 
     
    260265 
    261266        if($form->check() && $this->_checkDatas($form)){ 
    262             $id = $form->saveToDao($this->dao); 
     267            $id = $form->saveToDao($this->dao, $this->dbProfil); 
    263268            $form->saveAllFiles($this->uploadsDirectory); 
    264269            $rep->action = $this->_getAction('view'); 
     
    286291        // labels with each values. 
    287292        $form = jForms::create($this->form, $this->pseudoFormId); 
    288         $form->initFromDao($this->dao, $id); 
     293        $form->initFromDao($this->dao, $id, $this->dbProfil); 
    289294 
    290295        $tpl = new jTpl(); 
     
    304309        $id = $this->param('id'); 
    305310        if( $id !== null ){ 
    306             $dao = jDao::get($this->dao); 
     311            $dao = jDao::get($this->dao, $this->dbProfil); 
    307312            $dao->delete($id); 
    308313        } 
  • trunk/lib/jelix/controllers/jControllerDaoCrud.class.php

    r571 r593  
    8989 
    9090    /** 
     91     * the jDb profil to use with the dao 
     92     */ 
     93    protected $dbProfil = ''; 
     94 
     95    /** 
    9196     * Returned a simple html response to display CRUD contents. You can override this 
    9297     * method to return a personnalized response 
     
    124129        $rep = $this->_getResponse(); 
    125130 
    126         $dao = jDao::get($this->dao); 
     131        $dao = jDao::get($this->dao, $this->dbProfil); 
    127132        $results = $dao->findBy(jDao::createConditions(),$offset,$this->listPageSize); 
    128133        $pk = $dao->getPrimaryKeyNames(); 
     
    184189 
    185190        if($form->check() && $this->_checkDatas($form)){ 
    186             $id = $form->saveToDao($this->dao); 
     191            $id = $form->saveToDao($this->dao, $this->dbProfil); 
    187192            $form->saveAllFiles($this->uploadsDirectory); 
    188193            $rep->action = $this->_getAction('view'); 
     
    211216 
    212217        try { 
    213             $form->initFromDao($this->dao); 
     218            $form->initFromDao($this->dao, null, $this->dbProfil); 
    214219        }catch(Exception $e){ 
    215220            $rep->action = $this->_getAction('index'); 
     
    260265 
    261266        if($form->check() && $this->_checkDatas($form)){ 
    262             $id = $form->saveToDao($this->dao); 
     267            $id = $form->saveToDao($this->dao, $this->dbProfil); 
    263268            $form->saveAllFiles($this->uploadsDirectory); 
    264269            $rep->action = $this->_getAction('view'); 
     
    286291        // labels with each values. 
    287292        $form = jForms::create($this->form, $this->pseudoFormId); 
    288         $form->initFromDao($this->dao, $id); 
     293        $form->initFromDao($this->dao, $id, $this->dbProfil); 
    289294 
    290295        $tpl = new jTpl(); 
     
    304309        $id = $this->param('id'); 
    305310        if( $id !== null ){ 
    306             $dao = jDao::get($this->dao); 
     311            $dao = jDao::get($this->dao, $this->dbProfil); 
    307312            $dao->delete($id); 
    308313        } 
  • trunk/lib/jelix/forms/jFormsBase.class.php

    r579 r593  
    132132     * @param string $daoSelector the selector of a dao file 
    133133     * @param string $key the primary key for the dao. if null, takes the form ID as primary key 
     134     * @param string $dbProfil the jDb profil to use with the dao 
    134135     * @see jDao 
    135136     */ 
    136     public function initFromDao($daoSelector, $key = null){ 
     137    public function initFromDao($daoSelector, $key = null, $dbProfil=''){ 
    137138        if($key === null) 
    138139            $key = $this->_container->formId; 
    139         $dao = jDao::create($daoSelector); 
     140        $dao = jDao::create($daoSelector, $dbProfil); 
    140141        $daorec = $dao->get($key); 
    141142        if(!$daorec) 
     
    164165     * it call insert or update depending the value of the formId stored in the container 
    165166     * @param string $daoSelector the selector of a dao file 
     167     * @param string $dbProfil the jDb profil to use with the dao 
    166168     * @return mixed  the primary key of the new record in a case of inserting 
    167169     * @see jDao 
    168170     */ 
    169     public function saveToDao($daoSelector){ 
    170         $dao = jDao::create($daoSelector); 
    171         $daorec = jDao::createRecord($daoSelector); 
     171    public function saveToDao($daoSelector, $dbProfil=''){ 
     172        $dao = jDao::create($daoSelector, $dbProfil); 
     173        $daorec = jDao::createRecord($daoSelector, $dbProfil); 
    172174        $prop = $dao->getProperties(); 
    173175        foreach($this->_controls as $name=>$ctrl){ 
     
    217219     * @param string $daoSelector the selector of a dao file 
    218220     * @param mixed  $primaryKeyNames list of field corresponding to primary keys (optional) 
     221     * @param string $dbProfil the jDb profil to use with the dao 
    219222     * @see jDao 
    220223     */ 
    221     public function initControlFromDao($controlName, $daoSelector, $primaryKeyNames=null){ 
     224    public function initControlFromDao($controlName, $daoSelector, $primaryKeyNames=null, $dbProfil=''){ 
    222225 
    223226        if(!$this->_controls[$controlName]->isContainer()){ 
     
    233236            $primaryKey =array($primaryKey); 
    234237 
    235         $dao = jDao::create($daoSelector); 
    236         $daorec = jDao::createRecord($daoSelector); 
     238        $dao = jDao::create($daoSelector, $dbProfil); 
     239        $daorec = jDao::createRecord($daoSelector, $dbProfil); 
    237240 
    238241        $conditions = jDao::createConditions(); 
     
    279282     * @param mixed  $primaryKey the primary key if the form have no id. (optional) 
    280283     * @param mixed  $primaryKeyNames list of field corresponding to primary keys (optional) 
     284     * @param string $dbProfil the jDb profil to use with the dao 
    281285     * @see jDao 
    282286     */ 
    283     public function saveControlToDao($controlName, $daoSelector, $primaryKey = null, $primaryKeyNames=null){ 
     287    public function saveControlToDao($controlName, $daoSelector, $primaryKey = null, $primaryKeyNames=null, $dbProfil=''){ 
    284288 
    285289        if(!$this->_controls[$controlName]->isContainer()){ 
  • trunk/lib/jelix/forms/jFormsBase.class.php

    r579 r593  
    132132     * @param string $daoSelector the selector of a dao file 
    133133     * @param string $key the primary key for the dao. if null, takes the form ID as primary key 
     134     * @param string $dbProfil the jDb profil to use with the dao 
    134135     * @see jDao 
    135136     */ 
    136     public function initFromDao($daoSelector, $key = null){ 
     137    public function initFromDao($daoSelector, $key = null, $dbProfil=''){ 
    137138        if($key === null) 
    138139            $key = $this->_container->formId; 
    139         $dao = jDao::create($daoSelector); 
     140        $dao = jDao::create($daoSelector, $dbProfil); 
    140141        $daorec = $dao->get($key); 
    141142        if(!$daorec) 
     
    164165     * it call insert or update depending the value of the formId stored in the container 
    165166     * @param string $daoSelector the selector of a dao file 
     167     * @param string $dbProfil the jDb profil to use with the dao 
    166168     * @return mixed  the primary key of the new record in a case of inserting 
    167169     * @see jDao 
    168170     */ 
    169     public function saveToDao($daoSelector){ 
    170         $dao = jDao::create($daoSelector); 
    171         $daorec = jDao::createRecord($daoSelector); 
     171    public function saveToDao($daoSelector, $dbProfil=''){ 
     172        $dao = jDao::create($daoSelector, $dbProfil); 
     173        $daorec = jDao::createRecord($daoSelector, $dbProfil); 
    172174        $prop = $dao->getProperties(); 
    173175        foreach($this->_controls as $name=>$ctrl){ 
     
    217219     * @param string $daoSelector the selector of a dao file 
    218220     * @param mixed  $primaryKeyNames list of field corresponding to primary keys (optional) 
     221     * @param string $dbProfil the jDb profil to use with the dao 
    219222     * @see jDao 
    220223     */ 
    221     public function initControlFromDao($controlName, $daoSelector, $primaryKeyNames=null){ 
     224    public function initControlFromDao($controlName, $daoSelector, $primaryKeyNames=null, $dbProfil=''){ 
    222225 
    223226        if(!$this->_controls[$controlName]->isContainer()){ 
     
    233236            $primaryKey =array($primaryKey); 
    234237 
    235         $dao = jDao::create($daoSelector); 
    236         $daorec = jDao::createRecord($daoSelector); 
     238        $dao = jDao::create($daoSelector, $dbProfil); 
     239        $daorec = jDao::createRecord($daoSelector, $dbProfil); 
    237240 
    238241        $conditions = jDao::createConditions(); 
     
    279282     * @param mixed  $primaryKey the primary key if the form have no id. (optional) 
    280283     * @param mixed  $primaryKeyNames list of field corresponding to primary keys (optional) 
     284     * @param string $dbProfil the jDb profil to use with the dao 
    281285     * @see jDao 
    282286     */ 
    283     public function saveControlToDao($controlName, $daoSelector, $primaryKey = null, $primaryKeyNames=null){ 
     287    public function saveControlToDao($controlName, $daoSelector, $primaryKey = null, $primaryKeyNames=null, $dbProfil=''){ 
    284288 
    285289        if(!$this->_controls[$controlName]->isContainer()){ 
Download in other formats: Unified Diff Zip Archive