Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Smolevich committed Aug 11, 2020
1 parent f1671f1 commit bfc1974
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
3 changes: 1 addition & 2 deletions examples/01-example.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/common-part.php';

use Reindexer\Client\Api;
use Reindexer\Entities\Index as IndexEntity;
use Reindexer\Services\Database;
use Reindexer\Services\Namespaces;
Expand Down Expand Up @@ -42,7 +41,7 @@
$response = $namespaceService->create($namespaceName, [$indexId]);
echo sprintf('Response data: %s', $response->getResponseBody()) . PHP_EOL;
}
} catch (Exception $e) {
} catch (\Throwable $e) {
echo sprintf(
'Error %s in file %s on line %s',
$e->getMessage(),
Expand Down
3 changes: 1 addition & 2 deletions examples/02-example.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/common-part.php';

use Reindexer\Client\Api;
use Reindexer\Services\Namespaces;

try {
Expand All @@ -22,7 +21,7 @@
} else {
echo sprintf('Error delete namespace: %s', $response->getResponseBody());
}
} catch (Exception $e) {
} catch (\Throwable $e) {
echo sprintf(
'Error %s in file %s on line %s',
$e->getMessage(),
Expand Down
10 changes: 7 additions & 3 deletions examples/03-example.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/common-part.php';

use Reindexer\Services\Database;
use Reindexer\Services\Item;
use Reindexer\Services\Namespaces;
use Reindexer\Services\Query;

try {
Expand Down Expand Up @@ -41,5 +39,11 @@
$response = $sqlService->createByHttpGet("SELECT * from $namespaceName");
$response = $sqlService->createSqlQueryByHttpPost("UPDATE $namespaceName SET name = 'John Doe changed 2' WHERE id = 1");
var_dump($response->getResponseBody());
} catch (Exception $e) {
} catch (\Throwable $e) {
echo sprintf(
'Error %s in file %s on line %s',
$e->getMessage(),
$e->getFile(),
$e->getLine()
);
}

0 comments on commit bfc1974

Please sign in to comment.