Ejemplo n.º 1
0
 /**
  * @group geometry
  */
 public function testSTAsBinary()
 {
     $lineString1 = array(new Point(0, 0), new Point(2, 2), new Point(5, 5));
     $lineString2 = array(new Point(3, 3), new Point(4, 15), new Point(5, 22));
     $entity1 = new LineStringEntity();
     $entity1->setLineString(new LineString($lineString1));
     $this->getEntityManager()->persist($entity1);
     $entity2 = new LineStringEntity();
     $entity2->setLineString(new LineString($lineString2));
     $this->getEntityManager()->persist($entity2);
     $this->getEntityManager()->flush();
     $this->getEntityManager()->clear();
     $query = $this->getEntityManager()->createQuery('SELECT ST_AsBinary(l.lineString) FROM CrEOF\\Spatial\\Tests\\Fixtures\\LineStringEntity l');
     $result = $query->getResult();
     $this->assertEquals('010200000003000000000000000000000000000000000000000000000000000040000000000000004000000000000014400000000000001440', bin2hex(Utils::toBinary(stream_get_contents($result[0][1]))));
     $this->assertEquals('0102000000030000000000000000000840000000000000084000000000000010400000000000002e4000000000000014400000000000003640', bin2hex(Utils::toBinary(stream_get_contents($result[1][1]))));
 }
Ejemplo n.º 2
0
 /**
  * @param string $input
  */
 private function setInput($input)
 {
     $this->input = Utils::toBinary($input);
 }