コード例 #1
0
ファイル: rifModel.php プロジェクト: elribonazo/riframework
	/**
	 * [set description]
	 * @param string
	 * @param string
	 */
	public function set($property, $value){
		if(!property_exists($this->model, $property)){
			rifException::modelException(array(
				'message'=> $this->lng->__("Property __prop__ does not exist",array("prop"=>$property))
			));
		}
		if(!isset($this->modelAnotations['properties'][$property]['type'])){
			rifException::modelException(array(
				'message'=> $this->lng->__("Property __prop__ doesn't have a declared type.",array("prop"=>$property))
			));
		}
		$type = $this->modelAnotations['properties'][$property]['type'];

		if($type === "integer" && !is_int((int) $value)){
			rifException::modelException(array(
				'message'=> $this->lng->__("Property __prop__ is not a __type__",array("prop"=>$property,"type"=>$type))
			));
		}else if($type === "double" && !is_double((double) $value)){
			rifException::modelException(array(
				'message'=> $this->lng->__("Property __prop__ is not a __type__",array("prop"=>$property,"type"=>$type))
			));
		}else if($type === "bool" && !is_bool((bool) $value)){
			rifException::modelException(array(
				'message'=> $this->lng->__("Property __prop__ is not a __type__",array("prop"=>$property,"type"=>$type))
			));
		}else if($type === "float" && !is_float((float) $value)){
			rifException::modelException(array(
				'message'=> $this->lng->__("Property __prop__ is not a __type__",array("prop"=>$property,"type"=>$type))
			));
		}else if($type === "string" && !is_string((string) $value)){
			rifException::modelException(array(
				'message'=> $this->lng->__("Property __prop__ is not a __type__",array("prop"=>$property,"type"=>$type))
			));
		}

		$this->model->$property = $value;
	}
コード例 #2
0
ファイル: pdoHelper.php プロジェクト: elribonazo/riframework
 /**
  * [order description]
  * @param  string
  * @param  string
  * @return string
  */
 public function order($orderField, $orderSort)
 {
     if (!is_string($orderField) || !is_string($orderSort)) {
         rifException::modelException(array('message' => $this->lng->__("Invalid order parameters")));
     }
     $query = "";
     if ($this->firstOrder) {
         $this->firstOrder = false;
         $query .= "ORDER BY ";
     } else {
         $query .= ", ";
     }
     $query .= $orderField . " " . $orderSort . " ";
     return $query;
 }