php - Error in Form Objects in FLUID TYPO3 -


i created custom model called play , has properties title , body getters , setters.

in 1 of controller master , have new , create actions

public function newaction(\typo3\playground\domain\model\play $newplay = null) {     $this->view->assign('newplay', $newplay); } 

my view looks this:

<table>         <f:form action="create" name="newplay" object="{newplay}">             <th>title:</th>             <td>                 <f:form.textfield property="title"/>             </td>             <th>body:</th>             <td>                 <f:form.textarea property="body"/>             </td>             </th>             <tr>                 <td>                     <f:form.submit value="create"/>                 </td>             </tr>         </f:form>     </table> 

but in create function in controller error required argument "newplay" not set.

public function createaction(\typo3\playground\domain\model\play $newplay) {     echo $newplay->getbody();     echo $newplay->gettitle(); } 

am missing here?

update

after matching name object , removing brackets of property fields, error:

exception while property mapping @ property path "":no converter found can used convert "array" "typo3\playground\domain\model\play".

my solution it

i'm sure there neat way this

public function createaction() {      $newplayarray=$this->request->getargument('newplay');     $newplay = json_decode(json_encode($newplayarray), false);     echo $newplay->title;  } 

the name of form must match object

<f:form action="create" name="newplay" object="{newplay}"> 

it used set name of fields.

update

have set phpdoc comments? these required , importan extbase development. example:

/**  * @param \typo3\playground\domain\model\play $newplay  * @dontvalidate $newplay  */ public function newaction(\typo3\playground\domain\model\play $newplay = null) {     $this->view->assign('newplay', $newplay); } 

Comments