Skip to content

Commit

Permalink
Merge branch 'issue-2' of github.com:dikastes/liszt_common into issue-2
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathmel123 committed Mar 27, 2024
2 parents d6b6558 + 52a8946 commit a8c04e0
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,33 @@ This comprises the elasticsearch connection and translation of file formats.

You can obtain a Controller with easy access to elasticsearch by inheriting from ClientEnabledController.

use Slub\LisztCommon\Controller\ClientEnabledController;
```php
use Slub\LisztCommon\Controller\ClientEnabledController;

class ActionController extends ClientEnabledController
{
class ActionController extends ClientEnabledController
{

public function ExampleAction()
{
$this->initializeClient();
$params = ...
$entity = $this->elasticClient->search($params);
...
public function ExampleAction()
{
$this->initializeClient();
$params = ...
$entity = $this->elasticClient->search($params);
...

}
}

}
}
```
## Translation between XML and JSON

You can read in an XML document and translate it to a PHP array or JSON.

use Slub\LisztCommon\Common\XmlDocument;
...
```php
use Slub\LisztCommon\Common\XmlDocument;
...

$xmlDocument = XmlDocument::from($xmlString);
$array = $xmlDocument->toArray();
$json = $xmlDocument->toJson();
$xmlDocument = XmlDocument::from($xmlString);
$array = $xmlDocument->toArray();
$json = $xmlDocument->toJson();
```

0 comments on commit a8c04e0

Please sign in to comment.