Open robertkabat opened 6 years ago
@fzaninotto what are the original intentions from the ORM implementation. Just to populate the data or also the take the schema into account like mentioned above.
yes, we should take the schema into account as much as possible to generate proper data.
@fzaninotto im a bit struggling with the solution here though since the provider will generate a name base on field guess. However we do not have a max chars or something and only on text
we can actually use it performance wise as well.
We could decide to strip the chars if they are too long though even though that wont be a very neath solution either.
maybe the ColumnTypeGuesser should return an object rather than just a string?
Hello,
I got simple Doctrine entity with 3 fields on it:
Now I am trying to populate that entity with some random data(this is just example, actually I got bunch of entities but this is the first that's causing a problem I assume I would get that with some other entities as well):
The problem occurs while preparing $description. For some reason length of that field is not being captured.
I went to /vendor/fzaninotto/faker/src/Faker/ORM/Doctrine/EntityPopulator.php to guessColumnFormatters method and I've noticed that for some reason for this one field size in not captured - at least that's what I think I didn't study the whole thing.
As a result I get field that should have 50 character top with string longer then 50 characters. That of course fails while I'm trying to save that to database.
Is there anything wrong I am doing here? I really can't see any solution here. I will have to populate many entities like that and I wanted to automate that process and I would like to avoid specifying dummy data manually.
Did I get anything wrong here? If that's not a bug but just my mistake could someone please be so kind and point me in the right direction.
Regards, Rob
UPDATE
I got to the story/vendor/fzaninotto/faker/src/Faker/Guesser/Name.php and I can see here:
That you are not checking for the length. Shouldn't it take the length from entity's annotation and trim the string or generate proper length?