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
edit/note: if relevant, we're still using v3 (3.10.0)
I seem to be misunderstanding what MapName and MapInputName are supposed to do:
> class SCCExample extends Spatie\LaravelData\Data {
public function __construct(
#[Spatie\LaravelData\MapInputName('ticket_price')]
public string $ticketPrice,
){}
}
> SCCExample::from(['ticket_price' => '10'])
Spatie\LaravelData\Exceptions\CannotCreateData Could not create `SCCExample`: the constructor requires 1 parameters, 0 given. Parameters missing: ticketPrice.
> class SCCExample2 extends Spatie\LaravelData\Data {
public function __construct(
#[Spatie\LaravelData\MapName('ticket_price')]
public string $ticketPrice,
){}
}
> SCCExample2::from(['ticket_price' => '10'])
Spatie\LaravelData\Exceptions\CannotCreateData Could not create `SCCExample2`: the constructor requires 1 parameters, 0 given. Parameters missing: ticketPrice.
It's my understanding that the MapName/MapInputName should enable me to use the aliased name (in this case ticket_price) to map to ticketPrice but it continues to fail saying the parameter is missing.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
edit/note: if relevant, we're still using v3 (3.10.0)
I seem to be misunderstanding what
MapName
andMapInputName
are supposed to do:It's my understanding that the
MapName
/MapInputName
should enable me to use the aliased name (in this caseticket_price
) to map toticketPrice
but it continues to fail saying the parameter is missing.Beta Was this translation helpful? Give feedback.
All reactions