예제 #1
0
 /**
  *
  * @param <type> $table
  * @param ArrayIterator $params
  * @return ArrayObject
  */
 public function search($table, ArrayIterator $params)
 {
     $this->searchParams = $params;
     $this->join();
     if ($table == "analysis") {
         $this->statements->remove("type_event");
     }
     $statement = "SELECT this_.* " . $this->selectAttributes() . " FROM {$table} this_ ";
     $statement .= $this->join();
     $i = 0;
     $this->searchParams->rewind();
     if ($this->searchParams->count() > 0 && !$this->searchParams->offsetExists('true')) {
         $statement .= " WHERE ";
     }
     while ($this->searchParams->valid()) {
         if ($this->statements->containsKey($this->searchParams->key())) {
             if ($i++ > 0) {
                 $statement .= " AND ";
             }
             $clause = $this->statements->get($this->searchParams->key());
             $statement .= str_replace(":" . $this->searchParams->key(), "'" . $this->searchParams->current() . "'", $clause['where']);
         }
         $this->searchParams->next();
     }
     return $this->getObject($statement . " ORDER BY this_.date DESC, this_.id DESC");
 }
예제 #2
0
 /**     
  * @param <type> $key
  * @return Provider
  */
 private function selectTypeOf($key)
 {
     if ($this->types->containsKey($key)) {
         return $this->types->get($key);
     }
     return null;
 }
 private static function isFieldSerializable(Clazz $clazz, Map $whitelist)
 {
     if ($clazz->isPrimitive()) {
         return true;
     }
     return $whitelist->containsKey($clazz);
 }
예제 #4
0
 public function addHook($hook, $callback = null, $recallHook = false)
 {
     if ($this->hooks->containsKey($hook)) {
         throw new RuntimeException('A plugin cannot listen to the same hook several time. Please check ' . $hook);
     }
     $value = array();
     $value['hook'] = $hook;
     $value['callback'] = $callback ? $callback : $hook;
     $value['recallHook'] = $recallHook;
     $this->hooks->put($hook, $value);
 }