Where is Joomla's ServiceProviderInterface [migrated] - php

This question was migrated from Stack Overflow because it can be answered on Joomla Stack Exchange.
Migrated 20 days ago.
I am working my way through a Joomla 4 component tutorial. I have setup Visual Studio Code's Intelephense to be able to find Joomla classes using includepath. That seems to be working fine for the first php file in the tutorial, "script.php" (for example, VS Code can find Text::_()).
However, the second php file, "provider.php", defines a class that derives from Joomla\DI\ServiceProviderInterface. Intelephense can't seem to find where that class is defined and, after looking through my local instance of Joomla's source code, neither can I.
Where is Joomla\DI\ServiceProviderInterface defined?
And if such dependencies are not part of the Joomla source code, where does Joomla get them from at runtime?

Joomla's Dependency Injection package is available at https://github.com/joomla-framework/di .
Hopefully this saves someone else the few hours I spent tracking this down.
Likewise, retrieve Psr\Container\ContainerInterface from https://github.com/php-fig/container .

Related

How to configure Eclipse Project for Joomla Component Development

I like to develop a fresh Joomla Component for Joomla 3.x in Eclipse and created therefore a simple PHP project.
The problem I have is now how to setup the correct "include path", so that the basic Joomla PHP classes get found like "JFactory" , "JAccess", "JObject" ...
If I just include a Joomla installation in my include path, this will not work. I assume the paths to the classes are more sophisticated than that.
Any Idea or suggestion how the "include path" for my project should look like?
regards
Mark
It depends a little on what you mean by "found".
If you mean "as I start typing a basic class name every matching basic class gets offered as an option", yes, there is a way to do that.
See the conversation, and solution, on this gitHub page.
I have the stub file referred to and it works in the way I've said above, tho' I'm using NetBeans not Eclipse (but the reference to phpStorm makes me think it should/could work for you too), although I haven't been able to run the build script. I just haven't got the time to single step through it to find out where it stops.

popCurrent called on ModelAsController controller, but it wasn't at the top of the stack - Silverstripe

A website built in Silverstripe 3.0 seems to be logging this error quite often:
"E_USER_WARNING: popCurrent called on ModelAsController controller, but it wasn't at the top of the stack"
The stack trace:
/framework/control/Controller.php (447)
/cms/code/controllers/ModelAsController.php (77)/framework/control/Director.php (296)
/framework/control/Director.php (119)/framework/main.php (126)
Does anyone have an idea what might be causing this?
Is that the full log statement you get? I've got quite a lot of similar statements (still 2.4 but that should be the same issue):
Warning at sapphire/core/control/Controller.php line 454:
popCurrent called on ModelAsController controller,
but it wasn't at the top of the stack
(http://www.foo.com/valid-page/piwik/libs/open-flash-chart/php-ofc-library/ofc_upload_image.php?name=wp.php)
So http://www.foo.com/valid-page really exists and some bot checks if you are running a vulnerable software (Piwik in this case). As long as you aren't using this software and are running the latest version, you should be find.
Most automated attacks I've seen target WordPress, Piwik, etc or some common extension (Timthumb); never something SilverStripe specific because it's not common enough to make it a good target of automated scans.
As mentioned by #micmania1 this issue was resolved by the framework maintainers a month after posting this question.

Problems wit sign me up plugin

Hi i am trying to use Sign me up Plugin for my application. But unable to get it running. There are so many issues and errors.
Plugin i have downloaded is:-
sign_me_up-2.0
But there are so many errors i am getting
Ex:- Declaration of SignMeUpComponent::initialize() should be compatible with Component::initialize(Controller $controller)
I have tried for tutorials and serached for solutions online. But no luck...
Can anyone help me out on how to use this plugin ???
What i reffered :-
http://www.jotlab.com/2011/sign-me-up-a-cakephp-registration-plugin
Thanks in advance
Make sure your version of CakePHP is compatible with the plugin. I understand between version 1.3 and 2, they took advantage of the newer features of PHP which included strongly-typed method parameters. The error you're receiving is that the SignMeUpComponent inherits from the Component class which is in framework core. If the component wants to override the initialize method, it must follow the same method/function signature.
If the plugin is on Git and you feel comfortable in doing so, clone it and update all the components methods, and then put in a pull request so you're changes can be merged in.
Alternatively use an earlier version of CakePHP.

Zend\Module missing when trying to install ZendDeveloperTools module

I am trying to install the ZF2 module called ZendDeveloperTools for use with ZF2 beta4. I have placed the module inside my Module directory and added it to the modules array in config/application.config.php. When I load my app, I get the below error:
Fatal error: Interface 'Zend\Module\Consumer\AutoloaderProvider' not
found in /.../module/ZendDeveloperTools/Module.php on line 29
Looking at Module.php, here is the list of libraries that the module is trying to use:
use Zend\Module\Manager,
Zend\Module\Consumer\AutoloaderProvider,
Zend\EventManager\StaticEventManager;
When I look at the latest version of the ZF2 library which I have installed, I can see that the whole Zend\Module path is missing (Zend\EventManager is there).
Also, I can see what the ZendDeveloperTools module was last updated 4 months ago whereas ZF2 came out about 1 month ago.
Can I use the ZendDeveloperTools module at all (if so what do I need to adapt), or do I need to wait for a refactor of the module matching ZF2 beta 4?
I was the last person to work on ZendDeveloperTools. Zend Framework 2 is still in beta (we're about to release beta5 next week, after which ZF2 will go into RC). ZendDeveloperTools has not been updated since sometime around beta1, maybe beta2. At that time, the only thing it did was very rough and basic execution time profiling using microtime(), and it had a method for prepending some output (the execution time) before the tag, and immediately prior the response was sent to the browser. That was really just a proof of concept for what we really want it to be.
To answer your question, this module is very much out of date, and simply will not work with the most recent beta4 release (nor the current master branch on Github). Way too much has changed, including changed namespaces (Zend\Module is not Zend\ModuleManager) and the entire MVC stack being refactored. The module simply needs to be majorly updated. Luckily, at least one person has started on some updates here, and one of my developers as well as myself will be working with him on his updates to try to get ZendDeveloper tools functional and doing what we have envisioned. I'm also going to reach out to the developer behind the ZFDebug project for ZF1 to see if he's interested in helping.
The idea is this:
By default, ZendDeveloperTools should provide a nice floating toolbar on non-ajax HTTP requests (probably only those with a tag). This will be similar to Symfony2's web debug toolbar or the ZFDebug project for ZF1.
It will be designed with ZF2 modules in mind so that in addition to whatever default debugging tools we provide in the bar, third-party modules can provide their own "plugins" / data providers, to be displayed as additional buttons/menus on the toolbar. For example, one of my developers has started on a profiler module (currently provides DB profiling but will allow setting arbitrary timers as well), which we'd like to eventually have provide data to the ZendDeveleperTools toolbar.
Update Jul 6 2012: I've updated the latest master of ZendDeveloperTools with the great work done by #coss on GitHub. It should now be functional with beta5 which was released just a few minutes ago. :) It looks pretty nice, too!

codeigniter modular seperation problem php mvc

Ok so Im running 1.7.2 and I installed the codeigniter-modular-seperation library (the newest version which is maintained by Phil Sturgeon , as the wiki said to install that version if Im using 1.7 or above)
-- anyways, the documentation is super light, just says put MY_Router and MY_Loader in the libraries folder which Ive done, and everything is working as far as the module urls go, but when I try and make the modules talk to each other as per both of the following articles:
http://codeigniter.com/wiki/Modular_Extensions_-_HMVC/
http://codeigniter.com/wiki/Modular_Extensions_-_HMVC
but I get
Fatal error: Call to undefined method Modules::run() in siteurl on line 4
I also tried loading the module like this
[code]load->module('ratings/ratings'); ?> [/code]
which yields an error Call to undefined method MY_Loader::module()
So ya, anyone have any idea how to fix this? Any help much appreciated.
soooooooo, correct me if Im wrong, but, it appears that the newer version of HMVC (the one you are advised to download if you use 1.7+), does not support cross loading of controllers. I switched to the old version and its working perfect, although I have to say Im not sure I understand the purpose of making it modular, if you aren’t able to cross load from other controllers (unless you are just using the modules to create completely separate unique webpages by using each directory as its own mini codeigniter installation.
I replaced the new with the old version and its working perfect.
Phil, if you read this, do you have any plans to implement cross controller/resource loading in a future version? Because (and I mean no disrespect you know a hell of a ton more about php than me), it seems like the whole power behind the Zend framework is its modularity. The problem I have with Zend is its honestly the most confusing shit I have ever attempted to understand (I have an ecommerce store running on magento), but even though its confusing and frustrating as all hell, its absolutely brilliant because of how extendable it is. I feel like if CI were more modular (without hacking it up all over), it would have 2000x the power as it does now.

Categories