Changeset 594
- Timestamp:
- 09/28/07 12:39:01 (1 year ago)
- Files:
-
- branches/1.0beta3.x/lib/jelix/controllers/jControllerDaoCrud.class.php (modified) (2 diffs)
- branches/1.0beta3.x/lib/jelix/controllers/jControllerDaoCrud.class.php (modified) (2 diffs)
- branches/1.0beta3.x/lib/jelix/forms/jFormsBase.class.php (modified) (2 diffs)
- branches/1.0beta3.x/lib/jelix/forms/jFormsBase.class.php (modified) (2 diffs)
- trunk/lib/jelix/controllers/jControllerDaoCrud.class.php (modified) (2 diffs)
- trunk/lib/jelix/controllers/jControllerDaoCrud.class.php (modified) (2 diffs)
- trunk/lib/jelix/forms/jFormsBase.class.php (modified) (2 diffs)
- trunk/lib/jelix/forms/jFormsBase.class.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.0beta3.x/lib/jelix/controllers/jControllerDaoCrud.class.php
r593 r594 189 189 190 190 if($form->check() && $this->_checkDatas($form)){ 191 $id = $form->saveToDao($this->dao, $this->dbProfil);191 $id = $form->saveToDao($this->dao, null, $this->dbProfil); 192 192 $form->saveAllFiles($this->uploadsDirectory); 193 193 $rep->action = $this->_getAction('view'); … … 265 265 266 266 if($form->check() && $this->_checkDatas($form)){ 267 $id = $form->saveToDao($this->dao, $this->dbProfil);267 $id = $form->saveToDao($this->dao, null, $this->dbProfil); 268 268 $form->saveAllFiles($this->uploadsDirectory); 269 269 $rep->action = $this->_getAction('view'); branches/1.0beta3.x/lib/jelix/controllers/jControllerDaoCrud.class.php
r593 r594 189 189 190 190 if($form->check() && $this->_checkDatas($form)){ 191 $id = $form->saveToDao($this->dao, $this->dbProfil);191 $id = $form->saveToDao($this->dao, null, $this->dbProfil); 192 192 $form->saveAllFiles($this->uploadsDirectory); 193 193 $rep->action = $this->_getAction('view'); … … 265 265 266 266 if($form->check() && $this->_checkDatas($form)){ 267 $id = $form->saveToDao($this->dao, $this->dbProfil);267 $id = $form->saveToDao($this->dao, null, $this->dbProfil); 268 268 $form->saveAllFiles($this->uploadsDirectory); 269 269 $rep->action = $this->_getAction('view'); branches/1.0beta3.x/lib/jelix/forms/jFormsBase.class.php
r593 r594 165 165 * it call insert or update depending the value of the formId stored in the container 166 166 * @param string $daoSelector the selector of a dao file 167 * @param string $key the primary key for the dao. if null, takes the form ID as primary key 167 168 * @param string $dbProfil the jDb profil to use with the dao 168 169 * @return mixed the primary key of the new record in a case of inserting 169 170 * @see jDao 170 171 */ 171 public function saveToDao($daoSelector, $ dbProfil=''){172 public function saveToDao($daoSelector, $key = null, $dbProfil=''){ 172 173 $dao = jDao::create($daoSelector, $dbProfil); 173 174 $daorec = jDao::createRecord($daoSelector, $dbProfil); … … 195 196 } 196 197 if($this->_container->formId){ 197 $daorec->setPk($this->_container->formId); 198 if($key === null) 199 $key = $this->_container->formId; 200 $daorec->setPk($key); 198 201 $dao->update($daorec); 199 202 }else{ 203 if($key !== null) 204 $daorec->setPk($key); 200 205 // todo : what about updating the formId with the Pk. 201 206 $dao->insert($daorec); branches/1.0beta3.x/lib/jelix/forms/jFormsBase.class.php
r593 r594 165 165 * it call insert or update depending the value of the formId stored in the container 166 166 * @param string $daoSelector the selector of a dao file 167 * @param string $key the primary key for the dao. if null, takes the form ID as primary key 167 168 * @param string $dbProfil the jDb profil to use with the dao 168 169 * @return mixed the primary key of the new record in a case of inserting 169 170 * @see jDao 170 171 */ 171 public function saveToDao($daoSelector, $ dbProfil=''){172 public function saveToDao($daoSelector, $key = null, $dbProfil=''){ 172 173 $dao = jDao::create($daoSelector, $dbProfil); 173 174 $daorec = jDao::createRecord($daoSelector, $dbProfil); … … 195 196 } 196 197 if($this->_container->formId){ 197 $daorec->setPk($this->_container->formId); 198 if($key === null) 199 $key = $this->_container->formId; 200 $daorec->setPk($key); 198 201 $dao->update($daorec); 199 202 }else{ 203 if($key !== null) 204 $daorec->setPk($key); 200 205 // todo : what about updating the formId with the Pk. 201 206 $dao->insert($daorec); trunk/lib/jelix/controllers/jControllerDaoCrud.class.php
r593 r594 189 189 190 190 if($form->check() && $this->_checkDatas($form)){ 191 $id = $form->saveToDao($this->dao, $this->dbProfil);191 $id = $form->saveToDao($this->dao, null, $this->dbProfil); 192 192 $form->saveAllFiles($this->uploadsDirectory); 193 193 $rep->action = $this->_getAction('view'); … … 265 265 266 266 if($form->check() && $this->_checkDatas($form)){ 267 $id = $form->saveToDao($this->dao, $this->dbProfil);267 $id = $form->saveToDao($this->dao, null, $this->dbProfil); 268 268 $form->saveAllFiles($this->uploadsDirectory); 269 269 $rep->action = $this->_getAction('view'); trunk/lib/jelix/controllers/jControllerDaoCrud.class.php
r593 r594 189 189 190 190 if($form->check() && $this->_checkDatas($form)){ 191 $id = $form->saveToDao($this->dao, $this->dbProfil);191 $id = $form->saveToDao($this->dao, null, $this->dbProfil); 192 192 $form->saveAllFiles($this->uploadsDirectory); 193 193 $rep->action = $this->_getAction('view'); … … 265 265 266 266 if($form->check() && $this->_checkDatas($form)){ 267 $id = $form->saveToDao($this->dao, $this->dbProfil);267 $id = $form->saveToDao($this->dao, null, $this->dbProfil); 268 268 $form->saveAllFiles($this->uploadsDirectory); 269 269 $rep->action = $this->_getAction('view'); trunk/lib/jelix/forms/jFormsBase.class.php
r593 r594 165 165 * it call insert or update depending the value of the formId stored in the container 166 166 * @param string $daoSelector the selector of a dao file 167 * @param string $key the primary key for the dao. if null, takes the form ID as primary key 167 168 * @param string $dbProfil the jDb profil to use with the dao 168 169 * @return mixed the primary key of the new record in a case of inserting 169 170 * @see jDao 170 171 */ 171 public function saveToDao($daoSelector, $ dbProfil=''){172 public function saveToDao($daoSelector, $key = null, $dbProfil=''){ 172 173 $dao = jDao::create($daoSelector, $dbProfil); 173 174 $daorec = jDao::createRecord($daoSelector, $dbProfil); … … 195 196 } 196 197 if($this->_container->formId){ 197 $daorec->setPk($this->_container->formId); 198 if($key === null) 199 $key = $this->_container->formId; 200 $daorec->setPk($key); 198 201 $dao->update($daorec); 199 202 }else{ 203 if($key !== null) 204 $daorec->setPk($key); 200 205 // todo : what about updating the formId with the Pk. 201 206 $dao->insert($daorec); trunk/lib/jelix/forms/jFormsBase.class.php
r593 r594 165 165 * it call insert or update depending the value of the formId stored in the container 166 166 * @param string $daoSelector the selector of a dao file 167 * @param string $key the primary key for the dao. if null, takes the form ID as primary key 167 168 * @param string $dbProfil the jDb profil to use with the dao 168 169 * @return mixed the primary key of the new record in a case of inserting 169 170 * @see jDao 170 171 */ 171 public function saveToDao($daoSelector, $ dbProfil=''){172 public function saveToDao($daoSelector, $key = null, $dbProfil=''){ 172 173 $dao = jDao::create($daoSelector, $dbProfil); 173 174 $daorec = jDao::createRecord($daoSelector, $dbProfil); … … 195 196 } 196 197 if($this->_container->formId){ 197 $daorec->setPk($this->_container->formId); 198 if($key === null) 199 $key = $this->_container->formId; 200 $daorec->setPk($key); 198 201 $dao->update($daorec); 199 202 }else{ 203 if($key !== null) 204 $daorec->setPk($key); 200 205 // todo : what about updating the formId with the Pk. 201 206 $dao->insert($daorec);
