Inherits from NSManagedObject
Conforms to RKObjectMappable
Declared in RKManagedObject.h
RKManagedObject.m

Tasks

Other Methods

  • + managedObjectContext

    The Core Data managed object context from the RKObjectManager’s objectStore that is managing this model

  • + entity
    The NSEntityDescription for the Subclass 
    defaults to the subclass className, may be overridden
    
  • + fetchRequest
    Returns an initialized NSFetchRequest for the entity, with no predicate
    
  • + objectsWithFetchRequest:

    Fetches all objects from the persistent store identified by the fetchRequest

  • + objectsWithFetchRequests:

    Fetches all objects from the persistent store via a set of fetch requests and returns all results in a single array.

  • + objectWithFetchRequest:

    Fetches the first object identified by the fetch request. A limit of one will be applied to the fetch request before dispatching.

  • + objectsWithPredicate:

    Fetches all objects from the persistent store by constructing a fetch request and applying the predicate supplied. A short-cut for doing filtered searches on the objects of this class under management.

  • + objectWithPredicate:

    Fetches the first object matching a predicate from the persistent store. A fetch request will be constructed for you and a fetch limit of 1 will be applied.

  • + allObjects

    Fetches all managed objects of this class from the persistent store as an array

  • + count:

    Returns a count of all managed objects of this class in the persistent store. On error, will populate the error argument

  • + count:DEPRECATED_ATTRIBUTE:

    Returns a count of all managed objects of this class in the persistent store. Deprecated use the error form above

  • + object
    Creates a new managed object and inserts it into the managedObjectContext.
    
  • + primaryKeyProperty

    The name of an object mapped property existing on this class representing the unique primary key. Must be implemented by the subclass for the mapper to be able to uniquely identify objects.

  • + primaryKeyElement

    The name of the primary key in the server-side data payload. This defaults to the key in the element to property mappings corresponding to the primaryKeyProperty value.

  • + objectWithPrimaryKeyValue:

    Returns the instance of this class where the primary key value is value or nil when not found. This is the preferred way to retrieve a single unique object.

  • + relationshipToPrimaryKeyPropertyMappings

    Must return a dictionary mapping Core Data relationships for the managed object to their corresponding primary key properties on the managed object. Must return an empty dictionary if there are no relationships to be mapped.

  • – primaryKeyValue

    Returns the value of the primary key property for this object

  • – isNew

    Returns YES when an object has not been saved to the managed object context yet

Other Methods

Other Methods

Other Methods

Other Methods

  • – propertiesForSerialization

    Return a dictionary of values to be serialized for submission to a remote resource. The router will encode these parameters into a serialization format (form encoded, JSON, etc). This is required to use putObject: and postObject: for updating and creating remote object representations.

Other Methods

  • – relationshipsForSerialization

    Return a dictionary of relationships to be serialized for submission to a remote resource. The router will encode these parameters into a serialization format (form encoded, JSON, etc). This is required to use putObject: and postObject: for updating and creating remote object representations.

Class Methods

allObjects

Fetches all managed objects of this class from the persistent store as an array

+ (NSArray *)allObjects

Declared In

RKManagedObject.h

count:

Returns a count of all managed objects of this class in the persistent store. On error, will populate the error argument

+ (NSUInteger)count:(NSError **)error

Declared In

RKManagedObject.h

count:DEPRECATED_ATTRIBUTE:

Returns a count of all managed objects of this class in the persistent store. Deprecated use the error form above

+ (NSUInteger)count DEPRECATED_ATTRIBUTE

Discussion

@deprecated

Declared In

RKManagedObject.h

elementToPropertyMappings

Must return a dictionary containing mapping from JSON element names to property accessors

+ (NSDictionary *)elementToPropertyMappings

Declared In

RKObjectMappable.h

elementToRelationshipMappings

Must return a dictionary mapping JSON element names to related object accessors. Must return an empty dictionary if there are no related objects.

+ (NSDictionary *)elementToRelationshipMappings

Discussion

When assigning a collection of related objects, use key-value coding to traverse the collection and access the descendent objects. For example, given a Project object associated with a user and a collection of tasks:

[NSDictionary dictionaryWithObject:@“user” forKey:@“user”]; Will map from an element named ‘user’ to the user property on the model instance.

[NSDictionary dictionaryWithObject:@“tasks” forKey:@“tasks.task”]; Will map each ‘task’ element nested under a containing element named ‘tasks’ and assign the collection to the tasks property on the target object. The assigned collection is assumed to be an NSSet.

Declared In

RKObjectMappable.h

entity

The NSEntityDescription for the Subclass 
defaults to the subclass className, may be overridden
+ (NSEntityDescription *)entity

Declared In

RKManagedObject.h

fetchRequest

Returns an initialized NSFetchRequest for the entity, with no predicate
+ (NSFetchRequest *)fetchRequest

Declared In

RKManagedObject.h

managedObjectContext

The Core Data managed object context from the RKObjectManager’s objectStore that is managing this model

+ (NSManagedObjectContext *)managedObjectContext

Declared In

RKManagedObject.h

object

Creates a new managed object and inserts it into the managedObjectContext.
+ (id)object

Declared In

RKManagedObject.h

objectWithFetchRequest:

Fetches the first object identified by the fetch request. A limit of one will be applied to the fetch request before dispatching.

+ (id)objectWithFetchRequest:(NSFetchRequest *)fetchRequest

Declared In

RKManagedObject.h

objectWithPredicate:

Fetches the first object matching a predicate from the persistent store. A fetch request will be constructed for you and a fetch limit of 1 will be applied.

+ (id)objectWithPredicate:(NSPredicate *)predicate

Declared In

RKManagedObject.h

objectWithPrimaryKeyValue:

Returns the instance of this class where the primary key value is value or nil when not found. This is the preferred way to retrieve a single unique object.

+ (id)objectWithPrimaryKeyValue:(id)value

Declared In

RKManagedObject.h

objectsWithFetchRequest:

Fetches all objects from the persistent store identified by the fetchRequest

+ (NSArray *)objectsWithFetchRequest:(NSFetchRequest *)fetchRequest

Declared In

RKManagedObject.h

objectsWithFetchRequests:

Fetches all objects from the persistent store via a set of fetch requests and returns all results in a single array.

+ (NSArray *)objectsWithFetchRequests:(NSArray *)fetchRequests

Declared In

RKManagedObject.h

objectsWithPredicate:

Fetches all objects from the persistent store by constructing a fetch request and applying the predicate supplied. A short-cut for doing filtered searches on the objects of this class under management.

+ (NSArray *)objectsWithPredicate:(NSPredicate *)predicate

Declared In

RKManagedObject.h

primaryKeyElement

The name of the primary key in the server-side data payload. This defaults to the key in the element to property mappings corresponding to the primaryKeyProperty value.

+ (NSString *)primaryKeyElement

Declared In

RKManagedObject.h

primaryKeyProperty

The name of an object mapped property existing on this class representing the unique primary key. Must be implemented by the subclass for the mapper to be able to uniquely identify objects.

+ (NSString *)primaryKeyProperty

Declared In

RKManagedObject.h

relationshipToPrimaryKeyPropertyMappings

Must return a dictionary mapping Core Data relationships for the managed object to their corresponding primary key properties on the managed object. Must return an empty dictionary if there are no relationships to be mapped.

+ (NSDictionary *)relationshipToPrimaryKeyPropertyMappings

Discussion

For example, given a Project object associated with a user, where the user is specified by a userId property on the managed object:

[NSDictionary dictionaryWithObject:@“userId” forKey:@“user”]; Will hydrate the ‘user’ association on the managed object with the object in the local object graph having the primary key specified in the managed object’s userId property.

In effect, this approach allows foreign key relationships between managed objects to be automatically maintained from the server to the underlying Core Data object graph.

Declared In

RKManagedObject.h

relationshipsToSerialize

Must return an array containing names of relationship properties to serialize

+ (NSArray *)relationshipsToSerialize

Declared In

RKObjectMappable.h

Instance Methods

isNew

Returns YES when an object has not been saved to the managed object context yet

- (BOOL)isNew

Declared In

RKManagedObject.h

primaryKeyValue

Returns the value of the primary key property for this object

- (id)primaryKeyValue

Declared In

RKManagedObject.h

propertiesForSerialization

Return a dictionary of values to be serialized for submission to a remote resource. The router will encode these parameters into a serialization format (form encoded, JSON, etc). This is required to use putObject: and postObject: for updating and creating remote object representations.

- (NSDictionary *)propertiesForSerialization

Declared In

RKObjectMappable.h

relationshipsForSerialization

Return a dictionary of relationships to be serialized for submission to a remote resource. The router will encode these parameters into a serialization format (form encoded, JSON, etc). This is required to use putObject: and postObject: for updating and creating remote object representations.

- (NSDictionary *)relationshipsForSerialization

Declared In

RKObjectMappable.h