You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An exception occurred while executing 'INSERT INTO geo_point (address, coordinates) VALUES (?, ?)' with params ["Test", "POINT(-73.976683 40.760381)"]:
SQLSTATE[22003]: Numeric value out of range: 1416 Cannot get geometry object from data you send to the GEOMETRY field
Result query:
INSERT INTO geo_point (address, coordinates) VALUES ('Test', 'POINT(-73.976683 40.760381)');
My Entity:
namespace BackendLib\Entity;
use Doctrine\ORM\Mapping as ORM;
use CrEOF\Spatial\PHP\Types\Geometry\Point;
class GeoPoint
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $address;
/**
* @ORM\Column(type="point", nullable=true)
*/
private $point;
public function getId(): ?int
{
return $this->id;
}
public function getAddress(): ?string
{
return $this->address;
}
public function setAddress(string $address): self
{
$this->address = $address;
return $this;
}
public function setPoint(?Point $point): self
{
$this->point = $point;
return $this;
}
public function getPoint(): ?Point
{
return $this->point;
}
}
This is how I store it:
$obj = new GeoPoint();
$obj->setAddress('Test');
$obj->setPoint(new Point(40.7603807, -73.9766831));
$manager->persist($obj);
$manager->flush();
The text was updated successfully, but these errors were encountered:
How do I store POINT type?
Result query:
My Entity:
This is how I store it:
The text was updated successfully, but these errors were encountered: