I'v created a ProductModelAdmin, to manage two dataobjects with one-to-many relationship.
After some experimenting, I want to delete (destroy, vanish) the ProductModelAdmin.php file.
I delete it in my code. SS begins to flip and admin won't start up anymore.
We've moved the forum!
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
DataObjectManager Module /
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Sean, Ed, biapar, Willr, Ingo, swaiba
How does one delete a previous created ModelAdmin class?
Once you delete your code you will need to run a site.com/dev/build?flush=1 to remove it from your database and then reload the admin.
Wish it was that simple.
Doesn't work. Each time it blocks, I copy mysite data, remove the installation
and reinstall (just 2 mins of work , no big deal, but yet impractical). So I can work along.
I have a screenshot of the error. How to upload this ?
I experiment alot with SS , and in particular the management of the DataObject.
I hope to use SS within 2 months for my employer (big governemental department)
My future clients (the managers of several subdepartments) will use the backend
to manipulate the data in the datamodel. But I want this backend to be as
simple and evident as possible. Matching my complex datamodel
on the possiblilities of the DOM and ComplexTableField in order to get
the max result is not that evident. It implies a lot of experiment.
I have a screenshot of the error. How to upload this ?
It looks like uploads have been turned off in this forum, upload the image via skitch, twitpic or one of the other photosharing sites if you wish. Or just copy the content of the error message.
I had the same issue. I was doing lots of experimentation with a Test Model admin which I wanted to delete since I've built the real thing. All the other temporary classes have been removed just fine but after removing the Test Model class, but dev/build was producing errors (see below).
Adding the ?flush=1 to the end of the build URL seemed to resolve it for me, although we've been told we don't need to do that anymore! (Before I tried that, my temporary fix was to comment out everything inside the model admin class and make in an empty class that does nothing.)
Warning: include_once(/.../mysite/code/TestModelAdmin.php) [function.include-once]: failed to open stream: No such file or directory in /.../sapphire/core/Core.php on line 213
Warning: include_once() [function.include]: Failed opening '/home/.../mysite/code/TestModelAdmin.php' for inclusion (include_path='/.../sapphire:/.../sapphire/parsers:/.../sapphire/thirdparty:.:/usr/local/lib/php/PEAR:/usr/lib/php:/usr/local/lib/php') in /.../sapphire/core/Core.php on line 213
Fatal error: Uncaught exception 'ReflectionException' with message 'Class TestModelAdmin does not exist' in /.../cms/code/CMSMenu.php:285 Stack trace: #0 /.../cms/code/CMSMenu.php(285): ReflectionClass->__construct('TestModelAdmin') #1 /.../cms/code/CMSMenu.php(41): CMSMenu::get_cms_classes() #2 /…/cms/_config.php(17): CMSMenu::add_director_rules() #3 /tmp/…/manifest-main(8548): require_once('/home/.../...') #4 /.../sapphire/core/ManifestBuilder.php(74): require_once('/tmp/silverstri...') #5 /.../sapphire/core/Core.php(232): ManifestBuilder::include_manifest() #6 /.../sapphire/main.php(61): require_once('/home/.../...') #7 {main} thrown in /.../cms/code/CMSMenu.php on line 285
@Corry:
Adding the ?flush=1 to the end of the build URL seemed to resolve it for me, although we've been told we don't need to do that anymore!
Just wondering where it says that you shouldn't do that anymore? In some cases you'll get away with it, like when you only add some database fields to existing code, but I think that flushing the cache is definitely the way to go after adding/removing codefiles... Luckily you can always do it afterwards :-)
OK, thanks for that.
Have just seen it written in lots of places that 'dev/build' only is needed for later versions of SilverStripe, so didn't realise there are times when flush should still be used.