[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fix, GDL2, EORelationship (-validateName:)
From: |
Georg Fleischmann |
Subject: |
Fix, GDL2, EORelationship (-validateName:) |
Date: |
Mon, 28 Apr 2008 17:17:41 +0800 |
Hello,
here is a patch for EORelationship, proposing a fix for awakening of
attributes that have a definition.
When relationships are constructed they are validated against
attributes. That in turn awakens the attributes, being dependent on
relationships that are not there at this time. The definitions will
fail to be set.
Here is the part of the stack of that problematic dependency:
#0 0x002237aa in -[EOEntity(EOEntityPrivateXX) _parsePropertyName:]
at EOEntity.m:3940
#1 0x002223c5 in -[EOEntity(EOEntityPrivateXX)
_parseDescription:isFormat:arguments:] at EOEntity.m:3721
#2 0x0022813a in -[EOAttribute(EOAttributeEditing)
_setDefinitionWithoutFlushingCaches:] at EOAttribute.m:832
#3 0x0022821c in -[EOAttribute(EOAttributeEditing) setDefinition:] at
EOAttribute.m:878
#4 0x002264b9 in -[EOAttribute awakeWithPropertyList:] at
EOAttribute.m:249
#5 0x00214630 in -[EOEntity attributes] at EOEntity.m:839
#6 0x0021cba9 in -[EOEntity(EOEntityPrivate) attributesByName] at
EOEntity.m:2506
#7 0x00214907 in -[EOEntity attributeNamed:] at EOEntity.m:878
#8 0x00214ba9 in -[EOEntity anyAttributeNamed:] at EOEntity.m:903
#9 0x0022ff67 in -[EORelationship(EORelationshipEditing)
validateName:] at EORelationship.m:1181
#10 0x0023034b in -[EORelationship(EORelationshipEditing) setName:]
at EORelationship.m:1245
#11 0x0022b236 in -[EORelationship initWithPropertyList:owner:] at
EORelationship.m:151
#12 0x0022ae1f in +[EORelationship
relationshipWithPropertyList:owner:] at EORelationship.m:89
#13 0x00214ffb in -[EOEntity relationships] at EOEntity.m:964
The attached patch (-c) is fixing the issue by simply not validating
the relationships against attributes.
This seems to be correct behaviour, since the class documentation
doesn't mention a test against attributes, only against relationships
and stored procedures. Quote from the EOAccess docu:
validateName:
"Validates name and returns nil if its a valid name, or an exception
if it isn’t. A name is invalid if it has zero
length; starts with a character other than a letter, a number, or
“@”, “#”, or “_”; or contains a character other
than a letter, a number, “@”, “#”, “_”, or “$”. A name is also
invalid if the receiver’s EOEntity already has
an EORelationship with the same name, or if the model has a stored
procedure that has an argument with
the same name."
Best wishes,
Georg Fleischmann
*** EOAccess/EORelationship.m.old Wed Mar 12 14:30:36 2008
--- EOAccess/EORelationship.m Mon Apr 28 16:27:05 2008
***************
*** 1178,1186 ****
*p]
userInfo: nil];
! if ([[self entity] anyAttributeNamed: name])
exc++;
! else if ([[self entity] anyRelationshipNamed: name])
exc++;
else if ((storedProcedures = [[[self entity] model]
storedProcedures]))
{
--- 1178,1189 ----
*p]
userInfo: nil];
! /* validating with attributes creates the problem, that on
awakening the relationships,
! the attributes are not there yet, and awakening them will
require the relationships.
! The EOAccess class documentation does not mention a test
against attributes! */
! /*if ([[self entity] anyAttributeNamed: name])
exc++;
! else*/ if ([[self entity] anyRelationshipNamed: name])
exc++;
else if ((storedProcedures = [[[self entity] model]
storedProcedures]))
{
- Fix, GDL2, EORelationship (-validateName:),
Georg Fleischmann <=