コード例 #1
0
 /**
  * Magic Setter -- sets values to $this->_data
  * If $name looks like an ide, the ID version is set
  * Adds to errors if setting an invalid property
  *
  * @param string $name
  * @param mixed $value
  * @return Model $this
  */
 public function __set($name, $value)
 {
     // check to see if this is a valid property or IDE
     $is_ide = preg_match('/_ide$/', $name);
     // if this is property does not exist we add it as a property to the object
     if (!$this->propertyExists($name)) {
         $this->addProperty($name);
     }
     // cast to array or to ModelArrayObject as necessary
     $value = $this->prepSetValue($value);
     $this->_data[$name] = $value;
     // if is IDE, add as an ID as well
     if ($is_ide) {
         $key = aql::get_decrypt_key($name);
         // decrypt ide
         $n_name = substr($name, 0, -1);
         // remove e (from ide)
         $this->_data[$n_name] = decrypt($value, $key);
     }
     return $this;
 }
コード例 #2
0
 /**
  * Gets the proper method name and args to pass to it
  * @param   string  $value
  * @param   string  $operator
  * @param   string  $property
  * @return  array [method arg]
  */
 protected static function getFilterParamArgs($value, $operator, $property)
 {
     if (!is_numeric($value)) {
         $decrypted = decrypt($value, aql::get_decrypt_key($property . 'e'));
         if ($decrypted) {
             $value = $decrypted;
         } else {
             $property = $operator;
         }
     }
     return array('set_' . $property, array($value));
 }