Created
March 10, 2016 17:40
-
-
Save muskie9/146a2161fbc6ee66f64e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* assume $data['ID'] is an integer | |
* | |
* when the object is queried, it has the correct data. | |
* using both the method shown and $form->saveInto($school); | |
* the write() creates a new object rather than update the queried object | |
* | |
* @param $data | |
* @param $form | |
* @throws ValidationException | |
* @throws null | |
*/ | |
public function doEditSchool($data, $form) | |
{ | |
if($school = School::get()->byID($data['ID'])){ | |
$school->Title = $data['Title']; | |
$school->Active = $data['Active']; | |
$school->write(); | |
} | |
$this->redirect(MemberManagementPage::get()->first()->Link('schools')); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment