You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
✏️ Describe the bug
I've been stuck on this the past few hours and unable to make any headway into solving it. I'm getting an error with a single model and getting the following
Could not create App\\Data\\UserHolidayData: the constructor requires 3 parameters, 1 given. Parameters given: id. Parameters missing: holStart, holEnd
I was planning on using nested Data Objects with constructor promotion so I can't call ->toArray().
I am utterly confused and stumped, I've debugged as far as I can, going so far as to looking into how DataFromArrayResolver works
The createData() in DataFromArrayResolver only return an $id property which explains the null values, but why is that only returning an ID? So back we go to ResolvedDataPipeline L42
if (! is_array($properties)) {
$properties = $this->transformNormalizedToArray($properties);
}
If I dump($properties) before and after this, it returns only an ID after
That's pretty much as far as I got and still don't have an answer as to why this one particular model requires ->toArray()
I've tried to include all the information possible, if you need more please let me know.
✅ Expected behavior
I expect to not need to call ->toArray() when it should handle this model automatically.
🖥️ Versions
Laravel: 11.37.0
Laravel Data: 4.11.1
PHP:8.4
The text was updated successfully, but these errors were encountered:
✏️ Describe the bug
I've been stuck on this the past few hours and unable to make any headway into solving it. I'm getting an error with a single model and getting the following
The code that doesn't work
The code that does work for another model
I can however get this to work by adding
toArray()
I was planning on using nested Data Objects with constructor promotion so I can't call
->toArray()
.I am utterly confused and stumped, I've debugged as far as I can, going so far as to looking into how
DataFromArrayResolver
worksThe
createData()
inDataFromArrayResolver
only return an$id
property which explains the null values, but why is that only returning an ID? So back we go toResolvedDataPipeline
L42If I
dump($properties)
before and after this, it returns only an ID afterThat's pretty much as far as I got and still don't have an answer as to why this one particular model requires
->toArray()
I've tried to include all the information possible, if you need more please let me know.
✅ Expected behavior
I expect to not need to call
->toArray()
when it should handle this model automatically.🖥️ Versions
Laravel: 11.37.0
Laravel Data: 4.11.1
PHP:8.4
The text was updated successfully, but these errors were encountered: