Skip to content

Instantly share code, notes, and snippets.

@gai00
Created August 21, 2017 05:10
Show Gist options
  • Select an option

  • Save gai00/67b28168528ae77d63794021a3fdbfbb to your computer and use it in GitHub Desktop.

Select an option

Save gai00/67b28168528ae77d63794021a3fdbfbb to your computer and use it in GitHub Desktop.
Phalcon nested model example
<?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