Skip to content

Instantly share code, notes, and snippets.

@iammerrick
Created February 11, 2011 04:36
Show Gist options
  • Save iammerrick/821926 to your computer and use it in GitHub Desktop.
Save iammerrick/821926 to your computer and use it in GitHub Desktop.
<?php
public function create_user_and_landlord($values)
{
$this->_db->begin();
$errors = NULL;
try
{
$this->values($_POST, $this->form_fields());
$this->save();
$this->_db->commit();
}
catch (ORM_Validate_Exception $e)
{
$this->_db->rollback();
$errors = $e;
}
try
{
$landlord = ORM::factory('landlord');
$landlord->values($_POST, $landlord->form_fields());
$landlord->save();
}
catch (Database_Exception $e)
{
$errors->merge($e);
$this->_db->rollback();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment