Closed andreas-eisenmann closed 1 month ago
Scenario: create a form and set store submissions to true.
Now we have this call stack:
\Statamic\Http\Controllers\FormController::submit |_ \Statamic\Eloquent\Forms\Submission::save |_ \Statamic\Eloquent\Forms\Submission::toModel
In toModel() we have:
toModel()
$model = $class::findOrNew($this->id());
The result of $this->id() is a timestamp - no wonder, just look at the code:
$this->id()
https://github.com/statamic/cms/blob/7cbc505da6c7f2f9568599631b607aa427d5cc62/src/Forms/Submission.php#L52
return $this->id = $id ?: str_replace(',', '.', microtime(true));
Surprise, now we have a database exception:
SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for type bigint: "1715767251.4272" CONTEXT: unnamed portal parameter $1 = '...' (Connection: pgsql, SQL: select * from "form_submissions" where "form_submissions"."id" = 1715767251.4272 limit 1)
How is this supposed to work?
It seems to be due to Postgres being less forgiving than other engines - see the comments here: https://github.com/statamic/eloquent-driver/pull/122#issuecomment-2111965758
Scenario: create a form and set store submissions to true.
Now we have this call stack:
In
toModel()
we have:The result of
$this->id()
is a timestamp - no wonder, just look at the code:https://github.com/statamic/cms/blob/7cbc505da6c7f2f9568599631b607aa427d5cc62/src/Forms/Submission.php#L52
Surprise, now we have a database exception:
How is this supposed to work?