Commits

Tuukka Norri committed b0a213e

Small changes
- Fixed a bug which caused a fetch to be performed when not intended if the database context was already connected when set using -setDatabaseContext:.
- Overrode some methods inherited from NSObjectController. The methods have to do with Core Data and we don't need most of them.

Comments (0)

Files changed (1)

BaseTenAppKit/Sources/BXSynchronizedArrayController.m

  * \ingroup baseten_appkit
  */
 @implementation BXSynchronizedArrayController
-
 + (void) initialize
 {
 	static BOOL tooLate = NO;
 			[self setEntityDescription: nil];
 			[[databaseContext notificationCenter] addObserver: self selector: @selector (endConnecting:) name: kBXConnectionSuccessfulNotification object: databaseContext];
 			
-			if ([databaseContext isConnected] && [self tableName])
+			if (mFetchesAutomatically && (mTableName || mEntityDescription) && [databaseContext isConnected])
 				[self fetch: nil];
 		}
     }
     if (nil != error)
         [self BXHandleError: error];
 }
+
+- (NSString *) entityName
+{
+	return nil;
+}
+
+- (void) setEntityName: (NSString *) name
+{
+}
+
+- (NSManagedObjectContext *) managedObjectContext
+{
+	return nil;
+}
+
+- (void) setManagedObjectContext: (NSManagedObjectContext*) ctx
+{
+}
+
+- (BOOL) usesLazyFetching
+{
+	return NO;
+}
+
+- (void) setUsesLazyFetching: (BOOL) enabled
+{
+}
+
+- (Class) objectClass
+{
+	return [mEntityDescription databaseObjectClass];
+}
+
+- (void) setObjectClass: (Class) cls
+{
+	if (! mEntityDescription)
+		[self prepareEntity];
+	
+	[mEntityDescription setDatabaseObjectClass: cls];
+}
+//@}
 @end
-//@}
 
 
 @implementation BXSynchronizedArrayController (NSCoding)
-
 - (void) encodeWithCoder: (NSCoder *) encoder
 {
 	//Don't change fetchesOnConnect in strings, or users' nibs stop working.
     }
     return self;
 }
-
 @end