[英]Quick question about auto-generated code via core data
I have two entities Company and Employees. 我有两个实体公司和雇员。 Company has a 1-to-many relationship with employees. 公司与员工有一对多关系。 An almost exact question was asked here however it doesnt answer my question :(. Like in that question, xcode in Company.m generates 4 almost exactly the same methods. However, the prototypes are not included in Company.h which leads me to believe that this is either 在这里问了一个几乎确切的问题,但是它没有回答我的问题:(。像那个问题一样,Company.m中的xcode生成4个几乎完全相同的方法。但是,原型没有包含在Company.h中,这使我相信这是
Standing by for any clarifications. 等待任何澄清。 Thanks! 谢谢!
Typically I just set the company on the employee when creating the employees. 通常,我在创建员工时只是将公司设置在员工身上。
[newEmployee setValue:company forValue:@"company"];
this will trigger the relationship both ways and add the employee to the companies set of employees. 这将触发双向关系,并将员工添加到公司的员工集中。
or since you've subclassed it. 或因为您已经将其分类。
newEmployee.company = company;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.