Skip to content

Commit 159644d

Browse files
committed
first version
1 parent 17af652 commit 159644d

File tree

2 files changed

+25
-12
lines changed

2 files changed

+25
-12
lines changed

README.md

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Example PHP Inline Editable Grid with Mysql
1+
# Example PHP Inline Editable Grid with MySQL
22
It is an example of an inline editable grid, using PHP and MySQL
33

44
![](docs/final.jpg)
@@ -56,13 +56,13 @@ Package operations: 2 installs, 0 updates, 0 removals
5656

5757
```
5858

59-
We will also use the next libraries **eftec/bladeone** and **eftec/pdoone**.
59+
We will also add the next libraries **eftec/bladeone** and **eftec/pdoone**. (template and database)
6060

6161

6262

6363
## 2 Creating tables
6464

65-
We need to create two tables on MySQL
65+
We need to create two tables on MySQL. The case of the column matters.
6666

6767
### Country
6868

@@ -105,6 +105,12 @@ CREATE TABLE `players` (
105105

106106

107107

108+
And a foreign key (table players)
109+
110+
![](docs/players_fk.jpg)
111+
112+
113+
108114
## 3 Adding Data to the table
109115

110116
### Data to Country
@@ -132,11 +138,13 @@ INSERT INTO `players` (`ID`, `Name`, `IdCounty`, `IsActive`) VALUES ('4', 'Franc
132138

133139
The repository layer is classes that have functions to access the database, for example, insert,update, etc.
134140

135-
We want to create it automatically as follow.
141+
The library PdoOne allows to create the repository layer using the database.
136142

137143
Let's create this PHP file (in the root of the project)
138144

139-
```
145+
📄/genrepo.php
146+
147+
```php
140148
<?php
141149

142150
use eftec\PdoOne;
@@ -152,7 +160,7 @@ where 127.0.0.1 is the server, root = user, abc.123 = password and example_edita
152160

153161
**loglevel**=3 is if something goes south then it will show the error.
154162

155-
And renders shows the next screen:
163+
And renders shows the next screen: (open the page to show this page)
156164

157165
![](docs/ide.jpg)
158166

@@ -162,7 +170,7 @@ Add the next information. Where it says "**input**", select the name of the tab
162170

163171
For output, selects the option "**classcode**". It will generate our class.
164172

165-
Press generate and copy the result (is in **log**)
173+
Press generate and copy the result (is generated in **log** text area)
166174

167175
It will generate the next code
168176

@@ -186,6 +194,10 @@ Copy this code and save in a folder (in my case I will use the folder **repo**)
186194

187195
Repeats the same procedure with all the tables.
188196

197+
📄 repo/CountryRepo.php
198+
199+
📄 repo/PlayersRepo.php
200+
189201
## 5 Views
190202

191203
In the folder views, create the next file 📄 views/table.blade.php
@@ -302,9 +314,7 @@ echo $blade->run('table',[]);
302314

303315
:-|
304316

305-
![](docs/notfound.jpg)
306-
307-
Ok, it is a start but it misses the web services mentioned in the step 5.
317+
![](docs/notfound.jpg)Ok, it is a start but it misses the web services mentioned in the step 5.
308318

309319
## 8 Creating web service.
310320

@@ -434,10 +444,10 @@ Listing the countries. We use the class **CountryRepo**. We could also sort, pag
434444
$result = CountryRepo::toList(); // select * from country
435445
```
436446

437-
Listing the players. We need a custom query so we create directly (without the Repository layer). It is because we need all the columns of players but also the name of the country.
447+
Listing the players. We need a custom query so we create it directly (without the Repository class). It is because we need all the columns of players but also the name of the country.
438448

439449
```php
440-
$r['records'] = $pdoOne->select('ID,Players.Name,Country.Name as CountryName,IsActive')->from('Players')
450+
$r['records'] = $pdoOne->select('ID,Players.Name,Country.Name as CountryName,IsActive')->from('Players')
441451
->left('Country on Players.IdCounty=Country.IdCounty')->toList();
442452
```
443453
### 8.4 Update and delete
@@ -456,3 +466,6 @@ Execute the same page than step 7 and it is the final result. If something fails
456466

457467
![](docs/final.jpg)
458468

469+
## 10 Final step
470+
471+
:-)

docs/notfound.jpg

-6.13 KB
Loading

0 commit comments

Comments
 (0)