Skip to content
Permalink
Browse files

[fix] Fixing the code based on PSR (#50)

* fix code based on psr

* removing comments and spaces not needed

* fix README
  • Loading branch information...
nataliawinter authored and morris committed May 3, 2019
1 parent f9b8f81 commit 10805dea8f722eed9f965823a5c278e10689db8e
Showing with 3,648 additions and 4,094 deletions.
  1. +9 −10 README.md
  2. +2 −4 composer.json
  3. +4 −6 src/JsonSerializable.php
  4. +916 −1,036 src/LessQL/Database.php
  5. +24 −27 src/LessQL/Literal.php
  6. +737 −844 src/LessQL/Result.php
  7. +698 −810 src/LessQL/Row.php
  8. +274 −291 tests/DatabaseTest.php
  9. +504 −538 tests/ResultTest.php
  10. +291 −307 tests/RowTest.php
  11. +189 −221 tests/TestBase.php
@@ -18,33 +18,33 @@ LessQL is a lightweight and performant alternative to Object-Relational Mapping
// category: id, title
// Connection
$pdo = new PDO( 'sqlite:blog.sqlite3' );
$db = new LessQL\Database( $pdo );
$pdo = new PDO('sqlite:blog.sqlite3');
$db = new LessQL\Database($pdo);
// Find posts, their authors and categories efficiently:
// Eager loading of references happens automatically.
// This example only needs FOUR queries, one for each table.
$posts = $db->post()
->where( 'is_published', 1 )
->orderBy( 'date_published', 'DESC' );
->where('is_published', 1)
->orderBy('date_published', 'DESC');
foreach ( $posts as $post ) {
foreach ($posts as $post) {
$author = $post->user()->fetch();
foreach ( $post->categorizationList()->category() as $category ) {
foreach ($post->categorizationList()->category() as $category) {
// ...
}
}
// Saving complex structures is easy
$row = $db->createRow( 'post', array(
$row = $db->createRow('post', array(
'title' => 'News',
'body' => 'Yay!',
'categorizationList' => array(
array(
'category' => array( 'title' => 'New Category' )
'category' => array('title' => 'New Category')
),
array( 'category' => $existingCategoryRow )
array('category' => $existingCategoryRow)
)
);
@@ -53,7 +53,6 @@ $row = $db->createRow( 'post', array(
$row->save();
```


## Installation

Install LessQL via composer: `composer require morris/lessql`.
@@ -10,19 +10,17 @@
"homepage": "https://morrisbrodersen.de"
}
],

"autoload": {
"psr-0": {
"": "src"
}
},

"require": {
"php": ">=5.3.4"
},

"require-dev": {
"phpunit/phpunit": "~4.6|~5|~6|~7",
"codeclimate/php-test-reporter": "dev-master"
"codeclimate/php-test-reporter": "dev-master",
"friendsofphp/php-cs-fixer": "v2.2.20"
}
}
@@ -2,10 +2,8 @@
// compatibility for PHP < 5.4.0
if ( !interface_exists( 'JsonSerializable' ) ) {
interface JsonSerializable {
}
if (!interface_exists('JsonSerializable')) {
interface JsonSerializable
{
}
}
Oops, something went wrong.

0 comments on commit 10805de

Please sign in to comment.
You can’t perform that action at this time.