#import <Meal+CoreDataClass.h>
Definition at line 17 of file Meal+CoreDataClass.h.
◆ addContainedItem:()
- (void) addContainedItem: |
|
(NSSet< MenuItem * > *) |
values |
|
◆ addContainedItemObject:()
- (void) addContainedItemObject: |
|
(MenuItem *) |
value |
|
◆ deleteMealByRandomkey:context:()
+ (void) deleteMealByRandomkey: |
|
(NSString *) |
deleteKey |
context: |
|
(NSManagedObjectContext *) |
moc |
|
|
| |
Definition at line 156 of file Meal+CoreDataClass.m.
156 :(NSString *)deleteKey context:(NSManagedObjectContext *)moc
158 NSManagedObjectModel *mom = moc.persistentStoreCoordinator.managedObjectModel;
160 NSFetchRequest *mealKeyFetchRequest =
161 [mom fetchRequestFromTemplateWithName:@"MealByRandomkey"
162 substitutionVariables:@{@"randomkey" : deleteKey} ];
163 mealKeyFetchRequest.fetchBatchSize = 10;
165 NSError *error = nil;
166 NSArray *results = [moc executeFetchRequest:mealKeyFetchRequest error:&error];
168 NSLog(
@"ERROR/Meal+CoreData.mealByDay: error.localizedDescription: %@", [error localizedDescription]);
169 }
else if (results) {
171 for (NSManagedObject *mobj in results) {
172 [moc deleteObject:mobj];
174 if (![moc save:&error]) {
175 NSLog(
@"ERROR/Meal.deleteMealsByMonth: %@", [error description]);
179 assert(error || results);
◆ deleteMealsByMonth:context:()
+ (void) deleteMealsByMonth: |
|
(NSDate *) |
nowdate |
context: |
|
(NSManagedObjectContext *) |
moc |
|
|
| |
Definition at line 182 of file Meal+CoreDataClass.m.
182 :(NSDate *)nowdate context:(NSManagedObjectContext *)moc
184 if (nil == nowdate) {
185 NSLog(
@"Meal.deleteMealsByMonth: ERROR: nil nowdate");
188 NSDateComponents *components = [[NSCalendar currentCalendar]
189 components:NSCalendarUnitYear|NSCalendarUnitMonth
191 NSManagedObjectModel *mom = moc.persistentStoreCoordinator.managedObjectModel;
194 NSDate *dayBegin = [[NSCalendar currentCalendar] dateFromComponents:components];
196 NSInteger currentMonth = [components month];
197 NSInteger nextMonth = currentMonth + 1;
198 [components setMonth:nextMonth];
199 NSDate *dayEnd = [[NSCalendar currentCalendar] dateFromComponents:components];
200 NSLog(
@"Meal.mealByMonth: after %@, before %@", [dayBegin description], [dayEnd description]);
202 NSFetchRequest *mealByDateRangeFetchRequest =
203 [mom fetchRequestFromTemplateWithName:@"MealByDate"
204 substitutionVariables:@{@"begin_date" : dayBegin,
205 @"end_date" : dayEnd} ];
206 mealByDateRangeFetchRequest.fetchBatchSize = 10;
208 NSError *error = nil;
209 NSArray *results = [moc executeFetchRequest:mealByDateRangeFetchRequest error:&error];
211 NSLog(
@"ERROR/Meal+CoreData.mealByDay: error.localizedDescription: %@", [error localizedDescription]);
214 for (NSManagedObject *mobj in results) {
215 [moc deleteObject:mobj];
217 if (![moc save:&error]) {
218 NSLog(
@"ERROR/Meal.deleteMealsByMonth: %@", [error description]);
◆ fetchRequest()
+ (NSFetchRequest< Meal * > *) fetchRequest |
|
|
|
◆ findMealsByMonth:context:()
+ (NSArray *) findMealsByMonth: |
|
(NSDate *) |
nowdate |
context: |
|
(NSManagedObjectContext *) |
moc |
|
|
| |
Definition at line 71 of file Meal+CoreDataClass.m.
71 :(NSDate *)nowdate context:(NSManagedObjectContext *)moc
74 NSLog(
@"Meal.mealByDay: ERROR: nil nowdate");
77 NSDateComponents *components = [[NSCalendar currentCalendar]
78 components:NSCalendarUnitYear|NSCalendarUnitMonth
80 NSManagedObjectModel *mom = moc.persistentStoreCoordinator.managedObjectModel;
83 NSDate *dayBegin = [[NSCalendar currentCalendar] dateFromComponents:components];
85 NSInteger currentMonth = [components month];
86 NSInteger nextMonth = currentMonth + 1;
87 [components setMonth:nextMonth];
88 NSDate *dayEnd = [[NSCalendar currentCalendar] dateFromComponents:components];
89 NSLog(
@"Meal.mealByMonth: after %@, before %@", [dayBegin description], [dayEnd description]);
91 NSFetchRequest *mealDateFetchRequest =
92 [mom fetchRequestFromTemplateWithName:@"MealByDate"
93 substitutionVariables:@{@"begin_date" : dayBegin,
94 @"end_date" : dayEnd} ];
95 mealDateFetchRequest.fetchBatchSize = 10;
98 NSArray *results = [moc executeFetchRequest:mealDateFetchRequest error:&error];
100 NSLog(
@"Meal+CoreData.mealByDay: error.localizedDescription: %@", [error localizedDescription]);
◆ findMealsWithDate:context:()
+ (NSArray< Meal * > *) findMealsWithDate: |
|
(NSDate *) |
findDate |
context: |
|
(NSManagedObjectContext *) |
moc |
|
|
| |
Definition at line 30 of file Meal+CoreDataClass.m.
30 :(NSDate *)findDate context:(NSManagedObjectContext *)moc
32 NSArray<Meal *> *result = [
self mealByDay:findDate context:moc];
33 if (0 < [result count]) {
34 NSLog(
@"Meal+CoreData.findMealsWithDate: Found Meals with day date: %lu", (
unsigned long)[result count]);
36 NSLog(
@"Meal+CoreData.findMealsWithDate: No Meal day date: \ndate: %@ \ndate description: %@", findDate, [findDate description]);
◆ findOrCreateMealWithDate:context:()
+ (NSArray< Meal * > *) findOrCreateMealWithDate: |
|
(NSDate *) |
findDate |
context: |
|
(NSManagedObjectContext *) |
moc |
|
|
| |
Definition at line 15 of file Meal+CoreDataClass.m.
15 :(NSDate *)findDate context:(NSManagedObjectContext *)moc
17 NSArray<Meal *> *result = [
self mealByDate:findDate context:moc];
19 if (0 < [result count]) {
20 NSLog(
@"Meal+CoreData.findOrCreate: ERR: Reuse Meals with nowdate?: %lu", (
unsigned long)[result count]);
22 NSLog(
@"Meal+CoreData.findOrCreate: Create new Meal with date: %@", findDate);
23 singleMeal = [NSEntityDescription insertNewObjectForEntityForName:@"Meal" inManagedObjectContext:moc];
24 NSAssert(singleMeal,
@"Meal insert failed");
26 result = [[NSArray alloc] initWithObjects:singleMeal, nil];
◆ mealByDate:context:()
+ (NSArray *) mealByDate: |
|
(NSDate *) |
nowdate |
context: |
|
(NSManagedObjectContext *) |
moc |
|
|
| |
|
implementation |
Definition at line 52 of file Meal+CoreDataClass.m.
52 :(NSDate *)nowdate context:(NSManagedObjectContext *)moc
55 NSLog(
@"ERROR: nil nowdate at Meal.mealByDate");
58 NSManagedObjectModel *mom = moc.persistentStoreCoordinator.managedObjectModel;
59 NSFetchRequest *mealDateFetchRequest =
60 [mom fetchRequestFromTemplateWithName:@"MealByExactDate"
61 substitutionVariables:@{@"orderDate" : nowdate} ];
62 mealDateFetchRequest.fetchBatchSize = 10;
65 NSArray *results = [moc executeFetchRequest:mealDateFetchRequest error:&error];
67 NSLog(
@"Meal+CoreData.mealByDate: error.localizedDescription: %@", [error localizedDescription]);
◆ mealByDay:context:()
+ (NSArray *) mealByDay: |
|
(NSDate *) |
nowdate |
context: |
|
(NSManagedObjectContext *) |
moc |
|
|
| |
|
implementation |
Definition at line 120 of file Meal+CoreDataClass.m.
120 :(NSDate *)nowdate context:(NSManagedObjectContext *)moc
122 if (nil == nowdate) {
123 NSLog(
@"Meal.mealByDay: ERROR: nil nowdate");
126 NSDateComponents *components = [[NSCalendar currentCalendar]
127 components:NSCalendarUnitYear|NSCalendarUnitMonth|NSCalendarUnitDay
129 NSManagedObjectModel *mom = moc.persistentStoreCoordinator.managedObjectModel;
132 NSDate *dayBegin = [[NSCalendar currentCalendar] dateFromComponents:components];
133 NSTimeInterval ti = 86400.0;
134 NSDate *dayEnd = [dayBegin dateByAddingTimeInterval:ti];
135 NSLog(
@"Meal+CoreData.mealByDay: \n dayBegin: %@ \n dayEnd: %@", dayBegin,dayEnd);
142 NSFetchRequest *mealByDateRangeFetchRequest =
143 [mom fetchRequestFromTemplateWithName:@"MealByDate"
144 substitutionVariables:@{@"begin_date" : dayBegin,
145 @"end_date" : dayEnd} ];
146 mealByDateRangeFetchRequest.fetchBatchSize = 10;
148 NSError *error = nil;
149 NSArray *results = [moc executeFetchRequest:mealByDateRangeFetchRequest error:&error];
151 NSLog(
@"Meal+CoreData.mealByDay: error.localizedDescription: %@", [error localizedDescription]);
◆ removeContainedItem:()
- (void) removeContainedItem: |
|
(NSSet< MenuItem * > *) |
values |
|
◆ removeContainedItemObject:()
- (void) removeContainedItemObject: |
|
(MenuItem *) |
value |
|
◆ retrieveAllMealsForGallery:context:()
+ (NSArray *) retrieveAllMealsForGallery: |
|
(NSNumber *) |
mealGallery |
context: |
|
(NSManagedObjectContext *) |
moc |
|
|
| |
Definition at line 105 of file Meal+CoreDataClass.m.
105 :(NSNumber *)mealGallery context:(NSManagedObjectContext *)moc
107 NSManagedObjectModel *mom = moc.persistentStoreCoordinator.managedObjectModel;
108 NSFetchRequest *allMealsFetchRequest =
109 [mom fetchRequestFromTemplateWithName:@"FetchAllMeals" substitutionVariables:@{@"x":mealGallery}];
110 allMealsFetchRequest.fetchBatchSize = 10;
112 NSError *error = nil;
113 NSArray *results = [moc executeFetchRequest:allMealsFetchRequest error:&error];
115 NSLog(
@"Meal+CoreData.mealByDay: error.localizedDescription: %@", [error localizedDescription]);
◆ caption
◆ consumeDate
◆ containedItem
◆ galleryNumber
- (NSNumber*) galleryNumber |
|
readwritenonatomiccopy |
◆ orderDate
◆ photo
◆ randomkey
◆ rating
The documentation for this class was generated from the following files: