Well, I did say should.
I can't see why they would define 'Body' as required since it is already in the schema. This code definitely smells.
No matter, you should be able to modify the validation object before saving the discussion. I actually tested this:
public function discussionModel_beforeSaveDiscussion_handler($sender) { $sender->Validation->UnapplyRule('Body', 'Required'); } public function Structure() { $Structure = Gdn::Structure(); $Structure->Table('Discussion') ->Column('Body', 'text', TRUE, 'fulltext') ->Set(); $Structure->Table('Comment') ->Column('Body', 'text', TRUE, 'fulltext') ->Set(); } public function Setup() { $this->Structure(); }
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
@hgtonight and @R_J,
Thanks! It works! (I tried @hgtonight's last code)
Comments
Well, I did say should.
I can't see why they would define 'Body' as required since it is already in the schema. This code definitely smells.
No matter, you should be able to modify the validation object before saving the discussion. I actually tested this:
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
@hgtonight and @R_J,
Thanks! It works! (I tried @hgtonight's last code)