MappingException.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace Gedmo\Sluggable\Mapping;
  3. /**
  4. * The mapping exception list for Sluggable behavior
  5. *
  6. * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
  7. * @package Gedmo.Sluggable.Mapping
  8. * @subpackage MappingException
  9. * @link http://www.gediminasm.org
  10. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  11. */
  12. class MappingException extends \Exception
  13. {
  14. static public function fieldMustBeMapped($field, $class)
  15. {
  16. return new self("Sluggable: was unable to find [{$field}] as mapped property in entity - {$class}");
  17. }
  18. static public function noFieldsToSlug($class)
  19. {
  20. return new self("Sluggable: was unable to find sluggable fields specified for Sluggable entity - {$class}");
  21. }
  22. static public function slugFieldIsDuplicate($slugField, $class)
  23. {
  24. return new self("Sluggable: there cannot be two slug fields '{$slugField}' in class - {$class}.");
  25. }
  26. static public function notValidFieldType($field, $class)
  27. {
  28. return new self("Sluggable: cannot slug field - [{$field}] type is not valid and must be 'string' in class - {$class}");
  29. }
  30. }