haXe Forum > extends PHP class, and ORM question

  • Hi all,
    two questions this evening ;)
    - first, is it possible to extends a PHP class in an Haxe class ? I've read the "Wrapping External PHP Libraries" page, but I don't know how I can use this in my case.

    -next, and that's why I need to extends PHP class, I'm currently work on my own (and small !) framework for PHP project in Haxe, and I'm trying to use Doctrine, for my database requests, inside of my Haxe code. Am I the first who try to do this ? Is there any better solution ?

    Thanks !

  • yes, you need to wrap your external class as described http://haxe.org/doc/php/extern_libraries

    so basically you create a "wrapper" file called Doctrine.hx containing at the very least

    extern class Doctrine
    {
        static function __init__()
        {
            untyped __call__("require_once", "Doctrine.php");
        }
        // ... more function / var definitions that are defined in Doctrine.php
    }

    then you can extend this class as normal. If you actually want to call functions and variables from the parent class then you need to fill the extern class with some more code containing the definition that you need.

    For other database library you can also look at SPOD http://haxe.org/doc/neko/spod?lang=en

  • Thanks for your answer Niel!
    ...I'm currently looking about SPOD, and I think I will use it instead of Doctrine, it seems to be easier in Haxe.

    Thanks again !

< Prev | Page 1 / 1 | Next >