PHPStorm Namespace support not working for Symfony2 projects - php

I'm evaluating PHPStorm right now, and I've really grown fond of it. It's fast, has more or less everything perfectly implemented and the flow flows like a breeze...
The only thing bugging me (and that's a big one) is, that it doesn't seem to get the namespaces for my symfony2 project right.
See, in Netbeans, when I type use Symf[CTRL+SPACE] it show me all the Symfony namespaces, right out of the /vendors folder.
If I do the same in PHPStorm, no namesapces are shown. That means that the whole code copletion doesn't work for the vendor libraries, which is really very, very bad in terms of easy and fast programming.
Now, I'm quite sure that I'm just missing a setting somewhere, but I just can't find it.

The Question is a bit old, but if anyone stumbles across it (like me) and still nothing works, it might be because your vendor folder gets excluded from code inspection.
You have to go to "File -> Settings -> Directories" and set the vendor folder to be a resource root and not be excluded.
More info here: Jetbrains Namespaces

This is not an issue anymore, there is a Symfony plugin that works most of the time now.

Looks like a known issue in PhpStorm.

Related

Dynamically add or remove code module in a laravel project

I have been trying to understand how this concept works. Adding or removing code modules from laravel project. I have seen this feature in many places such as quickadminpanel.com, October CMS etc. These sites are used to create an admin panel quicker, there is an interesting feature that i found in quickadminpanel that is installing module that i need. Basically i want to achieve this but i don't know how to do !! May be someone can help as this feature and concept actually exists.
The author himself replied in a mail. Now the concept is much clear to me. He simply replied this, "It's similar to how Laravel works with stubs - copy-pasting files as templates, replacing the variables in content: youtube.com/watch?v=eWarTZuates&t=1s"

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.

How to generate Tests in tests/ directory in PhpStorm?

PhpStorm has some sort of weird behaviour that is driving me crazy. I've got my project setup to have a source and a test directory. The source directory should be for productive code, while the test directory should contain all the phpunit tests.
In those directories, the folder structure is mirrored - if I have a class \foo\Bar,
then there is
src/foo/Bar.php and test/foo/BarTest.php.
I've marked src/ and test/ as source and test directory in PhpStorm, however, every time I want to create a new test suite for a class, PhpStorm defaults to put the test class into the src/ directory next to the class under test.
It's possible to change that, however it get's more annoying when that same directory in test/ does not exist yet. Instead of creating it, PhpStorm will just reject to create that test suite for me.
Maybe I am misunderstanding the concept behind test management in PhpStorm quite a bit - because it just can't be that bad user experience.
Is there something I am doing wrong, or something that I can configure to make the situation less painful?
You are doing nothing wrong. It just does not work this way -- devs coded it to behave in a way it is right now.
Originally IDE used PHPUnit's ability to generate test classes (back then such functionality was part of actual PHPUnit). Then PHPUnit creator(s) have moved this functionality into separate package (phpunit-skelgen) .. and you had to install it manually/separately. Then devs decided to drop phpunit-skelgen support completely and implemented current implementation (which is also more in line with similar routines in other IDEs built on IDEA platform/technologies supported by those IDEs).
There are quite few tickets about changing such behaviour to the same as you described/desired .. but so far it does not look like it's in their priority list...
https://youtrack.jetbrains.com/issue/WI-2850
https://youtrack.jetbrains.com/issue/WI-24358
https://youtrack.jetbrains.com/issue/WI-21890
Subscribe to those tickets (star/vote/comment) to get notified on progress.
As of release 2016.3 PHPStorm now takes places tests in the specified tests directory, providing exactly what you ask for in your question.

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.

Debug PHP and Control Flow?

I am an autodidact so dont know much about conventional web development however, I have wrote a complete social networking website yet I dont know how to debug. My website has some problems and I need to learn debuggin things around/
First of all I need instructions how to install Xdebug on WAMP (since I use phpDesigner). I tried a lot using tutorials on the web everytime I get a new error. I also tried puting it in the /ext/ directory and activating it from the WAMP PHP Extensions menu. Doesnt Work!
So if anyone odf you out there uses PHPDesigner with Xdebug (not the package that comes along, rather install it on WAMP) please help me and I would really be grateful. BTW PHP version is 5.3.0
Next thing is this is how is the the control flow of my website :-
htaccess -> redirect everything to index.php if file doesn't exist.
index.php ->
include all libraries (__autoload).
initialize classes.
Get the $_SERVER['REQUEST_URI'] to get the $page.
If $page is found
Check if the user is logged in,
if yes then include view/$page.php
or else redirect to login.php page
If page is not found then
redirect to 404.php
Is this control flow good for debugging? because I really cant understand the real MVC concept so I created something like this.
There is a tutorial for installing XDebug for use with phpDesigner here.
MVC is an organizing principle (also called a "design pattern"). It can be helpful keeping logically similar parts of a project together, and encouraging clean interfaces between them, but—especially for low complexity projects—strict MVC modeling isn't always an improvement.
You ask:
Is this control flow good for debugging?
Debugging is to identify flaws in programs. Writing a program to be easy to debug is like intentionally driving a car off the left side of the road so you'll know where to direct an ambulance to find you. Granted—there are small things which can be done to greatly improve debugability. But the point is to architect any control structure so it naturally expresses the algorithm. By doing that, it is far more likely to avoid the need to debug. Anything you can do to write correctly functioning code is justifiable.
Your control flow is clear to me. I wouldn't have any qualms about working on it.
Use xDebug.
Its very easy to install and use.
and you can download xDebug from here http://www.xdebug.org/
step by step tutorial for setup xdebug with WAMP is available at sachithsays.blogspot.com/

Categories