Lukas W.
Well-known member
I'm trying to utilize the toggle ControllerPlugin to toggle a custom database column, but whatever I do, the request doesn't go through and throws an error instead.
The call itself isn't anything fancy:
This is the error that is thrown:
And this is the template snippet responsible for toggling:
If someone can see the mistake/error, I'd be glad to hear it.
The call itself isn't anything fancy:
PHP:
public function actionMemberToggle() {
/** @var \XF\ControllerPlugin\Toggle $plugin */
$plugin = $this->plugin('XF:Toggle');
$return = $plugin->actionToggle('RPGS:RPGmembership', 'can_create_characters');
return $return;
}
This is the error that is thrown:
Code:
ErrorException: array_key_exists() expects parameter 2 to be array, integer given in src\XF\Mvc\Entity\Finder.php at line 431
XF::handlePhpError()
array_key_exists() in src\XF\Mvc\Entity\Finder.php at line 431
XF\Mvc\Entity\Finder->whereIds() in src\XF\Mvc\Entity\Manager.php at line 188
XF\Mvc\Entity\Manager->findByIds() in src\XF\ControllerPlugin\Toggle.php at line 29
XF\ControllerPlugin\Toggle->toggle() in src\XF\ControllerPlugin\Toggle.php at line 11
XF\ControllerPlugin\Toggle->actionToggle() in src\addons\RPGS\Pub\Controller\RPG.php at line 36
RPGS\Pub\Controller\RPG->actionMemberToggle() in src\XF\Mvc\Dispatcher.php at line 249
XF\Mvc\Dispatcher->dispatchClass() in src\XF\Mvc\Dispatcher.php at line 89
XF\Mvc\Dispatcher->dispatchLoop() in src\XF\Mvc\Dispatcher.php at line 41
XF\Mvc\Dispatcher->run() in src\XF\App.php at line 1787
XF\App->run() in src\XF.php at line 326
XF::runApp() in index.php at line 13
And this is the template snippet responsible for toggling:
HTML:
<xf:toggle name="can_create_characters[{$member.user_id}]" selected="$member.can_create_characters"
class="dataList-cell--separated" submit="true"
tooltip="{{ phrase('rpgs_can_create_character') }}" />
If someone can see the mistake/error, I'd be glad to hear it.