NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
object-mapping (something I never ever saw :) )


Joined: 14 Mar 2007
Posts: 4
Location: Szeged, Hungary
Reply with quote
Hi!

I have a new feature for You to make me... Wink

I have problems with the autocomplete feature: it is not working for dinamically created objects. I know: the IDE won't understand the working-structure of my program, but if I could make it know...
For example:
I have a loadModule method and by calling that with a module name it includes the PHP-file of the module class and make a new object from it. This is what the IDE won't guess ever. But if I could map the $dblayer variable as class dblayer, than it could show the dblayer class's properties and methods to autocomplete what I typed so far.

I think it would be a huge help for those, who use a certain variable with a certain object type and load them from the code depending on the parameters/situation.
Also: this would be a step forward to PHP5, because PHP5 have an __autoload() function which is going to be called every case that the script would like to make a new object from a class that does not exists and so with this feature the automatic loading is more easily can be done, not like in php4... )

I hope I was clear enough Smile
View user's profileFind all posts by teeceeSend private messageICQ Number
Site Admin

Joined: 13 Jul 2003
Posts: 8342
Reply with quote
why not to just add /** @var dblayer */ before first usage of $dblayer?
For further info, please read TypeHints: http://forum.nusphere.com/tip-type-hints-t1563.html

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 14 Mar 2007
Posts: 4
Location: Szeged, Hungary
Reply with quote
dmitri wrote:
why not to just add /** @var dblayer */ before first usage of $dblayer?
For further info, please read TypeHints: http://forum.nusphere.com/tip-type-hints-t1563.html


That's a good hint, thank you. But please note that in this case it cannot solve my problem.

My objects are included and construct on the fly, I don't know when I use them. And the biggest problem: I have an index.php that has 1 include() and after that when initializing it dinamically loads any needed files. And because of this method I if I'm editing the mod_guestbook/classes/guestbook.php file, inside that I have no include or require on anything, because it is not needed. So I have to do the typehinting for all my PHP files...

Or maybe I must have misunderstood something or blind not to catch up Your idea...

Thanks!
View user's profileFind all posts by teeceeSend private messageICQ Number
Site Admin

Joined: 13 Jul 2003
Posts: 8342
Reply with quote
with default settings, PhpED does not care if you have just one include, none or many. What makes sense for Code Insight is list of all classes available in the project. So if you type /** @var classname */, Codeinsight will scan the class list until it finds classname. It does not matter if corrsponding script is included at all.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 07 Mar 2007
Posts: 44
Location: Lithuania
Reply with quote
Oh, btw, dmitri,

as you mentioned, phpEd scans project tree for all php files, to find apropriate class for object, etc. But, I have situation, where in the same project but diferrent deep levels or dramaticaly different directories, there are some files with the same class name defined, but whole diferrent code inside. "Why?" you'd say, lets take example, that the same project has admin and client sides, so every side needs for my case diferrent class'es, as phpEd goes trought my project filelist only first class is defined, and clientside classes are left out of sign.

How could I solve this problem without renaming class names?

Bye Smile
View user's profileFind all posts by thunder-ltuSend private messageVisit poster's website
Guru master

Joined: 05 Jul 2004
Posts: 659
Location: Belgium
Reply with quote
The dual versions is a problem I have here as well. Both for functions and for classes. Just wanted to mention it Wink
View user's profileFind all posts by BlizzSend private messageVisit poster's website
Site Admin

Joined: 13 Jul 2003
Posts: 8342
Reply with quote
well, you have "admin" and "user" area. If they contain similar classes that have the same names, why don't you work with them through two different projects in one workspace?

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 07 Mar 2007
Posts: 44
Location: Lithuania
Reply with quote
You see, dmitri, it's possible, of couse, but a bit annoying Smile. Because, logically it's the same project, not two different Wink.

In my opinion this is optional feauture, but the good one Wink.

Bye
View user's profileFind all posts by thunder-ltuSend private messageVisit poster's website
Site Admin

Joined: 13 Jul 2003
Posts: 8342
Reply with quote
if it is the same project, why does its class hierarchy have clashes (name conflicts)?

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 07 Mar 2007
Posts: 44
Location: Lithuania
Reply with quote
Imagine situation:

admin site (/admin directory) has libraries (classes) in it, where template, session handler and other classes sits, class names 'template', 'session', 'page' etc.
client side (/client directory) has the same class names, but whole diferrent logic inside, why should I rename class names for every x-side...

The point in this is - admin and client side +- has almost the same logic, but libraries part for both sides for my situation has to have same method, class names, but different logic inside with several unique methods etc..

So there comes phpEd class name overrides, that are very annoying.

Bye
View user's profileFind all posts by thunder-ltuSend private messageVisit poster's website
Site Admin

Joined: 13 Jul 2003
Posts: 8342
Reply with quote
After all, you have two libraries and two areas (admin + user) where those two libraries are used, I see no connection in between the two. Why not to develop them as two projects? Say you have class named SessionHandler in both libraries. How any tool on the Earth would guess what libriry is the source of it until it have your code executed? Please note: executing code is not an option for the Code insight.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
object-mapping (something I never ever saw :) )
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic