Configuring third party service in my CompilerPass - php

I'm using Symfony 2.7 and I want to configure some service by adding configurator to it. I follow instructions on http://symfony.com/doc/current/components/dependency_injection/configurators.html, but I want to add my configurator to that service in my CompilerPass.
I wrote the following code:
$container->getDefinition('exercise_html_purifier.config.default')
->setConfigurator([
$container->getDefinition('application.exercise_html_purifier.config_configurator')->getClass(),
'configure'
]);
where application.exercise_html_purifier.config_configurator is id of my configurator service. This code works as expected, but of course it is also triggers php's warning:
DEPRECATED - Non-static method Application\Service\ExerciseHTMLPurifier\Configurator\ConfigConfigurator::configure() should not be called statically, assuming $this from incompatible context
because the configure method is not static in my case. I can't figure out, how to tell symfony to set non-static configurator callback.
I tried to set it like this:
$container->getDefinition('exercise_html_purifier.config.default')
->setConfigurator([
$container->get('application.exercise_html_purifier.config_configurator'),
'configure'
]);
but got this error:
ContextErrorException in XmlDumper.php line 201:
Warning: DOMElement::setAttribute() expects parameter 2 to be string, object given
I even tried to use the following syntax:
$container->getDefinition('exercise_html_purifier.config.default')
->setConfigurator([
'#application.exercise_html_purifier.config_configurator',
'configure'
]);
but also got error
FatalErrorException in appDevDebugProjectContainer.php line 2992:
Parse Error: syntax error, unexpected '#', expecting identifier (T_STRING)
What I'm doing wrong?
Thanks.

OK, I've read the source of \Symfony\Component\DependencyInjection\Dumper\XmlDumper::addService() and found that one of the solutions is to pass Definition instead of instance:
$container->getDefinition('exercise_html_purifier.config.default')
->setConfigurator([
$container->getDefinition('application.exercise_html_purifier.config_configurator'),
'configure'
]);

Related

Laravel 5.4 Argument 3 passed to Collective must implement interface Illuminate\Contracts\View\Factory, string given

I've installed the Kris Form Builder on Laravel 5.4 from:
https://github.com/kristijanhusak/laravel-form-builder/
when I want to render the form in the blade I got this error:
Argument 3 passed to Collective\Html\FormBuilder::__construct() must implement interface Illuminate\Contracts\View\Factory, string given, called in /Applications/vendor/kris/laravel-form-builder/src/Kris/LaravelFormBuilder/FormBuilderServiceProvider.php on line 86 and defined (View: /Applications/resources/views/entity-items.blade.php)
Update:
I've solved the problem myself!
in according to this tutorial : http://kristijanhusak.github.io/laravel-form-builder/overview/installation.html
you should also add http://kristijanhusak.github.io/laravel-form-builder/overview/installation.html
and 'Former' => Former\Facades\Former::class,
in config\app.php

Smfony2: Getting an error when trying to use translatble behavior extension

I am trying to use translatable behavior in my project, I followed the doc word by word to how configure and use this behavior , but I am getting this error:
CRITICAL - Uncaught PHP Exception ReflectionException: "Property locale does not exist" at C:\wamp\www\Symfony\vendor\gedmo\doctrine-extensions\lib\Gedmo\Translatable\TranslatableListener.php line 296
Can anyone help please?
Thanks in advance :)
Edit:
This is the line 296:
$reflectionProperty = $class->getProperty(self::$configurations[$this->name][$meta->name]['locale']);
In my case the required $locale field was defined in an abstract super class of the entity - which is basically fine, however it must not be private but at most protected.

Joomla Registration MySQL Error

Anytime someone goes to register (We use RSForms for this) we get this error
Warning
Registration failed: SQL=INSERT INTO (,,,,,,,,,,,,,,) VALUES (105,0,0,0,0,0,0,1,0,0,1,0,1,1,0)
Then I turned error reporting to developer and got these when I tried to sign up.
Notice: Use of undefined constant DS - assumed 'DS' in /home/content/03/7103303/html/plugins/system/jcktypography/jcktypography.php on line 15
Notice: Use of undefined constant DS - assumed 'DS' in /home/content/03/7103303/html/plugins/system/jcktypography/jcktypography.php on line 15
Strict Standards: Non-static method JApplicationSite::getMenu() should not be called statically, assuming $this from incompatible context in /home/content/03/7103303/html/templates/hot_designnow/index.php on line 40
Strict Standards: Non-static method JApplicationCms::getMenu() should not be called statically, assuming $this from incompatible context in /home/content/03/7103303/html/libraries/cms/application/site.php on line 250
Strict Standards: Only variables should be assigned by reference in /home/content/03/7103303/html/templates/hot_designnow/index.php on line 40
Also when turning on debug system and language I get these in red(We are using the default register now)
**Parsing errors in language files**
JROOT/administrator/language/en-GB/en-GB.com_rsform.ini : error(s) in line(s) 546
also when looking at Extention Manager -> Manage there is a new plugin/module
Code:
COM_INSTALLER_TYPE_
I hope this helps, Thank you for taking the time to try to help
From what I can see you have 3 different problems here:
Your first error message
Warning
Registration failed: SQL=INSERT INTO (,,,,,,,,,,,,,,) VALUES (105,0,0,0,0,0,0,1,0,0,1,0,1,1,0)
Indicates that you are using a custom sql script in rsforms, which is somehow broken. Maybe you have upgraded from 1.5 and this custom sql (and possibly related php) needs to be rewritten?
Your second problem:
The "Notice lines indicate you have a plugin, which is not full Joomla 3.0 compatible, I would deinstall and get an upgraded version if possible.
The "Strict standards" lines are probably Joomla code not up to sratch with strict standards, but also your template has not been upgraded to adhere to these
Your third problem:
"Parsing errors indicated that either a language file of RSForm is missing or has not been properly upgraded. I would reinstall/upgrade RsForm.
In regards to the main angle of your question, you need to look at the custom RSForm SQL script and post that here.

Zend_forward error Cannot redeclare class Bootstrap

When I call (in my AdminController) the _forward function, i get this error
Fatal error: Cannot redeclare class Admin_Boot in /www/application/modules/admin/Boot.php on line 33
Actually, my website's structure is:
#Application/
|--Bootstrap.php
|--#modules
|----#admin
|------Boot.php
|------#controllers
|------#view
|----#default
|------Boot.php
|------#controllers
|------#view
(I have not placed everything, but the most important is here)
So, if I call the admin module, I'm gonna call Bootstrap.php, and after, Admin_Boot.php ...
All it's ok, it's just the _forward function who cause me some trouble ...
I need help
If you are using Zend_Loader::loadFile(), think to set the third argument to TRUE;
Zend_Loader::loadFile("Boot.php", $dirs, true);

Can't make SimplePie Laravel bundle to work

I'm trying to use SimplePie for Laravel to parse RSS feeds. I have followed the instructions and all, but can't seem to make it work.
This is my View. I echoed the rss
<?php $result = rssparser::parse();
echo $result;?>
And this error appears:
Non-static method SimplePie_Misc::fix_protocol() should not be called
statically, assuming $this from incompatible context
C:\wamp\www\ctnpepo\bundles\rssparser\libraries\simplepie\SimplePie.php
on line 834
Is there any way to fix this?
This is only a warning internally in SimplePie, and you can safely ignore it.

Categories