示例#1
0
 /**
  * Hydrate the current object from a $_GET, $_POST, or $_REQUEST array
  *
  * @param Dictionary $request
  * @return $this
  */
 public function createFromCollection(Dictionary $request)
 {
     $this->setDisplayLength($request->tryGet('iDisplayLength'));
     $this->setDisplayStart($request->tryGet('iDisplayStart'));
     $this->setEcho($request->tryGet('sEcho'));
     $this->setSearch($request->tryGet('sSearch'));
     $num = $request->tryGet('iSortingCols');
     $sortCols = array();
     for ($x = 0; $x < $num; $x++) {
         $sortCols[$request->tryGet('iSortCol_' . $x)] = $request->tryGet('sSortDir_' . $x);
     }
     $this->setSortColumns($sortCols);
     return $this;
 }
示例#2
0
 public function testTryGetDefaultValue()
 {
     $this->coll->add('key', 'testing');
     $value = $this->coll->tryGet('key2', 'testingValue');
     $this->assertEquals('testingValue', $value);
 }