Announcement of Flextrine 2

Flextrine Bar

I am most proud to announce the development and upcoming release of Flextrine – an open source project I am developing that simplifies and encapsulates ORM with Flex and PHP.  Very simply, Flextrine maps AS3 objects to database tables giving you the ability to save and load objects to a remote database without having to worry about any server coding.  It supports all usual associations, local caching, indexing, Flex databinding and many other things, as well as having a nifty web interface for generating schemas and stubs.

Flextrine is planned for release on 1st September to match the release of its parent project Doctrine 2.

Check out http://code.google.com/p/flextrine2/ for more details.

15 comments

  1. Hi, Dave

    your program looks very promising and interesting. lol
    Recently i’m trying to test Doctrine2 with flex/PHP (some small projects). but get very frustrated with the new ArrayCollection in Doctrine2. Googled a lot without solution. finally i got here, which is very close to the background.
    It looks u are very skillful with those Doctrine 2 and ArrayCollection stuff.
    Don’t know if you mind i drop some questions here. :p
    (I downloaded your Flextrine2, tried to get a clue for my issues. not yet, though)

  2. Hi Tim,

    Flextrine uses custom deserialization and serialization to deal with ArrayCollection (and other types); it was definitely one of the challenges 🙂 Why don’t you just use Flextrine for your projects – you’ll get all the advantages of Flex/Doctrine2 integration without having to worry about these kinds of details!

    Dave

  3. Hi Dave,

    You are absolutely right!!! the Flextrine works pretty awesome. In fact, i intended to have more controls of back-end service and learn some knowledge of Doctrine. (consumes a lot of times, though). So i studied again your source code, pretty neat and cool!!! so right now i could focus more on the flex side programming.

    thanks a lot again for this great project.

    Tim

  4. Hi Dave,

    here’s another question.
    personally i prefer to design relational Database first then work on ORM. the reverse way did cause me a lot of problems and bad habit for RMDB design.
    so do you have any plan to let Flextrine automatically generate Entities from existing Database schema? (as far as I know, Doctrine does have one feature like this)
    Sorry, get lazy after using Flextrine 😀

    Tim

  5. As it stands right now Flextrine only supports entity definition via the annotations driver (this is PHP classes with the database mapping in docblock comments). However, as you probably know Doctrine also allows the mapping to be defined in YAML and XML, and the ‘reverse engineering’ tool you are talking about will probably only work with YAML or XML (http://www.doctrine-project.org/projects/orm/2.0/docs/reference/tools/en#reverse-engineering). However, it would be a pretty simple task to extend Flextrine and Flextrine Manager to support these alternative mapping drivers and if there is enough interest this is certainly something that will make it into a future version of Flextrine!

    Dave

  6. it actually works for annotation like this

    $ php doctrine orm:convert-mapping –from-database annotation /path/to/entities

    I use this to generate roughly entities then do some modification again.

    Here is actually another question.
    I read ur post “AMFPHP, PHP 5.3 and namespaces” and this post, a little bit confused. and i want change the path of client-side package path to be different from server php package.
    e.g. client-side: path.to.ASClass
    server-side: PHPClass (directly put under entities folder)
    how could i do that?
    1. set in $_explicitType = “/path/to/ASClass”;
    or
    2. $_explicitType = “PHPClass”; but change those ASClass code generated from Flextrine manager?

    thx
    Tim

  7. in fact, my experience with ZendAMF is that, in case:
    PHP:
    $server->setClassMap(“ASClass”,”PHPClass”);
    AS:
    package path.to
    class ASClass{
    [RemoteClass(alias=”Class”)]
    }

    ASClass alias(client) or classmap(server) is only for object register purpose, and must be same, other things don’t matter. In client side, that’s why I could have “alias (ASClass)” different from “package name(path.to.ASClass)”. and it works.
    in my guess, since Wade created both Zend AMF and AMFPHP with similar concept, the first one might be the solution. what’s ur idea in Flextrine project?

    thx
    Tim

  8. Hey Tim,

    I believe that as long as the $_explicitType and the [RemoteClass(alias)] match up with the PHP class, that’s all that matters for the purposes of class mapping. However, the .php file itself has to be in a folder structure (within entities) that matches the package structure.

    So if $_explicitType=”org.davekeen.vo.MyClass”, MyClass.php needs to be located in entities/org/davekeen/vo/MyClass.php, and you can name the AS class whatever you fancy.

  9. Hi Dave,

    thx for quick response, i did try the one suggested. but it doesn’t work.
    e.g.
    $_explicitType = “vo/MyClass”;
    [RemoteClass(alias=”vo/MyClass”)]

    so the server side: entities/vo/MyClass.php
    client side: model.vos.ASClass.as
    (am i correct for this configuration?)

    when i debug the session between client/server, the error shows in server-side:
    DoctrineCommonClassLoader::loadClass(): Failed opening required ‘pathxampplitehtdocsproject/entitiesmodelvosASClass.php

    it seems the Flextrine tried to search based on client side package name (model.vos.ASClass.php) instead of what defined in [RemoteClass]

    Tim

  10. That’s very strange. I know its probably a stupid question but are you 100% sure that you have the namespace and the class name correct PHP side? As far as I can think of there shouldn’t really be any way that Flextrine can know about the AS class name except through the [RemoteClass] tag. Also, be sure you are defining [RemoteClass] in ASClass.as, not ASClassEntityBase.as.

    If it is still not working log it as an issue at http://www.flextrine.com and I’ll have a closed look when I get some time 🙂

    Dave

  11. I’ve checked again. they matched.
    There is another thing i tested about is:
    whenever i changed the path(folder name) of the ASClass.as, the server-side error reflex the changes.
    e.g. if model/vos/ASClass.as folder structure (packagename) change to model/myvos/ASClass.as, then the error change to
    “Failed opening required ‘pathxampplitehtdocsproject/entitiesmodelmyvosASClass.php”

    I’ll test again tomorrow. then log the issue.

    thx
    tim

  12. Hello,

    Is it possible to have flextrine working on php 5.2 instead of 5.3 ? because if I upgrade my serveur, lots of websites will fall down 🙁

    Thank’s for your answer 😉

  13. Unfortunately not. Flextrine uses Doctrine 2 which makes heavy use of PHP namespaces (amongst other things) which were only introduced in PHP 5.3.

  14. Hello,
    You can do this

    var contactGroup:ContactGroup = new ContactGroup();
    contactGroup.name = “New group”;
    em.callRemoteMethod(“setContactGroup”, contactGroup).add….

    And as I receive it in PHP?

    Thank’s for your answer

Leave a Reply

Your email address will not be published. Required fields are marked *