Skip to content

Instantly share code, notes, and snippets.

@clemherreman
Created May 5, 2011 12:04
Show Gist options
  • Save clemherreman/956931 to your computer and use it in GitHub Desktop.
Save clemherreman/956931 to your computer and use it in GitHub Desktop.
How to add business logic on form save
<?php
class DocumentIdentificationForm extends DocumentForm
{
protected function doUpdateObject($values)
{
parent::doUpdateObject($values);
if ($values['author_id'])
$this->getObject()->setStatusId(Doctrine_Core::getTable('Status')->getIdentifiedStatus());
else
$this->getObject()->setStatusId(Doctrine_Core::getTable('Status')->getUnkownStatus());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment