예제 #1
0
	/**
	 * Populates the model info.
	 *
	 * @param int $info_flags					- Additional info to load
	 */
	protected function Load($info_flags = false)
	{
		// Resolve the start index to fetch
		if ($this->paginate AND !$this->start)
		{
			// actual start index
			$this->start = $this->paginate ? (max(($this->page - 1), 0) * $this->quantity) : 0;
		}

		return parent::Load($info_flags);
	}
예제 #2
0
 /**
  * Copies info from this object to another of the same type.
  * This is usefull when using a generic collection class that used a parent type
  * to fetch the items.
  *
  * @param vB_Model $target
  */
 public function castInfo($target)
 {
     if (!$target instanceof $this) {
         throw new vB_Exception_Model('Can not castInfo with mismatching types');
     }
     $info = array();
     $properties = array_merge($this->item_properties, $target->item_properties);
     foreach ($properties as $property) {
         $info[$property] = $this->{$property};
     }
     $target->setInfo($info, $this->loaded_info);
 }