Unable to call SPOD manager dynamicly

46 views
Skip to first unread message

Adrian Martinez

unread,
Feb 16, 2013, 3:27:10 PM2/16/13
to haxe...@googlegroups.com
hi guys,

I'm trying to call a SPOD Macro class dynamically in php and then call the search method of the manager, but it gives me this error: Unable to call «search»

Here's my code:


var manager : Manager<Dynamic> = Reflect.field( Type.resolveClass( tableClassPath ), "manager" ); // this works

var data : List<Dynamic> = Reflect.callMethod( manager, "search", [ true ] ); // php throws error: Unable to call «search»

for( row in data )
{
    trace
( row.field + "<br/>" );
}


Could somone tell me how to fix this?

Regards, Adrian

david quertelet

unread,
Feb 16, 2013, 4:12:27 PM2/16/13
to haxe...@googlegroups.com
why don't you try dynamicsearch instead ?
--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
 
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haxelang+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Adrian Martinez

unread,
Feb 16, 2013, 4:25:12 PM2/16/13
to haxe...@googlegroups.com, da...@postite.com

Haha I never knew that was possible!

Thnx man you saved my day! :)


Op zaterdag 16 februari 2013 22:12:27 UTC+1 schreef david quertelet het volgende:

Jason O'Neil

unread,
Feb 16, 2013, 10:25:03 PM2/16/13
to haxe...@googlegroups.com

Yep, "search" is a macro, so doesn't actually exist in your generated PHP code, hence you can't use it via Reflect.

"dynamicSearch" is a normal function, so is available.

If you use search() normally, (that is, not using Reflect), you'll find that it actually gets replaced (I think with dynamicSearch) in your php code. Worth taking a look at sometime :)

Adrian Martinez

unread,
Feb 18, 2013, 6:51:08 AM2/18/13
to haxe...@googlegroups.com
Thnx for the explanation Jason, I understand the Macro element changes the code on compile time.
I will keep that in mind.

Regards, Adrian

Op zondag 17 februari 2013 04:25:03 UTC+1 schreef Jason O'Neil het volgende:
Reply all
Reply to author
Forward
0 new messages