Skip to content

Commit

Permalink
[TASK] add more documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
kaystrobach committed Jan 7, 2019
1 parent f9fefaf commit 1ff708d
Showing 1 changed file with 54 additions and 4 deletions.
58 changes: 54 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,75 @@ Alternativly you can add the following line to your ```composer.json``` and exec
"kaystrobach/visualsearch": "@dev"
```

## Basic Usage


## Inclusion in a FLUID Template
### Inclusion in a FLUID Template

To include the viewHelper you include a line like:

```
<search:widget.search search="students"/>
<search:widget.search search="KayStrobach_Contact_Institution"/>
```

This way you define, that ```students``` is the key for storing the filter query in the session for later usage and it is the key for configuring the search in the ```VisualSearch.yaml```.

To make it even easier, you can use the partial provided by the package:

```
<f:render partial="Visualsearch/Search" arguments="{searchName:'KayStrobach_Contact_Institution', institutions:institutions}" contentAs="value">
...
</f:render>
```

### Make it possible to query your repository

```php
<?php
namespace Acme\Project\Domain\Repository;

use KayStrobach\VisualSearch\Domain\Repository\SearchableRepository;
use TYPO3\Flow\Annotations as Flow;

/**
* @Flow\Scope("singleton")
*/
class StudentRepository extends SearchableRepository {

/**
* @var string
*/
protected $defaultSearchName = 'KayStrobach_Contact_Institution';
```

### query the repository in your controller

```php
public function indexAction() {
$this->view->assign(
'institutions',
$this->institutionRepository->findByDefaultQuery()
);
}

```

### VisualSearch.yaml

to define the search please checkout the visualSearch.yaml file, please use the package `kaystrobach/contact` as reference.


## Advanced Usage




## Searching in the Repository by query

In the studentsRepository you can use the following function to get the filtered students:

```
<?php
namespace SBS\LaPo\Domain\Repository;
namespace Acme\Project\Domain\Repository;
/* *
* This script belongs to the TYPO3 Flow package "SBS.LaPo". *
Expand Down

0 comments on commit 1ff708d

Please sign in to comment.