Exception.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace Gedmo\Timestampable;
  3. /**
  4. * The exception list for Timestampable behavior
  5. *
  6. * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  7. * @package Gedmo.Timestampable
  8. * @subpackage Exception
  9. * @link http://www.gediminasm.org
  10. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  11. */
  12. class Exception extends \Exception
  13. {
  14. static public function notValidFieldType($field, $class)
  15. {
  16. return new self("Timestampable: field - [{$field}] type is not valid date or time field in class - {$class}");
  17. }
  18. static public function triggerTypeInvalid($field, $class)
  19. {
  20. return new self("Timestampable: field - [{$field}] trigger 'on' is not one of [update, create, change] in class - {$class}");
  21. }
  22. static public function objectExpected($field, $class)
  23. {
  24. return new self("Timestampable: field - [{$field}] is expected to be object in class - {$class}");
  25. }
  26. static public function parametersMissing($field, $class)
  27. {
  28. return new self("Timestampable: missing parameters on property - {$field}, field and value must be set on [change] trigger in class - {$class}");
  29. }
  30. static public function fieldMustBeMapped($field, $class)
  31. {
  32. return new self("Timestampable: was unable to find [{$field}] as mapped property in entity - {$class}");
  33. }
  34. }