-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from alexplusde/update-class
Aktualisierte Docs und Setter-Methoden für alle Dataset-Klassen
- Loading branch information
Showing
3 changed files
with
140 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,82 @@ | ||
<?php | ||
|
||
/** | ||
* Klasse neues_category | ||
* | ||
* Diese Klasse repräsentiert eine Kategorie in der News-Verwaltung. | ||
* Sie erbt von der rex_yform_manager_dataset Klasse. | ||
* | ||
* Class neues_category | ||
* | ||
* This class represents a category in the news management. | ||
* It inherits from the rex_yform_manager_dataset class. | ||
* | ||
* $category = neues_category::create(); | ||
* $category->setValue('name', 'Neue Kategorie'); | ||
* $category->save(); | ||
*/ | ||
class neues_category extends \rex_yform_manager_dataset | ||
{ | ||
/** @api */ | ||
/** | ||
* Gibt den Namen der Kategorie zurück. | ||
* Returns the name of the category. | ||
* | ||
* @return string Der Name der Kategorie. / The name of the category. | ||
* | ||
* Beispiel / Example: | ||
* $name = $category->getName(); | ||
* | ||
* @api | ||
*/ | ||
public function getName(): string | ||
{ | ||
return $this->getValue('name'); | ||
} | ||
|
||
public function setName(string $string): self | ||
/** | ||
* Setzt den Namen der Kategorie. | ||
* Sets the name of the category. | ||
* | ||
* @param string $name Der neue Name der Kategorie. / The new name of the category. | ||
* | ||
* Beispiel / Example: | ||
* $category->setName('Neuer Name'); | ||
*/ | ||
public function setName(string $name): self | ||
{ | ||
$this->setValue('name', $string); | ||
$this->setValue('name', $name); | ||
return $this; | ||
} | ||
|
||
/** @api */ | ||
/** | ||
* Gibt die Einträge der Kategorie zurück. | ||
* Returns the entries of the category. | ||
* | ||
* @return rex_yform_manager_collection|null Die Einträge der Kategorie oder null, wenn keine Einträge vorhanden sind. / The entries of the category or null if no entries are present. | ||
* | ||
* Beispiel / Example: | ||
* $entries = $category->getEntries(); | ||
* | ||
* @api | ||
*/ | ||
public function getEntries(): ?rex_yform_manager_collection | ||
{ | ||
return $this->getRelatedDataset('entry_ids'); | ||
} | ||
/** | ||
* Gibt die URL der Kategorie zurück. | ||
* Returns the URL of the category. | ||
* | ||
* @param string $profile Das Profil, das für die URL-Erstellung verwendet wird. Standardmäßig 'neues-category-id'. / The profile used for URL creation. Defaults to 'neues-category-id'. | ||
* @return string Die URL der Kategorie oder ein leerer String, wenn keine URL gefunden wurde. / The URL of the category or an empty string if no URL was found. | ||
* | ||
* Beispiel / Example: | ||
* $url = $category->getUrl(); | ||
* | ||
* @api | ||
*/ | ||
public function getUrl(string $profile = 'neues-category-id'): ?string | ||
{ | ||
if ($url = rex_getUrl(null, null, [$profile => $this->getId()])) { | ||
return $url; | ||
} | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters