在大学的考试中有一个问题; 是否可以在SQL WHERE子句中使用聚合函数.
我一直认为这是不可能的,我也找不到任何可能的例子.但我的答案被标记为假,现在我想知道在哪些情况下可以使用聚合函数WHERE.此外,如果不可能,那么获得指向描述的规范的链接会很好.
我是cocoa/objective-c的新手,而且我正在使用我的对象的版本.我有以下代码:
gastroCategoryList = [[NSMutableArray alloc] init];
for (NSDictionary *gastrocategory in gastrocategories) {
NSString *oid = [gastrocategory objectForKey:@"id"];
GastroCategory *gc = [[GastroCategory alloc] initWithId:[oid intValue] name:[gastrocategory objectForKey:@"name"]];
[gastroCategoryList addObject:gc];
}
Run Code Online (Sandbox Code Playgroud)
分析仪告诉我,for中定义的"gastrocategory"是潜在的内存泄漏.但我不确定我是否可以在for循环结束时释放它?
同样在以下代码中:
- (NSArray *)eventsForStage:(int)stageId {
NSMutableArray *result = [[NSMutableArray alloc] init];
for (Event *e in eventList) {
if ([e stageId] == stageId) {
[result addObject:e];
}
}
return result;
}
Run Code Online (Sandbox Code Playgroud)
分析仪告诉我,我的"结果"是潜在的泄漏.但是我应该在哪里发布这个?
当我应该在@property使用分配,复制,保留等时,是否还有一个简单的规则来记忆?
另一个问题:
- (IBAction)showHungryView:(id)sender {
GastroCategoriesView *gastroCategoriesView = [[GastroCategoriesView alloc] initWithNibName:@"GastroCategoriesView" bundle:nil];
[gastroCategoriesView setDataManager:dataManager];
UIView *currentView = [self view]; …Run Code Online (Sandbox Code Playgroud) 我正在使用带有ACL的Sonata-Admin软件包,但我必须以编程方式创建一些对象.但我无法弄清楚如何正确更新已创建实体的ACL表.所以我总是要执行
php app/console sonata:admin:generate-object-acl
这当然不是一个永久的解决方案.
我尝试过这样描述:http://symfony.com/doc/current/cookbook/security/acl.html#creating-an-acl-and-adding-an-ace所以我在我的实体中实现了DomainObjectInterface,添加了getObjectIdentifier方法.
但是现在我在执行时遇到Symfony\Component\Security\Acl\Exception\AclAlreadyExistsException异常:
php app/console sonata:admin:generate-object-acl
所以我猜这不是使用sonata-admin时这样做的正确方法.但我在文档中找不到任何内容.