Reply to thread

XF\Api\Result\EntityResult::castToFinalValue's calls XF\Mvc\Entity\AbstractCollection::toWebhookResults with completely the wrong arguments.


[CODE]TypeError: XF\Mvc\Entity\AbstractCollection::toWebhookResults(): Argument #1 ($options) must be of type array, int given, called in /var/www/src/XF/Api/Result/EntityResult.php on line 226 in src/XF/Mvc/Entity/AbstractCollection.php at line 72


    XF\Mvc\Entity\AbstractCollection->toWebhookResults() in src/XF/Api/Result/EntityResult.php at line 226

    XF\Api\Result\EntityResult->castToFinalValue() in src/XF/Api/Result/EntityResult.php at line 174

    XF\Api\Result\EntityResult->render() in src/XF/Repository/WebhookRepository.php at line 113

    XF\Repository\WebhookRepository->queueWebhook() in src/XF/Behavior/Webhook.php at line 38

    XF\Behavior\Webhook->postSave() in src/XF/Mvc/Entity/Entity.php at line 1327

    XF\Mvc\Entity\Entity->save() in src/XF/Service/Post/EditorService.php at line 194

    XF\Service\Post\EditorService->_save() in src/XF/Service/ValidateAndSavableTrait.php at line 42

    XF\Service\Post\EditorService->save() in src/XF/Pub/Controller/PostController.php at line 175

    XF\Pub\Controller\PostController->actionEdit() in src/XF/Mvc/Dispatcher.php at line 362

    XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 265

    XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 121

    XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 63

    XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2813

    XF\App->run() in src/XF.php at line 802

    XF::runApp() in index.php at line 23

[/CODE]




[CODE="php"]protected function castToFinalValue($value, $verbosity = Entity::VERBOSITY_NORMAL, array $options = [])

{

...

    else if ($value instanceof AbstractCollection)

    {

        if ($this->getResultType() === self::TYPE_API)

        {

...

        }

        else

        {

            $value = $value->toWebhookResults($verbosity, $options);

        }

    }

...

public function toWebhookResults(array $options = [], $maintainKeys = false): EntityResults[/CODE]


This should be $value->toWebhookResults($options); AbstractCollection::toWebhookResults should probably accept the `$verbosity argument too


Back
Top Bottom