Skip to content
Browse files

all classes are namespaced

  • Loading branch information...
1 parent 803eb16 commit 89e7f404b2e1e2fbf0723bfd347c694986f21012 @dg dg committed
View
6 app/config/config.neon
@@ -13,14 +13,16 @@ php:
nette:
application:
errorPresenter: Error
+ mapping:
+ *: App\*Module\*Presenter
session:
expiration: 14 days
services:
- authenticator: Authenticator
- routerFactory: RouterFactory
+ authenticator: Model\Authenticator
+ routerFactory: App\RouterFactory
router: @routerFactory::createRouter
View
12 app/model/Authenticator.php
@@ -1,6 +1,8 @@
<?php
-use Nette\Security,
+namespace Model;
+
+use Nette,
Nette\Utils\Strings;
@@ -17,7 +19,7 @@
/**
* Users authenticator.
*/
-class Authenticator extends Nette\Object implements Security\IAuthenticator
+class Authenticator extends Nette\Object implements Nette\Security\IAuthenticator
{
/** @var Nette\Database\Connection */
private $database;
@@ -42,15 +44,15 @@ public function authenticate(array $credentials)
$row = $this->database->table('users')->where('username', $username)->fetch();
if (!$row) {
- throw new Security\AuthenticationException('The username is incorrect.', self::IDENTITY_NOT_FOUND);
+ throw new Nette\Security\AuthenticationException('The username is incorrect.', self::IDENTITY_NOT_FOUND);
}
if ($row->password !== $this->calculateHash($password, $row->password)) {
- throw new Security\AuthenticationException('The password is incorrect.', self::INVALID_CREDENTIAL);
+ throw new Nette\Security\AuthenticationException('The password is incorrect.', self::INVALID_CREDENTIAL);
}
unset($row->password);
- return new Security\Identity($row->id, $row->role, $row->toArray());
+ return new Nette\Security\Identity($row->id, $row->role, $row->toArray());
}
View
6 app/presenters/BasePresenter.php
@@ -1,5 +1,11 @@
<?php
+namespace App;
+
+use Nette,
+ Model;
+
+
/**
* Base presenter for all application presenters.
*/
View
5 app/presenters/ErrorPresenter.php
@@ -1,7 +1,10 @@
<?php
-use Nette\Diagnostics\Debugger;
+namespace App;
+use Nette,
+ Model,
+ Nette\Diagnostics\Debugger;
/**
View
6 app/presenters/HomepagePresenter.php
@@ -1,5 +1,11 @@
<?php
+namespace App;
+
+use Nette,
+ Model;
+
+
/**
* Homepage presenter.
*/
View
7 app/presenters/SignPresenter.php
@@ -1,6 +1,9 @@
<?php
-use Nette\Application\UI;
+namespace App;
+
+use Nette,
+ Model;
/**
@@ -16,7 +19,7 @@ class SignPresenter extends BasePresenter
*/
protected function createComponentSignInForm()
{
- $form = new UI\Form;
+ $form = new Nette\Application\UI\Form;
$form->addText('username', 'Username:')
->setRequired('Please enter your username.');
View
7 app/router/RouterFactory.php
@@ -1,6 +1,9 @@
<?php
-use Nette\Application\Routers\RouteList,
+namespace App;
+
+use Nette,
+ Nette\Application\Routers\RouteList,
Nette\Application\Routers\Route,
Nette\Application\Routers\SimpleRouter;
@@ -12,7 +15,7 @@ class RouterFactory
{
/**
- * @return Nette\Application\IRouter
+ * @return \Nette\Application\IRouter
*/
public function createRouter()
{

2 comments on commit 89e7f40

@fprochazka
Nette Foundation member

:heart:

@Vrtak-CZ
Nette Foundation member

:heart: but why not App\Model\*?

Please sign in to comment.
Something went wrong with that request. Please try again.