Skip to content

Commit

Permalink
Merge pull request #35 from rmolodyko/master
Browse files Browse the repository at this point in the history
Fixed not view found exception
  • Loading branch information
vitalyiegorov committed Feb 18, 2016
2 parents e79ac45 + d158855 commit 631d09c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/ExternalModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function view($viewPath)
return $this->parent->view($viewPath);
} else { // Call default module behaviour
// Call default module behaviour
parent::view($this->view_path);
parent::view($viewPath);

return $this;
}
Expand Down
28 changes: 14 additions & 14 deletions src/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,15 @@ public function html($value)
public function view($viewPath)
{
// Find full path to view file
$viewPath = $this->findView($viewPath);
$foundViewPath = $this->findView($viewPath);

// We could not find view
if ($viewPath !== false) {
if ($foundViewPath !== false) {
// Switch view context to founded module view
$this->viewContext($viewPath);
$this->viewContext($foundViewPath);

// Set current view path
$this->view_path = $viewPath;
$this->view_path = $foundViewPath;
} else {
throw(new ViewPathNotFound($viewPath));
}
Expand Down Expand Up @@ -341,7 +341,7 @@ public function __call($method, $arguments)
if (is_object($arguments[0]) || is_array($arguments[0])) {
$this->__set($arguments[0], $method);
} else { // Standard logic
$this->__set($arguments[0], $method);
$this->__set($method, $arguments[0]);
}
}

Expand Down Expand Up @@ -373,9 +373,9 @@ public function __wakeup()
// TODO: Переделать обработчик в одинаковый вид для объектов и простых

/** Группа методов для доступа к аттрибутам в виде массива */
public function offsetSet($offset, $value)
public function offsetSet($value, $offset)
{
$this->__set($value, $offset);
$this->__set($offset, $value);
}

public function offsetGet($offset)
Expand Down Expand Up @@ -412,14 +412,14 @@ public function __set($value, $field = null)
//throw new \Exception('ViewInterface::set($value, $name) has changed, first arg is variable second is name or prefix');
}

// This is object
if (is_object($value) && is_a($value, 'samsonframework\core\RenderInterface')) {
$this->_setObject($value, $field);
} elseif (is_array($value)) { // If array is passed
$this->_setArray($value, $field);
} else { // Set view variable
// This is object
if (is_object($value) && is_a($value, 'samsonframework\core\RenderInterface')) {
$this->_setObject($value, $field);
} elseif (is_array($value)) { // If array is passed
$this->_setArray($value, $field);
} else { // Set view variable
$this->data[$field] = $value;
}
}
}

public function offsetUnset($offset)
Expand Down

0 comments on commit 631d09c

Please sign in to comment.