-
-
Notifications
You must be signed in to change notification settings - Fork 84
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
Using bigint as datatype causes "unsaved changes" error. #756
Comments
hum, I'm not very familiar with bigints 🤔 what does your factory look like? |
<?php
namespace App\Factory;
use App\Entity\Bar;
use Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory;
/**
* @extends PersistentProxyObjectFactory<Bar>
*/
final class BarFactory extends PersistentProxyObjectFactory
{
/**
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#factories-as-services
*
* @todo inject services if required
*/
public function __construct()
{
}
public static function class(): string
{
return Bar::class;
}
/**
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#model-factories
*
* @todo add your default values here
*/
protected function defaults(): array|callable
{
return [
];
}
/**
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
*/
protected function initialize(): static
{
return $this
// ->afterInstantiate(function(Bar $bar): void {})
;
}
} Empty, it takes the default '0' when creating the object. |
sorry, but I can't reproduce the problem. Even with doctrine/orm ^2 it is working 🤔 Could you create a public reproducer? or even better: a failing test case in Foundry's tests |
https://github.com/KDederichs/sf-reproducer/tree/foundy/unsaved_changes here's a normal reproducer, (it's a DBAL4 thing so ORM 3 I guess, it doesn't happen with DBAL3). I don't think I can just mess with the foundry test dependencies to force DBAL4 somehow? |
Foundry does not add a constraint on the DBAL, it is compatible with orm 2/3 and dbal 3/4 |
For the record: doctrine/dbal#6650 |
Heya got another fun one for you (though I'm not sure if it's not a Doctrine bug) :)
Given a class Bar:
and a test like this:
you'll get this error:
Looking at the changeset for doctrine it'll for some reason try to convert 0 to "0" even though at no point in time that's accessed as integer.
That also seems to work as expected in DBAL 3 but errors out like this in DBAL 4.
Like I said not sure if it's a foundry thing or not, if it's not tell me and I'll toss it to the doctrine folks :)
The text was updated successfully, but these errors were encountered: