示例#1
0
 /**
  *
  * take an array of doctrine result rows and turn them into points
  *
  * @param $result - a doctrine result array
  * @param $key_str - the column header string for the point text
  *
  */
 public static function _doctrineResultToPoints($result, $key_str)
 {
     $points = array();
     foreach ($result as $row) {
         $p = Point::buildFromText($row[$key_str]);
         array_push($points, $p);
     }
     return $points;
 }
示例#2
0
 /**
  * will return a random point election
  * @return PointElection
  */
 public static function buildTestPointElection(array $data = null)
 {
     if (empty($data)) {
         $data = array();
     }
     $user_polygons = array(static::buildTestUserPolygon(), static::buildTestUserPolygon(), static::buildTestUserPolygon());
     $x = static::rand_int();
     $y = static::rand_int();
     $defaults = array('point' => Point::buildFromText("POINT({$x} {$y})"), 'user_polygons' => $user_polygons, 'logger' => new \Whathood\Logger());
     return PointElection::build(array_merge($defaults, $data));
 }