-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
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
"Expected MatanYadaev\EloquentSpatial\GeometryCast, string given" while swapping two records #79
Comments
Hi @RahulKRaj7, can you share with me a wider context? Ideally, if you could fork this repo and add a failing test, it will help me to understand the issue better. I reproduced this error with a slightly different error message: So I would like to understand how to reproduce your case. |
Thanks @MatanYadaev for your reply and for your work on this library. but sorry i didn't get time to fork this repo and add and test the failing test. Here's a failing test, which I thought would pass: it('throws exception when swapping geometry field in two records using getAttributes()', function (): void
{
expect(function (): void {
$point = new Point(0, 180);
$point2 = new Point(0, 0);
$testPlace = TestPlace::factory()->make([
'point' => $point,
]);
$testPlace2 = TestPlace::factory()->make([
'point' => $point2,
]);
$oldAttributes = $testPlace->getAttributes();
$newAttributes = $testPlace2->getAttributes();
Arr::forget($oldAttributes, $testPlace->getKeyName());
Arr::forget($newAttributes, $testPlace->getKeyName());
$testPlace->forceFill($newAttributes);
$testPlace2->forceFill($oldAttributes);
})->toThrow(InvalidArgumentException::class);
}); |
@RahulKRaj7 Fixed, thanks for the help. |
@MatanYadaev faces this issue in the |
Hi!,
i am trying to implement draft functionality on model. in that while trying to swap two records. i am facing
Expected MatanYadaev\EloquentSpatial\GeometryCast, string given
this type of error.Updating location data doesn't work.
Below is the snapshot of swapping code.
The field is casted in model as
location' => Point::class,
in the migration the field is created as
$table->point('location')->nullable();
Using Laravel-Drafts package for implementing draft functionality.
The text was updated successfully, but these errors were encountered: