-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/dev' into dev
- Loading branch information
Showing
24 changed files
with
600 additions
and
395 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,6 @@ TODO\.txt | |
cache/twig | ||
cache/router | ||
|
||
storage/databases/* | ||
storage/logs/* | ||
|
||
_tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace App\Controllers; | ||
|
||
/** | ||
* Class mysqlController | ||
* @package App\Controllers | ||
*/ | ||
class dbController extends \BDSCore\BaseController | ||
{ | ||
private $app; | ||
|
||
|
||
public function __construct(\Psr\Http\Message\RequestInterface $request, \Psr\Http\Message\ResponseInterface $response) | ||
{ | ||
parent::__construct($request, $response); | ||
|
||
$this->app = new \App\Models\dbModel(); | ||
} | ||
|
||
|
||
public function index() | ||
{ | ||
$this->render('db.twig', ['bookmarks' => $this->app->bookmarkList()]); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
namespace App\Models; | ||
use BDSCore; | ||
|
||
class dbModel | ||
{ | ||
private $database; | ||
|
||
public function __construct() | ||
{ | ||
$this->database = new BDSCore\Database\Database(); | ||
} | ||
|
||
|
||
public function bookmarkList() | ||
{ | ||
$sql = 'SELECT id, url, nom FROM bookmark ORDER BY id ASC'; | ||
|
||
$result = $this->database->fetchAll($sql); | ||
|
||
return $result; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{% extends 'globals/default.twig' %} | ||
|
||
{% block title %}DB{% endblock %} | ||
|
||
{% block body %} | ||
|
||
<div class="block-center"> | ||
<h1>Test database</h1> | ||
</div> | ||
|
||
<div class="block_table"> | ||
{% for key, bookmark in bookmarks %} | ||
|
||
#{{ bookmark.id }} <a href="http://{{ bookmark.url }}">{{ bookmark.nom }}</a><br/> | ||
|
||
{% endfor %} | ||
</div> | ||
|
||
{% endblock %} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,8 @@ | |
*/ | ||
class DatabaseException extends \Exception | ||
{ | ||
|
||
public function test() | ||
{ | ||
return 'ERROR CONNEXIOn DATABASE'; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
CREATE DATABASE framework; | ||
|
||
CREATE TABLE bookmark | ||
( | ||
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, | ||
url VARCHAR(255) NOT NULL, | ||
nom VARCHAR(100) NOT NULL, | ||
CONSTRAINT bookmark_id_uindex UNIQUE (id) | ||
); | ||
|
||
INSERT INTO bookmark (url, nom) VALUES ('www.php.net', 'PHP'); | ||
INSERT INTO bookmark (url, nom) VALUES ('www.postgresql.org', 'PostgreSQL'); | ||
INSERT INTO bookmark (url, nom) VALUES ('www.debian.org', 'Debian'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
CREATE DATABASE framework | ||
WITH OWNER = stephane | ||
ENCODING = 'UTF8' | ||
LC_COLLATE = 'fr_FR.UTF-8' | ||
LC_CTYPE = 'fr_FR.UTF-8' | ||
CONNECTION LIMIT = -1; | ||
|
||
CREATE TABLE bookmark | ||
( | ||
id SMALLSERIAL, | ||
url VARCHAR(255) NOT NULL, | ||
nom VARCHAR(100) NOT NULL, | ||
PRIMARY KEY (id) | ||
); | ||
|
||
INSERT INTO bookmark (url, nom) VALUES ('www.php.net', 'PHP'); | ||
INSERT INTO bookmark (url, nom) VALUES ('www.postgresql.org', 'PostgreSQL'); | ||
INSERT INTO bookmark (url, nom) VALUES ('www.debian.org', 'Debian'); |
Oops, something went wrong.