I have this action:
/**
* updateForm action
*
* @param \Whmcs\Registration\Domain\Model\User $user
* @validate $user \Whmcs\Registration\Validation\Validator\ValidateValidator
* @return void
*/
public function updateFormAction(\Whmcs\Registration\Domain\Model\User $user)
{
$dbuser = $this->userRepository->getUserByMail($user->getEMailAddress())[0];
$this->view->assign('user',$dbuser);
}
which uses this view:
<f:layout name="default" />
<f:section name="content">
<legend>Benutzerdetails hinzufuegen</legend>
<f:render partial="Error" arguments="{object:user}" />
<f:form action="update" object="{user}" name="user" arguments="{user:user}" additionalAttributes="{role:'form'}">
...
</f:form>
</f:section>
When I try to open the page, I only see a blank page. In my apache error.log this line appears:
PHP Fatal error: Call to a member function setParent() on a non-object in /var/www/typo3_src-6.2.x/typo3/sysext/extbase/Classes/Error/Result.php on line 216
If i remove
<f:render partial="Error" arguments="{object:user}" />
from the view, or remove
$this->view->assign('user',$dbuser);
from the action, the site loads correctly.
The partial I try to render contains this:
<f:form.validationResults for="{object}">
<f:if condition="{validationResults.flattenedErrors}">
<div class="alert-box radius alert radius">
<f:for each="{validationResults.flattenedErrors}" as="errors" key="propertyPath">
<ul>
<f:for each="{errors}" as="error">
{error}
<br />
</f:for>
</ul>
</f:for>
</div>
</f:if>
</f:form.validationResults>
anyone knows this error?
The problem is probably this line:
Unless your QuerySettings include "setReturnRawQueryResult(TRUE)" you should NEVER treat an extbase-result like an array. To get the first entry from your result, use getFirst(). This way you won't break the storageObject. Another way would be using toArray().
If you do a "print_r($dbuser);" with your current code, you should even see a warning by extbase.