3460 Posts in 1064 Topics by 739 members
|Go to End|
17 March 2011 at 7:50am
Hoping someone can help
I am using ModelAdmin to manage custom DataObjects. I have used a script to directly populate the tables (add additional) with necessary data ( as I have large volume of data to be fed into the site ).
All seems ok when I review the tables, however when I use the ModelAdmin interface to list them it only lists the original items ( added via cms interface ) and not what I have added direclty.
17 March 2011 at 10:45am
Have you run the dev/build (as in, go to the url yoursite/dev/build)? After you make changes to the underlying code, dev/build will update DB tables.
Going the other way (from new date to updating views), be sure to flush cache (e.g yoursite/?flush=1)
Also, if you have uploaded any files directly, you will need to go to the Files and Images section of the CMS and click the "Look for new files" button to let SS know about your new files.
17 March 2011 at 11:47am Last edited: 17 March 2011 8:00pm
thanks for your feedback. yes I have cleared the cache using flush, done the rebuild and also cleared the silverstripe cache folder completely.
Whats interesting is that if I add an item via the CMS interface after data import via script, then Add button generates an errors. However when I revisit the full list, it shows an entry from what I had imported via script.
To clarify that a bit furtehr, if I had 5 items before script import and the import added 3 items, then it will only show the original 5 items. When I add the 6th item via cms, it shows the first item from the imported data insstead...
Is it possible, SS might be keeping the last used incremental value somewhere which is updated when adding via CMS?
17 March 2011 at 10:46pm Last edited: 17 March 2011 10:49pm
I have solved my problem. The issue was with the way my unique ID was being created. To elaborate a bit more for anyone else attempting to do the same.
My goal was to pull data from an existing SS site for specific DataObjects only. These DO also had has_many relations. Since the db I was migrating to already contains data ( and potentially duplicate ids if attempted to migrate as is ), I had to generate the Ids myself.
Both my main Object and its has_many objects is extended of a custom DO to use common methods. What was key for me is in understanding that SS kept uniqu id at the custom DO level.
I chose to use custom script as the schema was the same and my attempt at exploring the use of CsvBulkLoader with has_many came up futile.
18 March 2011 at 2:36am
Thanks for posting your solution!
|Go to Top|