Skip to content

php support #1

@sebpatu

Description

@sebpatu

Hi,
Please make those changes to make it work on php target:
1- in Admin.hx and AdminStyle.hx files:
add

if neko

import neko.Web;
import neko.Lib;

elseif php

import php.Web;
import php.Lib;

end

and replace all occurences of neko.Web by Web in Admin.hx and AdminStyle.hx files.
do the same for neko.Lib replaced by Lib.

2- In Admin.hx in the function createInstance:
remove the three php specific lines:
#if php
untyped c.__init_object();
#end
at least for haxe 3.

3- In Admin.hx in the function static function log(msg:String):
surround the line Web.logMessage by #if neko #end.
I did not found any alternative for php target. I don't think its mandatory.

4- In Admin.hx in the function inputField:
surround the case part case DNekoSerialized:
with #if neko #end
I did not found any alternative for php target. I don't think its needed.

5- In AdminStyle.hx:
Rename the function goto to gotoURL (goto is reserved keyword in php)
and in function choiceField
for line: out('gotoURL',{ name : name });
also rename goto to gotoURL

and in Admin.hx replace all occurence of style.goto by style.gotoURL

6- In Admin.hx and DBAdmin.hx, in handler function:
Move the Manager.cnx.rollback(); part after the Lib.prints to avoid that Rollback throw exception before the errors are displaid.

7- In Admin.hx in crawl function:
surround the "if( haxe.rtti.Meta.getType(v).rtti == null ) continue;" part with #if neko #end
It seems to work fine without it. But im not totally sure if it is important or not.
If i keep it in php i have this error:
Undefined property: _hx_class::$meta (errno: 8) in ...localhost\dbAdminTool\lib\haxe\rtti\Meta.class.php at line #6
Maybe it should guarded to not call for every found class? Mabe its a compiler bug for php target?

I have same issue in DBAdmin.hx
i had to disable the two rtti use in addTable.
But good news is that we don't need it to hide Object class from Admin, because your CompileTime.getAllClasses(Object) will not return it, as Object is ufront Object here, and the Object class extends the haxe Spod Object class. so the @notable mechanism is not necessary.

8- In Admin.hx in public function index( ?errorMsg ):
replace lines:
for( r in rq )
allTables.add(rq.getResult(0))

by
for( r in rq )
{
var fieldName = Reflect.fields(r)[0];
allTables.add(Reflect.field(r,fieldName));
}
It should be same behavior for all targets. But previous code was not working well on php target and returned null values.

Thanks
Seb

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions