(TBD: This section has to be rewritten - for the moment being it consists mostly of a copy-paste of messages exchanged on the mailing-list)
Suppose you have the following model:
Address <<-toAddresses---toEmployee-> Employee ^ / \ T | +--------------+ | | Executive SalesClerk
(See the full model description in section 2.1.2)
address.toEmployee()
will automatically retrieve the right object
(being an instance of one of those three classes). Here again, no particular
action is needed, the framework handles it for you.
StoreEmployees
:
>>> from StoreEmployees import Address >>> from Modeling.EditingContext import EditingContext as EC >>> ec = EC() >>> qualifier='toAddresses.zipCode like "4*"' >>> ec.fetch('Employee', qualifier) [] >>> # Now fetch against the inheritance tree below 'Employee' ... all_objects=ec.fetch('Employee', qualifier, isDeep=1) >>> [(o.entityName(), o.getFirstName(),o.getLastName()) ... for o in all_objects] [('SalesClerk', 'John Jr.', 'Cleese'), ('SalesClerk', 'Jeanne', 'Cleese'), ('Executive', 'John', 'Cleese')]
As you can see, specifying isDeep=1
when fetching allows you to
fetch against the whole inheritance tree for a given entity (here,
Employee
).
Comments are welcome: Sebastien Bigaret / Modeling Home Page