Created
August 21, 2017 05:10
-
-
Save gai00/67b28168528ae77d63794021a3fdbfbb to your computer and use it in GitHub Desktop.
Phalcon nested model example
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 | |
| class A extend ModelBase { | |
| public function beforeSave() { | |
| $this->ar = (is_array($this->ar))? $this->ar: []; | |
| foreach($this->ar as &$ar) { | |
| if(!$ar->save()) { | |
| $error = $ar->getMessages(); | |
| // 錯誤處理 | |
| break; | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment