how to fix Botman error with conversation? - symfony

BotMan Version: 2.6
PHP Version: 8.1
Symfony Version : 5.4
Cache Driver: Symfony Cache
i'm using botman for telegram bot. everything is ok with botman just the conversation is not working
The question is asked, but when I answer, I see such an error.
An exception has been thrown during the rendering of a template ("Warning: is_file(): Unable to find the wrapper "closure" - did you forget to enable it when you configured PHP?").
Can someone help?
Tried to install php 8.2. Similarly
DriverManager::loadDriver(TelegramDriver::class);
$adapter = new FilesystemAdapter();
$botman = BotManFactory::create($this->config, new SymfonyCache($adapter));

Related

assert error in symfony/translations when dumping translations

I have recently updated my project from symfony 6.1 to symfony 6.2 and I'm experiencing issue while dumping translations
commend that I use:
bin/console translation:extract pl --force --format=yaml
results in:
exception trace points to
vendor/nikic/php-parser/lib/PhpParser/Node/Expr/CallLike.php:36
I've already updated all packages, especially symfont/translation to version 6.2.*
For now, only downgrading symfony back to 6.1 solves this for me.
This issue has been fixed in symfony 6.2.2. You can update your project and try again.
It has been resolved in my projects.
composer update "symfony/*"

Cannot install symfony with option --webapp

I try to install symfony v5.
Following the documentation, (https://symfony.com/doc/5.4/setup.html#creating-symfony-applications) i have the error "Incorrect usage: flag provided but not defined: --webapp".
Same error with symfony cli and composer.
How can i resolve this problem ? No help in the documentation... Each new version of symfony becomes more complicated. :-(
Thank you for your help.
Here's my configuration:
php: v7.3
symfony (CLI): v4.24.1
composer: v1.10.15
Maybe try to upgrade Your symfony version. For my symfony version (5.3.13) it works correctly

Symfony Messenger 4.3 - Consuming messages from doctrine transport fails (exception thrown)

Symfony version: 4.3.2
PHP: 7.2.20
I am trying to use the messenger component with the doctrine transport asynchronously. I have installed the messenger via composer require messenger with the help of Symfony Flex.
I have activated the doctrine transport by MESSENGER_TRANSPORT_DSN=doctrine://default in the .env.local.
In the messenger config the transport is configured as well:
framework:
messenger:
transports:
async: '%env(MESSENGER_TRANSPORT_DSN)%'
routing:
'App\Message\SomeNotification': async
When dispatching the message in the controller with $this->dispatchMessage(new SomeNotification('some content')); everything is fine. The table messenger_messages of the doctrine transport gets created automatically and the message is saved in the table correctly.
When trying to consume the message with ./bin/console messenger:consume async I'm getting the following error:
[Symfony\Component\Debug\Exception\FatalThrowableError]
Argument 2 passed to Symfony\Component\Messenger\Worker::__construct() must implement interface Symfony\Component\Messenger\MessageBusInterface, string given, called in ..../vendor/symfony/messenger/
Command/ConsumeMessagesCommand.php on line 190
So the $routableBus in the Symfony\Component\Messenger\Command\ConsumeMessagesCommand is empty which leads to the crash when instantiating the Worker.
The answer for the question is to update symfony/framework-bundle to 4.3.2 as well. Due to a bug in the composer.json of the messenger component version 4.3.2 of the framework bundle is not enforced. This leads to the default misconfiguration when using an older version of the symfony/framework-bundle in combination with 4.3.2 of the messenger component. This explained my error since I had 4.3.0 of the framework bundle installed.
More about it can be found on the GitHub issue tracker right here:
https://github.com/symfony/symfony/issues/32738
After updating the symfony/framework-bundle everything works as expected.

Keep getting error on Symfony after installing JsFormValidatorBundle

After installing JsFormValidatorBundle, I keep getting the error bellow when I try to open my page on localhost. I installed the bundle following the instruction on https://github.com/formapro/JsFormValidatorBundle, composer installed the bundle successfully. My Symfony version is the 2.8. And my composer is updated.
InvalidArgumentException in FormPass.php line 59:
Tagged form type extension must have the extended type configured using the extended_type/extended-type attribute, none was configured for the "fp_js_form_validator.extension" service.
I tried to add this information at app/config/services.yml, but did not work:
fp_js_form_validator.extension:
class: Fp\JsFormValidatorBundle\Form\Extension\FormExtension
tags:
- { name: form.type_extension, alias='form', extended_type: Symfony\Component\Form\Extension\Core\Type\FileType }
Thanks

Error in ResponseExeption while populating FOSElasticaBundle/Symfony2

I am trying to get FOSElasticaBundle to work.
ElasticSearch Instance is running on localhost:9200 and responding.
I followed each step in the docs https://github.com/FriendsOfSymfony/FOSElasticaBundle/blob/master/Resources/doc/setup.md
but at the last step, I get this error in my console:
c:\xampp\htdocs\my\folder>php app/console fos:elastica:populate
Resetting app
Fatal error: Wrong parameters for Exception([string $exception [, long $code [,
Exception $previous = NULL]]]) in C:\xampp\htdocs\my\folder\vendor\rufli
n\elastica\lib\Elastica\Exception\ResponseException.php on line 34
[Symfony\Component\Debug\Exception\FatalErrorException]
Error: Wrong parameters for Exception([string $exception [, long $code [, Exception $previous = NULL]]])
fos:elastica:populate [--index[="..."]] [--type[="..."]] [--no-reset] [--offset="..."] [--sleep="..."] [--batch-size="..."] [--ignore-errors] [--no-overwrite-format]
It seems like there are 3 parameters mandatory for "__construct"-Function, but there are only 2 of them. I've simply tried to add "NULL"-parameter to get it work, but then another function throws an error.
public function __construct(Request $request, Response $response)
{
$this->_request = $request;
$this->_response = $response;
parent::__construct($response->getError());
}
Is this a common problem? How do I solve it?
This is because the ruflin/Elastica package is not compatible with elasticsearch 2.0 yet.
https://github.com/ruflin/Elastica/issues/946
An alternative for now (until ruflin/Elastica is 2.0 upgraded), is to use the latest 1.x version.
You can download it here: https://www.elastic.co/downloads/past-releases/elasticsearch-1-7-3
ES 1.7.3 + FosElasticaBundle (which uses ruflin/Elastica) works fine with Elasticsearch 1.7.3 version.
The reason for this issue is, that with elasticsearch 2.0 the structure of the response error changed (more details here: https://github.com/ruflin/Elastica/issues/946). Instead of a string before it is now a nested array. Elastica is currently not yet fully compatible with elasticsearch 2.0. As soon as a new release of Elastica is out which is compatible with Elasticsearch 2.0 it will probably mean that also foselastica bundle will have to be updated as these changes will break backward compatibility. Be also aware, that this is not the only backward compatibility breaking change.
To follow the progress of the upgrade, follow this issue: https://github.com/ruflin/Elastica/issues/946

Resources