Closed 7elix closed 6 years ago
Hello! I have the same problem in my own extension. There are no problems with php 5.6, but with php 7, I get the warning: Declaration of Gigabonus\Gbfemanager\Controller\EditController::updateAction(Gigabonus\Gbfemanager\Domain\Model\User $user = NULL) should be compatible with In2code\Femanager\Controller\EditController::updateAction(In2code\Femanager\Domain\Model\User $user)
Did you guys check out: https://forge.typo3.org/issues/76290? Any luck with the mentioned fixes?
The Link is not accessible anymore. Any Info?
I saw the comment on stackoverflow, but where must the initializeAction exactly be implemented. In the new Controller or in the original Controller? Can someone post a full example, please.
To follow best practices, override in your own new controller.
<?php
namespace ext\myExt\Controller;
class NewController extends \In2code\Femanager\Controller\NewController
{
/**
* Initialize create action for setting the right custom data type for the user.
*/
public function initializeCreateAction() {
if ($this->arguments->hasArgument('user')) {
// Workaround to avoid php7 warnings of wrong type hint.
/** @var \ext\myExt\Xclass\Extbase\Mvc\Controller\Argument $user */
$user = $this->arguments['user'];
$user->setDataType(\ext\myExt\Domain\Model\User::class);
}
}
// Other custom functions...
}
Can you also provide the Xclass Argument.php, please.
Hope it helps!
<?php
namespace ext\myExt\Xclass\Extbase\Mvc\Controller;
class Argument extends \TYPO3\CMS\Extbase\Mvc\Controller\Argument
{
/**
* Set data type for femanager workaround.
* Workaround to avoid php7 warnings of wrong type hint.
*
* @param $dataType
* @return $this
*/
public function setDataType($dataType) {
$this->dataType = $dataType;
return $this;
}
}
I am getting the same error, please let me know if it worked for anyone? and how?
Yeah, worked for me with the given solution :)
Hi Alex,
there seems to be an issue with php7 + typo3 7.6 + overloading controller / action in my demo setup.
The EXT: femanagerextended follows the Best Practise declaration in https://docs.typo3.org/typo3cms/extensions/femanager/BestPractice/Index.html but
PHP Warning: Declaration of In2code\Femanagerextended\Controller\NewController::createAction(In2code\Femanagerextended\Domain\Model\User $user) should be compatible with In2code\Femanager\Controller\NewController::createAction(In2code\Femanager\Domain\Model\User $user)
Might be based on typoscript registration in tx_extbase.objects or php7 strict_types or ? Any hint?