Updated exceptions to new nodes core format. Small tweaks here and there.
This commit is contained in:
parent
b3ff18b345
commit
b51b111786
|
@ -19,7 +19,7 @@
|
|||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.5.9",
|
||||
"laravel/framework": "5.1.*",
|
||||
"nodes/core": "^0.1"
|
||||
},
|
||||
"autoload": {
|
||||
|
|
|
@ -17,13 +17,13 @@ class CounterCacheException extends NodesException
|
|||
*
|
||||
* @access public
|
||||
* @param string $message
|
||||
* @param integer $statusCode
|
||||
* @param string|null $statusMessage
|
||||
* @param integer $code
|
||||
* @param array $headers
|
||||
* @param boolean $report
|
||||
* @param string $severity
|
||||
*/
|
||||
public function __construct($message = 'Counter cache failed', $statusCode = 500, $statusMessage = 'Counter cache failed', array $headers = [], $report = true)
|
||||
public function __construct($message = 'Counter cache failed', $code = 500, array $headers = [], $report = true, $severity = 'error')
|
||||
{
|
||||
parent::__construct($message, $statusCode, $statusMessage, $headers, $report);
|
||||
parent::__construct($message, $code, $headers, $report, $severity);
|
||||
}
|
||||
}
|
|
@ -15,13 +15,13 @@ class NoCounterCachesFound extends CounterCacheException
|
|||
*
|
||||
* @access public
|
||||
* @param string $message
|
||||
* @param integer $statusCode
|
||||
* @param string|null $statusMessage
|
||||
* @param integer $code
|
||||
* @param array $headers
|
||||
* @param boolean $report
|
||||
* @param string $severity
|
||||
*/
|
||||
public function __construct($message = 'No counter caches found on model', $statusCode = 500, $statusMessage = 'Counter cache failed', array $headers = [], $report = true)
|
||||
public function __construct($message = 'No counter caches found on model', $code = 500, array $headers = [], $report = true, $severity = 'error')
|
||||
{
|
||||
parent::__construct($message, $statusCode, $statusMessage, $headers, $report);
|
||||
parent::__construct($message, $code, $headers, $report, $severity);
|
||||
}
|
||||
}
|
|
@ -15,13 +15,13 @@ class NoEntitiesFoundException extends CounterCacheException
|
|||
*
|
||||
* @access public
|
||||
* @param string $message
|
||||
* @param integer $statusCode
|
||||
* @param string|null $statusMessage
|
||||
* @param integer $code
|
||||
* @param array $headers
|
||||
* @param boolean $report
|
||||
* @param string $severity
|
||||
*/
|
||||
public function __construct($message = 'No entities found', $statusCode = 500, $statusMessage = 'Counter cache failed', array $headers = [], $report = true)
|
||||
public function __construct($message = 'No entities found', $code = 500, array $headers = [], $report = true, $severity = 'error')
|
||||
{
|
||||
parent::__construct($message, $statusCode, $statusMessage, $headers, $report);
|
||||
parent::__construct($message, $code, $headers, $report, $severity);
|
||||
}
|
||||
}
|
|
@ -15,13 +15,13 @@ class NotCounterCacheableException extends CounterCacheException
|
|||
*
|
||||
* @access public
|
||||
* @param string $message
|
||||
* @param integer $statusCode
|
||||
* @param string|null $statusMessage
|
||||
* @param integer $code
|
||||
* @param array $headers
|
||||
* @param boolean $report
|
||||
* @param string $severity
|
||||
*/
|
||||
public function __construct($message = 'Model does not implement CounterCacheable', $statusCode = 500, $statusMessage = 'Counter cache failed', array $headers = [], $report = true)
|
||||
public function __construct($message = 'Model does not implement CounterCacheable', $code = 500, array $headers = [], $report = true, $severity = 'error')
|
||||
{
|
||||
parent::__construct($message, $statusCode, $statusMessage, $headers, $report);
|
||||
parent::__construct($message, $code, $headers, $report, $severity);
|
||||
}
|
||||
}
|
|
@ -15,13 +15,13 @@ class RelationNotFoundException extends CounterCacheException
|
|||
*
|
||||
* @access public
|
||||
* @param string $message
|
||||
* @param integer $statusCode
|
||||
* @param string|null $statusMessage
|
||||
* @param integer $code
|
||||
* @param array $headers
|
||||
* @param boolean $report
|
||||
* @param string $severity
|
||||
*/
|
||||
public function __construct($message = 'Relation not found on model', $statusCode = 500, $statusMessage = 'Counter cache failed', array $headers = [], $report = true)
|
||||
public function __construct($message = 'Relation not found on model', $code = 500, array $headers = [], $report = true, $severity = 'error')
|
||||
{
|
||||
parent::__construct($message, $statusCode, $statusMessage, $headers, $report);
|
||||
parent::__construct($message, $code, $headers, $report, $severity);
|
||||
}
|
||||
}
|
|
@ -19,8 +19,10 @@ trait CounterCacheRestored
|
|||
*/
|
||||
public static function bootCounterCacheRestored()
|
||||
{
|
||||
static::restored(function($model) {
|
||||
if (method_exists(__CLASS__, 'restored')) {
|
||||
static::restored(function ($model) {
|
||||
app('Nodes\CounterCache\CounterCache')->count($model);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue