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.
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?
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.