Search code examples
phpsymfony-1.4propel

Propel 1.6 Formatter


Is there any way I can set a formatter on models that will convert negative numbers to positive numbers for all numeric fields in the model? I started out by trying to make a propel formatter but I'm not sure what code should go in format and formatOne. I have the following code.

class NegativeFormatter extends PropelFormatter
{
  public function format(PropelPDO $stmt)
  {
    parent::format($stmt);
  }

  public function formatOne(PropelPDO $stmt)
  {
    parent::formatOne($stmt);
  }

  public function isObjectFormatter()
  {
    return true;
  }
}

Solution

  • I ended up just doing it manually for now when doing the calculations.