Managed Hosting



Project Home Blog Forums Wiki Known Issues Contact Project

FlexORM Issue: Association metadata not loaded properly: ReferenceError: Error #1065: Variable XYZ is not defined.

Name: Association metadata not loaded properly: ReferenceError: Error #1065: Variable XYZ is not defined.
ID: 8
Project: FlexORM
Type: Bug
Area: Code
Severity: High
Status: Open
Related URL:
Creator: Dustin
Created: 08/03/11 12:53 AM
Updated: 08/03/11 12:53 AM
Description: I just found a bug when using associations:

I have a DB with two entities:
class A {
   public var bs:IList;

class B {
   public a:A;

Now when I have an empty DB and try to load all As, the EntityIntrospector tries to load A but can't because it doesn't know about B yet (metadata missing).
var As:IList = em.findAll(A);

ReferenceError: Error #1065: Variable B is not defined.
   at global/flash.utils::getDefinitionByName()
   at nz.co.codec.flexorm::EntityIntrospector/getClass()[/nz/co/codec/flexorm/EntityIntrospector.as:1300]
   at nz.co.codec.flexorm::EntityIntrospector/extractOneToManyAssociation()[/nz/co/codec/flexorm/EntityIntrospector.as:624]
   at nz.co.codec.flexorm::EntityIntrospector/loadMetadataForClass()[/nz/co/codec/flexorm/EntityIntrospector.as:319]
   at nz.co.codec.flexorm::EntityIntrospector/loadMetadata()[/nz/co/codec/flexorm/EntityIntrospector.as:101]
   at nz.co.codec.flexorm::EntityManager/getEntity()[/nz/co/codec/flexorm/EntityManager.as:1511]
   at nz.co.codec.flexorm::EntityManager/findAll()[/nz/co/codec/flexorm/EntityManager.as:155]
   at Logic/doSomeALoading()[/Logic.as:52] ### here's the "findAll"

There's a (dirty) workaround for now to use the EntityIntrospector and preload B's metadata before loading the list of As:

Hope someone's still working on this awesome project - if not, I'll have to take a look at it myself (some far time in the future, when my current project is finished).
History: Created by alopix (Dustin) : 08/03/11 12:53 AM

To add a comment to this bug, please login using the link above.