From a9e2d92f28b5444399891851d9e927bb0f45d1bb Mon Sep 17 00:00:00 2001 From: Tobias Franek Date: Thu, 23 Feb 2017 20:34:17 +0100 Subject: [PATCH] fixed docs --- docs/BasicUsage/BasicUsage.md | 29 +++++++++++++++++++++-------- docs/BasicUsage/Querys.md | 23 +++++++++++++++++------ 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/docs/BasicUsage/BasicUsage.md b/docs/BasicUsage/BasicUsage.md index f47c38f..322ff5c 100755 --- a/docs/BasicUsage/BasicUsage.md +++ b/docs/BasicUsage/BasicUsage.md @@ -132,31 +132,42 @@ $query->get('Students')->findAll(); if you call this method you get all Students in this case ```php -$query->get('Students')->findBy(['first_name' => 'seppi']); +$query->get('Students')->findBy(['firstName' => 'seppi']); ``` this method return all the students with the first name 'seppi' you also can search recursively like this: ```php -$query->get('Period')->findBy(['teacher:first_name' => 'seppi']); +$query->get('Period')->findBy(['teachers:firstName' => 'seppi']); ``` this will return all the Period Models where the teachers have the first name 'seppi' you also can search if a certain string exists in a firstName like this: ```php -$query->get('Period')->findBy(['teacher:first_name' => '%epp%']); +$query->get('Period')->findBy(['teachers:firstName' => '%epp%']); ``` +you also can compare dates also: + +```php +$query->get('Period')->findBy(['startDate' => ' for >=: + +possible formats: +* Y-m-d H:i +* Y-m-d you also can sort the given output ```php -$query->get('Exams')->findAll(['start_date' => 'ASC|DESC']); +$query->get('Exams')->findAll(['startDate' => 'ASC|DESC']); //you can sort by properties that are in objects that the main objects contains, but that is restricted to one level -$query->get('Exams')->findAll(['teachers:first_name' => 'ASC|DESC']); +$query->get('Exams')->findAll(['teachers:firstName' => 'ASC|DESC']); ``` this will either order the model descending (DESC) or ascending (ASC) @@ -164,7 +175,7 @@ this will either order the model descending (DESC) or ascending (ASC) you also can now give a limit to the query ```php -$query->get('Exams')->findAll(['start_date' => 'ASC|DESC'], 5); +$query->get('Exams')->findAll(['startDate' => 'ASC|DESC'], 5); ``` ### Custom Repositories @@ -173,12 +184,12 @@ There are two custom Repositories in the core already and they are the * PeriodRepository only has some additional parameters to the standard methods. * SubstitutionsRepository has some additional MANDATORY parameters to the standard methods. - + ```php //department is not mandatory $query->get('Substitution')->findAll(department, startDate, endDate); ``` - + * UserRepository with these additional functions (This Repository can only execute these functions): ```php @@ -229,3 +240,5 @@ $students = \Webuntis\Serializer\Serializer::serialize($students, 'json|xml|yml ``` + + diff --git a/docs/BasicUsage/Querys.md b/docs/BasicUsage/Querys.md index 745e976..7a8aa4e 100755 --- a/docs/BasicUsage/Querys.md +++ b/docs/BasicUsage/Querys.md @@ -24,31 +24,42 @@ $query->get('Students')->findAll(); if you call this method you get all Students in this case ```php -$query->get('Students')->findBy(['first_name' => 'seppi']); +$query->get('Students')->findBy(['firstName' => 'seppi']); ``` this method return all the students with the first name 'seppi' you also can search recursively like this: ```php -$query->get('Period')->findBy(['teacher:first_name' => 'seppi']); +$query->get('Period')->findBy(['teachers:firstName' => 'seppi']); ``` this will return all the Period Models where the teachers have the first name 'seppi' you also can search if a certain string exists in a firstName like this: ```php -$query->get('Period')->findBy(['teacher:first_name' => '%epp%']); +$query->get('Period')->findBy(['teachers:firstName' => '%epp%']); ``` +you also can compare dates also: + +```php +$query->get('Period')->findBy(['startDate' => ' for >=: + +possible formats: +* Y-m-d H:i +* Y-m-d you also can sort the given output ```php -$query->get('Exams')->findAll(['start_date' => 'ASC|DESC']); +$query->get('Exams')->findAll(['startDate' => 'ASC|DESC']); //you can sort by properties that are in objects that the main objects contains, but that is restricted to one level -$query->get('Exams')->findAll(['teachers:first_name' => 'ASC|DESC']); +$query->get('Exams')->findAll(['teachers:firstName' => 'ASC|DESC']); ``` this will either order the model descending (DESC) or ascending (ASC) @@ -56,7 +67,7 @@ this will either order the model descending (DESC) or ascending (ASC) you also can now give a limit to the query ```php -$query->get('Exams')->findAll(['start_date' => 'ASC|DESC'], 5); +$query->get('Exams')->findAll(['startDate' => 'ASC|DESC'], 5); ``` ### Custom Repositories