We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: Cannot use object of type Doctrine\Common\Lexer\Token as array
at \vendor\creof\geo-parser\lib\CrEOF\Geo\String\Parser.php:471
I created the point type to be used in MySQL 8.0
<?php namespace App\DBAL; use CrEOF\Spatial\PHP\Types\Geometry\Point; use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Types\Type; class PointType extends Type { const POINT = 'point'; public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform): string { return 'POINT'; } public function convertToPHPValue($value, AbstractPlatform $platform) { if (empty($value)) { return null; } $wkb = unpack('H*', $value); $hex = $wkb[1]; return $this->convertWKBToPoint($hex); } private function convertWKBToPoint($hex) { $binary = hex2bin($hex); $srid = unpack('N', substr($binary, 0, 4))[1]; $endian = unpack('C', $binary[4])[1]; $format = $endian === 1 ? 'V' : 'N'; if ($format === 'V') { $coords = unpack('dX/dY', substr($binary, 9)); } else { $coords = unpack('dX/dY', substr($binary, 9)); } return new Point($coords['X'] , $coords['Y']); } public function convertToDatabaseValue($value, AbstractPlatform $platform) { if (empty($value)) { return null; } return sprintf('POINT(%F %F)', $value->getLatitude(), $value->getLongitude()); } public function getName(): string { return self::POINT; } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Error:
Cannot use object of type Doctrine\Common\Lexer\Token as array
at \vendor\creof\geo-parser\lib\CrEOF\Geo\String\Parser.php:471
I created the point type to be used in MySQL 8.0
The text was updated successfully, but these errors were encountered: