nsmanagedobject - Core Data Managed Objects Sets -


i trying write simple personal finance app own use , have following issue , wondered if can set me straight.

my data model quite simple, have 'account' managed objects have nsset of 'transaction' managed objects in turn have nsset of 'split' managed objects.

the 'split' object has category , amount transaction can made of multiple categories differing amounts. e.g transaction total £40 made £25 - food , £15 - fuel etc

the 'transaction' managed object can have optional 1 1 relation 'transaction' managed object. when want represent transfer. therefore have 2 'transaction' objects same attributes date etc each belongs different 'account' shows when query list of transactions account.

i have overridden appropriate setters on 'transaction' managed object setdate when called, checks see if has 'transaction' managed object linked , if has, changes date of transaction. way changes made 1 transaction reflected in other account transaction.

still me..? problem nsset of 'split' objects transaction.

lets created new transaction in account a. set date transaction create 'split' object transaction arguments sake has category of food £20. in ui, transaction transfer. prompts me pick account want transfer to, pick account b. in background, new 'transaction' object created, account set account b, copy across date etc original transaction in account want set both 'transaction' objects point same nsset of 'splits'.

that way, if change category or amount in split of 1 of transactions reflected in other? changes simpler attributes handled through setters setdate mentioned before. can both 'transaction' objects point same nsset of splits or manually have synchronise changes both sets when change made?

hope makes sense , received.

your relationship need many:many between transaction , split entities.

if want better create custom methods setting both transfer , splits rather trying override. need write logic how 1 relationship updated based on change objects relationship. once have relationship configured objects @ other end common changes split instances trivial.

it's idea using mogenerator manage custom code separately auto generated code.


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -