Commit ec308894 authored by Tomas Lang's avatar Tomas Lang

Remove other usages of Nette

parent 85867541
......@@ -6,7 +6,6 @@ use LeanMapper\Relationship\HasMany;
use LeanMapper\Filtering;
use LeanMapper\Fluent;
use InvalidArgumentException;
use Nette\Utils\Strings;
abstract class Entity extends \LeanMapper\Entity
......@@ -25,7 +24,7 @@ abstract class Entity extends \LeanMapper\Entity
throw new InvalidArgumentException("Method '$name' in entity " . get_called_class() . " expects at least one argument with target column name.");
}
return $this->__call($name . Strings::firstUpper(array_shift($arguments)), $arguments);
return $this->__call($name . ucfirst(array_shift($arguments)), $arguments);
} elseif (substr($name, 0, 10) === 'getCountOf') {
$property = $this->getCurrentReflection()->getEntityProperty(lcfirst(substr($name, 10)));
......
......@@ -37,7 +37,7 @@ class Repository extends AbstractRepository
$row = $statement->fetch();
if ($row === FALSE) {
if (is_callable($notFoundCallback)) {
\Nette\Utils\Callback::invokeArgs($notFoundCallback, [$id]);
$notFoundCallback($id);
} else {
throw new InvalidArgumentException('Not found: ' . var_export($id, TRUE));
}
......
......@@ -3,9 +3,11 @@
namespace LeanMapperWorkflow\Traits;
use LeanMapperWorkflow\Repository;
use Nette\Application\IPresenter;
/**
* Trait is prepared for using in Nette presenters only
*/
trait FindEntity
{
......@@ -19,7 +21,7 @@ trait FindEntity
*/
protected final function findEntity(Repository $repository, $id, $showMessage = FALSE, $redirectLink = NULL)
{
if ($this instanceof IPresenter && ($showMessage !== FALSE || $redirectLink !== NULL)) {
if ($showMessage !== FALSE || $redirectLink !== NULL) {
$notFoundCallback = function() use ($showMessage, $redirectLink) {
if ($showMessage) {
$this->flashMessage('@todo', 'error');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment