developer.jelix.org is not used any more and exists only for history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Ticket #643: 643-jDao-automatic-event.diff

File 643-jDao-automatic-event.diff, 5.3 KB (added by thomas, 13 years ago)
  • lib/jelix/dao/jDaoFactoryBase.class.php

     
    205205        $q.= $this->_getPkWhereClauseForNonSelect($keys);
    206206
    207207        if ($this->_deleteBeforeEvent) {
    208             jEvent::notify("daoDeleteBefore", array('dao'=>$this->_daoselector, 'keys'=>$keys));
     208            jEvent::notify("daoDeleteBefore", array('dao'=>$this->_daoSelector, 'keys'=>$keys));
    209209        }
    210210        $result = $this->_conn->exec ($q);
    211211        if ($this->_deleteAfterEvent) {
    212             jEvent::notify("daoDeleteAfter", array('dao'=>$this->_daoselector, 'keys'=>$keys, 'result'=>$result));
     212            jEvent::notify("daoDeleteAfter", array('dao'=>$this->_daoSelector, 'keys'=>$keys, 'result'=>$result));
    213213        }
    214214        return $result;
    215215    }
     
    289297        $query .= $this->_createConditionsClause($searchcond, false);
    290298
    291299        if ($this->_deleteByBeforeEvent) {
    292             jEvent::notify("daoDeleteByBefore", array('dao'=>$this->_daoselector, 'criterias'=>$searchcond));
     300            jEvent::notify("daoDeleteByBefore", array('dao'=>$this->_daoSelector, 'criterias'=>$searchcond));
    293301        }
    294302        $result = $this->_conn->exec($query);
    295303        if ($this->_deleteByAfterEvent) {
    296             jEvent::notify("daoDeleteByAfter", array('dao'=>$this->_daoselector, 'criterias'=>$searchcond, 'result'=>$result));
     304            jEvent::notify("daoDeleteByAfter", array('dao'=>$this->_daoSelector, 'criterias'=>$searchcond, 'result'=>$result));
    297305        }
    298306        return $result;
    299307    }
  • lib/jelix/dao/jDaoGenerator.class.php

     
    198198            $src[] = '}';
    199199
    200200        if($this->_dataParser->hasEvent('insertbefore') || $this->_dataParser->hasEvent('insert')){
    201             $src[] = '   jEvent::notify("daoInsertBefore", array(\'dao\'=>$this->_daoselector, \'record\'=>$record));';
     201            $src[] = '   jEvent::notify("daoInsertBefore", array(\'dao\'=>$this->_daoSelector, \'record\'=>$record));';
    202202        }
    203203        $src[] = '   $result = $this->_conn->exec ($query);';
    204204
     
    230230        }
    231231
    232232        if($this->_dataParser->hasEvent('insertafter') || $this->_dataParser->hasEvent('insert')){
    233             $src[] = '   jEvent::notify("daoInsertAfter", array(\'dao\'=>$this->_daoselector, \'record\'=>$record));';
     233            $src[] = '   jEvent::notify("daoInsertAfter", array(\'dao\'=>$this->_daoSelector, \'record\'=>$record));';
    234234        }
    235235
    236236        $src[] = '    return $result;';
     
    254254
    255255            $src[] = "';";
    256256            if($this->_dataParser->hasEvent('updatebefore') || $this->_dataParser->hasEvent('update')){
    257                 $src[] = '   jEvent::notify("daoUpdateBefore", array(\'dao\'=>$this->_daoselector, \'record\'=>$record));';
     257                $src[] = '   jEvent::notify("daoUpdateBefore", array(\'dao\'=>$this->_daoSelector, \'record\'=>$record));';
    258258            }
    259259            if($this->_dataParser->hasEvent('updateafter') || $this->_dataParser->hasEvent('update')){
    260260                $src[] = '   $result = $this->_conn->exec ($query);';
    261                 $src[] = '   jEvent::notify("daoUpdateAfter", array(\'dao\'=>$this->_daoselector, \'record\'=>$record));';
     261                $src[] = '   jEvent::notify("daoUpdateAfter", array(\'dao\'=>$this->_daoSelector, \'record\'=>$record));';
    262262                $src[] = '   return $result;';
    263263            }
    264264            else
     
    378378                case 'delete':
    379379                case 'update' :
    380380                    if ($method->eventBeforeEnabled || $method->eventAfterEnabled) {
    381                         $methname = ($method->type == 'update'?'Update':'Insert');
     381                        $src[] = '   $args = func_get_args();';
     382                        $methname = ($method->type == 'update'?'Update':'Delete');
    382383                        if ($method->eventBeforeEnabled) {
    383                         $src[] = '   jEvent::notify("daoSpecific'.$methname.'Before", array(\'dao\'=>$this->_daoselector,\'method\'=>\''.
    384                             $method->name.'\', \'params\'=>func_get_args()));';
     384                        $src[] = '   jEvent::notify("daoSpecific'.$methname.'Before", array(\'dao\'=>$this->_daoSelector,\'method\'=>\''.
     385                            $method->name.'\', \'params\'=>$args));';
    385386                        }
    386387                        if ($method->eventAfterEnabled) {
    387388                            $src[] = '   $result = $this->_conn->exec ($__query);';
    388                             $src[] = '   jEvent::notify("daoSpecific'.$methname.'After", array(\'dao\'=>$this->_daoselector,\'method\'=>\''.
    389                                 $method->name.'\', \'params\'=>func_get_args()));';
     389                            $src[] = '   jEvent::notify("daoSpecific'.$methname.'After", array(\'dao\'=>$this->_daoSelector,\'method\'=>\''.
     390                                $method->name.'\', \'params\'=>$args));';
    390391                            $src[] = '   return $result;';
    391392                        } else {
    392393                            $src[] = '    return $this->_conn->exec ($__query);';