* EOAccess/EOEntity.m (-awakeWithPropertyList:): Setup the

connection to the parent entity.
        (-encodeIntoPropertyList:): Encode the parent entity name.
        (-init): Initialize the _subEntities ivar.
        (-addSubEntity:): Pass correct argument.
        * EOAccess/EOModel.m (-encodeTableOfContentsIntoPropertyList:):
        encode the parent entity name.
        (-_addEntityWithPropertyList): Call -awakeWithPropertyList:



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@23740 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Matt Rice 2006-10-03 15:19:33 +00:00
parent a7f90ca359
commit fa9b96612d
3 changed files with 33 additions and 2 deletions

View file

@ -1,3 +1,14 @@
2006-10-03 Matt Rice <ratmice@yahoo.com>
* EOAccess/EOEntity.m (-awakeWithPropertyList:): Setup the connection
to the parent entity.
(-encodeIntoPropertyList:): Encode the parent entity name.
(-init): Initialize the _subEntities ivar.
(-addSubEntity:): Pass correct argument.
* EOAccess/EOModel.m (-encodeTableOfContentsIntoPropertyList:):
encode the parent entity name.
(-_addEntityWithPropertyList): Call -awakeWithPropertyList:
2006-10-02 Matt Rice <ratmice@yahoo.com>
* EOAccess/EOEntityPriv.h: Rename setParentEntity: to

View file

@ -76,6 +76,7 @@ RCS_ID("$Id$")
#include <EOControl/EODebug.h>
#include <EOAccess/EOModel.h>
#include <EOAccess/EOModelGroup.h>
#include <EOAccess/EOEntity.h>
#include <EOAccess/EOAttribute.h>
#include <EOAccess/EORelationship.h>
@ -356,7 +357,16 @@ NSString *EONextPrimaryKeyProcedureOperation = @"EONextPrimaryKeyProcedureOperat
- (void)awakeWithPropertyList: (NSDictionary *)propertyList
{
//do nothing?
NSString *tmp;
if ((tmp = [propertyList objectForKey:@"parent"]))
{
EOEntity *parent = [_model entityNamed:tmp];
/* TODO tests for parents spanning models. */
if (!parent)
parent = [[_model modelGroup] entityNamed:tmp];
[parent addSubEntity:self];
}
}
- (void)encodeIntoPropertyList: (NSMutableDictionary *)propertyList
@ -388,6 +398,9 @@ NSString *EONextPrimaryKeyProcedureOperation = @"EONextPrimaryKeyProcedureOperat
if (_flags.cachesObjects)
[propertyList setObject: [NSNumber numberWithBool: _flags.cachesObjects]
forKey: @"cachesObjects"];
if (_parent)
[propertyList setObject: [_parent name]
forKey: @"parent"];
if ((count = [_attributes count]))
{
@ -499,6 +512,7 @@ NSString *EONextPrimaryKeyProcedureOperation = @"EONextPrimaryKeyProcedureOperat
if ((self = [super init]))
{
_attributes = [GCMutableArray new];
_subEntities = [GCMutableArray new];
[self setCreateMutableObjects: YES];
}
@ -2336,7 +2350,7 @@ createInstanceWithEditingContext:globalID:zone:
{
[self willChange];
[_subEntities addObject: child];
[[child parentEntity] removeSubEntity:self];
[[child parentEntity] removeSubEntity:child];
[child _setParentEntity: self];
}

View file

@ -885,6 +885,7 @@ NSString *EOEntityLoadedNotification = @"EOEntityLoadedNotification";
{
NSMutableDictionary *entityPList;
EOEntity *entity;
EOEntity *parent;
entity = [_entities objectAtIndex: i];
entityPList = [NSMutableDictionary dictionaryWithCapacity: 2];
@ -892,6 +893,10 @@ NSString *EOEntityLoadedNotification = @"EOEntityLoadedNotification";
[entityPList setObject: [entity className] forKey: @"className"];
[entityPList setObject: [entity name] forKey: @"name"];
parent = [entity parentEntity];
if (parent)
[entityPList setObject: [parent name] forKey: @"parent"];
[entitiesArray addObject: entityPList];
}
@ -1336,6 +1341,7 @@ NSString *EOEntityLoadedNotification = @"EOEntityLoadedNotification";
//may be: self _registerChild:(id)param0
// forParent:entity...
}
[entity awakeWithPropertyList:propertyList];
[[NSNotificationCenter defaultCenter]
postNotificationName: @"EOEntityLoadedNotification"