comparison core/modules/migrate/src/MigrateException.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 namespace Drupal\migrate;
4
5 use Drupal\migrate\Plugin\MigrateIdMapInterface;
6 use Drupal\migrate\Plugin\MigrationInterface;
7
8 /**
9 * Defines the migrate exception class.
10 */
11 class MigrateException extends \Exception {
12
13 /**
14 * The level of the error being reported.
15 *
16 * The value is a Migration::MESSAGE_* constant.
17 *
18 * @var int
19 */
20 protected $level;
21
22 /**
23 * The status to record in the map table for the current item.
24 *
25 * The value is a MigrateMap::STATUS_* constant.
26 *
27 * @var int
28 */
29 protected $status;
30
31 /**
32 * Constructs a MigrateException object.
33 *
34 * @param string $message
35 * The message for the exception.
36 * @param int $code
37 * The Exception code.
38 * @param \Exception $previous
39 * The previous exception used for the exception chaining.
40 * @param int $level
41 * The level of the error, a Migration::MESSAGE_* constant.
42 * @param int $status
43 * The status of the item for the map table, a MigrateMap::STATUS_*
44 * constant.
45 */
46 public function __construct($message = NULL, $code = 0, \Exception $previous = NULL, $level = MigrationInterface::MESSAGE_ERROR, $status = MigrateIdMapInterface::STATUS_FAILED) {
47 $this->level = $level;
48 $this->status = $status;
49 parent::__construct($message);
50 }
51
52 /**
53 * Gets the level.
54 *
55 * @return int
56 * An integer status code. @see Migration::MESSAGE_*
57 */
58 public function getLevel() {
59 return $this->level;
60 }
61
62 /**
63 * Gets the status of the current item.
64 *
65 * @return int
66 * An integer status code. @see MigrateMap::STATUS_*
67 */
68 public function getStatus() {
69 return $this->status;
70 }
71
72 }