Exception.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace Gedmo\Translatable;
  3. /**
  4. * The exception list for Translatable behavior
  5. *
  6. * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  7. * @package Gedmo.Translatable
  8. * @subpackage Exception
  9. * @link http://www.gediminasm.org
  10. * @version 2.0.0
  11. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  12. */
  13. class Exception extends \Exception
  14. {
  15. static public function undefinedLocale()
  16. {
  17. return new self("Translatable: locale or language cannot be empty and must be set in Translatable\Listener or in the entity");
  18. }
  19. static public function singleIdentifierRequired($entityClass)
  20. {
  21. return new self("Translatable: only a single identifier column is required for the Translatable extension, entity: {$entityClass}.");
  22. }
  23. static public function pendingInserts()
  24. {
  25. return new self("Translatable: UnitOfWork has pending inserts, cannot request query execution. TranslationListener does not support Concurrent inserts and updates together, on Doctrine 2 Beta4 yet. Try flushing only inserts or updates");
  26. }
  27. static public function entityMissingLocaleProperty($field, $className)
  28. {
  29. return new self("Translatable: there is no locale field ({$field}) found on entity: {$className}");
  30. }
  31. static public function failedToInsert()
  32. {
  33. return new self("Translatable: failed to insert new Translation record");
  34. }
  35. }