diff --git a/src/LiveComponent/doc/index.rst b/src/LiveComponent/doc/index.rst index a7ec0652a5c..1824273c6ac 100644 --- a/src/LiveComponent/doc/index.rst +++ b/src/LiveComponent/doc/index.rst @@ -525,6 +525,17 @@ Doctrine entity objects are a special case for ``LiveProp``:: public Post $post; } +.. note:: + + If you're using entities as ``LiveProp`` and having a ``mount`` method declared in + your component, it's required to manually hydrate the corresponding prop:: + + public function mount(Post $post) + { + $this->post = $post; + // .. doing something + } + If the ``Post`` object is persisted, its dehydrated to the entity's ``id`` and then hydrated back by querying the database. If the object is unpersisted, it's dehydrated to an empty array, then hydrated back by creating an *empty* object