Exception.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace DoctrineExtensions\Translatable;
  3. /**
  4. * The exception list for Translatable behavior
  5. *
  6. * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  7. * @package DoctrineExtensions.Translatable
  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 undefinedLocale()
  15. {
  16. return new self("Locale cannot be empty and must be set in Translatable\Listener or in the entity");
  17. }
  18. static public function singleIdentifierRequired($entityClass)
  19. {
  20. return new self("Only a single identifier column is required for the Translatable extension, entity: {$entityClass}.");
  21. }
  22. static public function invalidIdentifierType($id)
  23. {
  24. $type = gettype($id);
  25. return new self("Currently there is only integer identifiers supported, [{$type}] is given.");
  26. }
  27. static public function pendingInserts()
  28. {
  29. return new self("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");
  30. }
  31. static public function failedToInsert()
  32. {
  33. return new self("Failed to insert new Translation record");
  34. }
  35. }