0

Could you clarify what is the difference between

autoHydrateEntityFromInput

and

forceEntityHydrationFromInput

? I cannot get it. If I set first property to true then I'll always get input data hydrated to model, but then what's the second property?

Victor
  • 5,073
  • 15
  • 68
  • 120

1 Answers1

0

From the Ardent source code comments:

By default, Ardent will attempt hydration only if the model object contains no attributes and the $autoHydrateEntityFromInput property is set to true.

Setting $forceEntityHydrationFromInput to true will bypass the above check and enforce hydration of model attributes.

For example, if you do:

Model::create(["title"->"My Title"]);

then autoHydrateEntityFromInput will not hydrate but forceEntityHydrationFromInput will.

Pete Thorne
  • 2,656
  • 4
  • 21
  • 29