mirror of
https://github.com/JeroenED/libpairtwo.git
synced 2024-11-25 15:57:41 +01:00
Created 4. Writing your own reader (markdown)
parent
dcc400647c
commit
44007a266f
16
4.-Writing-your-own-reader.md
Normal file
16
4.-Writing-your-own-reader.md
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
Libpairtwo has built in several readers for different pairing application. However, you might be using an excel file for your competition or you might have built your own application. Libpairtwo provides an interface that enables your to use that file with libpairtwo without the need to make a pull request to the main repository.
|
||||||
|
|
||||||
|
## The basics
|
||||||
|
|
||||||
|
To start creating your own reader, you can easily start with [the reader boilerplate](https://github.com/JeroenED/libpairtwo/wiki/e.-Reader-boilerplate). This provides all required methods and probably all required use statements you'll need.
|
||||||
|
|
||||||
|
Within the `MyReader::read` method you should place all your code that reads out your excel file, xml code, etc. Whenever you have a field that should be included for reading out to your application, you can set the with `Class::setProperty('value')` where `Class::getProperty()` should be the getter for the same field.
|
||||||
|
|
||||||
|
To add players, pairings and other items that should not be alone you can use the `Tournament::AddPlayer($player)` method (example: to add a player).
|
||||||
|
|
||||||
|
If your created implementation does not generate rounds, you can easily generate these by calling the `Tournament::pairingsToRounds()` method
|
||||||
|
|
||||||
|
## Examples of readers
|
||||||
|
|
||||||
|
You can find some readers in the [src/Readers](https://github.com/JeroenED/libpairtwo/tree/master/src/Readers) of our repository.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user