Skip to content

Commit

Permalink
Setting default Responder state transition
Browse files Browse the repository at this point in the history
  • Loading branch information
nateabele committed Jul 21, 2013
1 parent 3b999b2 commit fa78dd5
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions action/resource/Responder.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ class Responder extends \lithium\core\Object {
protected $_responders = array();

protected $_statusTransitions = array(
'index' => array(
array(array(), array(), 200)
),
'view' => array(
array(
array(array(), array(), 200)
),
'add' => array(
Expand Down Expand Up @@ -83,11 +80,10 @@ protected function _init() {
if ($options['status'] && is_int($options['status'])) {
return $options;
}
if (!isset($transitions[$options['method']])) {
$message = "No valid transition found for method `{$options['method']}`.";
throw new ConfigException($message);
}
foreach ($transitions[$options['method']] as $transition) {
$method = $options['method'];
$events = isset($transitions[$method]) ? $transitions[$method] : $transitions[0];

foreach ($events as $transition) {
foreach ($options['state'] as $i => $state) {
$state = (array) $state + $options;

Expand Down Expand Up @@ -197,7 +193,7 @@ protected function _export($data, $exporter) {
}
return $result;
}
if (!$data instanceof $this->_classes['entity']) {
if (!is_object($data)) {
return $data;
}
$result = $exporter($data);
Expand Down

0 comments on commit fa78dd5

Please sign in to comment.