Hi,

I have a couple of `CBLModel` subclasses in a to-one relationship: 
`TFLayoutItem -> TFField`

In order to get a field from the current layoutItem, I simply reference it 
like this: self.layoutItem.field

What I'm finding is that when I reference field, it seems like it can't be 
found in the database for some reason and creates a new one. But I know it 
exists in the database. It seems to eventually find it, but then I'm left 
with these new empty objects that eventually get deallocated. They're not 
saved to the database, but they still get created.

Maybe I've setup my relationship incorrectly?

On my TFLayoutItem class, I declared my field property as follows:

@property (nonatomic, strong) TFField *field;

and declared it dynamic:

@dynamic field;

I've also registered `TFField` with the modelFactory:

[factory registerClass:[TFField class] forDocumentType: @"TFField"];

Here's the stack trace of what happens when I reference my `field` property 
of my `TFLayoutItem` object.

#0    -[CBLModel initWithDocument:orDatabase:] at CBLModel.m:51
#1 +[CBLModel modelForDocument:] at CBLModel.m:86
#2 -[CBLModel modelWithDocID:forProperty:ofClass:] at CBLModel.m:543
#3 -[CBLModel(Properties) getModelProperty:] at CBLModel+Properties.m:120
#4 +[CBLModel(Properties) impForGetterOfProperty:ofClass:] at 
CBLModel+Properties.m:254
#5 -[TextFieldLayoutItem drawContentsInView:isSelected:] at 
TextFieldLayoutItem.m:75

My line of code at #5 is this:

self.fieldValue = [self.formEntry valueForField:self.layoutItem.field];

The layoutItem object is already loaded in. I was just referencing the 
`field` object and it's supposed to fault it in when referenced.

So I'm wondering if I'm missing something obvious?

Thanks,

Brendan

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/8af4b319-ccd0-43c9-baf5-a16ef7153b64%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to