ufront-orm sys.db.Manager not initialized

47 views
Skip to first unread message

Mathieu Emilian

unread,
Jun 13, 2015, 9:48:17 AM6/13/15
to haxe...@googlegroups.com

I have this basic ufront Object :

package share.model;

import ufront.db.Object;
import sys.db.Types;


@:table("me_coord")
class Coord extends Object{

   
public var latitude : SFloat;
   public var longitude : SFloat;
   public var altitude : SFloat;

   public function new(x : Float, y : Float, z : Float) {
     
super();
      this.latitude = x;
      this.longitude = y;
      this.altitude = z;
   }
}

When I try to create a new Coord like this :

var c = new Coord(1,2,3);
c
.save();

In php it throw an error : Trying to get property of non-object (errno: 8) in /srv/http/lib/sys/db/Manager.class.php at line #45
however if I set up a neko task that does the same, it works just fine...

It seems that the Coord manager isn't properly initialized because php_Boot::$skip_constructor is true when the manager is created, which is weird because the only way for it to be true is if it was instantiated via the Type.createEmptyInstance() method, and it isn't :

share_model_Coord::$manager = new sys_db_Manager(_hx_qtype("share.model.Coord"));

I'm using haxe 3.2 with git versions of ufront and ufront-orm

I struggle with this for hours, any help appreciated :)

Marcelo de Moraes Serpa

unread,
Jun 13, 2015, 3:24:45 PM6/13/15
to haxe...@googlegroups.com
Just a side note, please try not to paste directly from your editor or make sure to send it as text-only (or properly format it before sending). The first block of code and the last are way too hard to see because of the colorsL

--
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.
For more options, visit https://groups.google.com/d/optout.

Mathieu Emilian

unread,
Jun 13, 2015, 4:54:27 PM6/13/15
to haxe...@googlegroups.com

Sorry I didn't paid attention, here is the post without colors :

I have this basic ufront-orm Object :


package share.model;

import ufront.db.Object;
import sys.db.Types;

@:table("me_coord")
class Coord extends Object{

   
public var latitude : SFloat;
   
public var longitude : SFloat;
   
public var altitude : SFloat;

   
public function new(x : Float, y : Float, z : Float) {
     
super();
     
this.latitude = x;
     
this.longitude = y;
     
this.altitude = z;
   
}
}


When I try to create a new Coord like this :


var c = new Coord(1,2,3);
c
.save();



In php it throw an error : Trying to get property of non-object (errno: 8) in /srv/http/lib/sys/db/Manager.class.php at line #45

however if I set up a neko task that does the same, it works just fine...


It seems that the Coord Manager isn't properly initialized because php_Boot::$skip_constructor is true when the manager is created, which is weird because the only way for it to be true is if it was instantiated via the Type.createEmptyInstance() method, but it isn't.

This is the php generated by ufront (or spod ?) that instantiate the manager :

Mathieu Emilian

unread,
Jun 14, 2015, 9:46:43 AM6/14/15
to haxe...@googlegroups.com
I finally found why this is happening.

I was saving the Coord in an UFApi call that takes another Coord in parameter :

public function sendReport(type : ReportType, pos : Coord);

So when the server receives this request by remoting, the pos parameter is unserialized and instanciated with the Type.createEmptyInstance method which set the php.Boot.skipConstructor to true. Then, as it is the first time the Coord class is acceded, the static Manager is also instanciated while skipConstructor is still true, causing it to be not initialized.
Not sure if this is intended behavior or a bug, I'll find another way to do what I need.
Reply all
Reply to author
Forward
0 new messages