Ejemplo n.º 1
0
 /**
  * Creates a new instance of the Query Logger and attaches
  * this logger to the adapter.
  *
  * @static
  * @param RedBean_Observable $adapter the adapter you want to attach to
  *
  * @return RedBean_Plugin_QueryLogger $querylogger instance of the Query Logger
  */
 public static function getInstanceAndAttach(RedBean_Observable $adapter)
 {
     $queryLog = new RedBean_Plugin_QueryLogger();
     $adapter->addEventListener('sql_exec', $queryLog);
     return $queryLog;
 }
Ejemplo n.º 2
0
 /**
  * Attaches the FUSE event listeners. Now the Model Helper will listen for
  * CRUD events. If a CRUD event occurs it will send a signal to the model
  * that belongs to the CRUD bean and this model will take over control from
  * there.
  *
  * @param RedBean_Observable $observable
  *
  * @return void
  */
 public function attachEventListeners(RedBean_Observable $observable)
 {
     foreach (array('update', 'open', 'delete', 'after_delete', 'after_update', 'dispense') as $e) {
         $observable->addEventListener($e, $this);
     }
 }