Repository.php 873 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace MGModule\DNSManager2\models\custom\package\item;
  3. use MGModule\DNSManager2 as main;
  4. /**
  5. * Description of repository
  6. *
  7. * @author Michal Czech <michael@modulesgarden.com>
  8. */
  9. class Repository extends \MGModule\DNSManager2\mgLibs\models\repository{
  10. public function getModelClass() {
  11. return __NAMESPACE__.'\PackageItem';
  12. }
  13. public function byType($type) {
  14. return $this->setFilter('type', $type);
  15. }
  16. public function byRelID($relid) {
  17. return $this->setFilter('relid', $relid);
  18. }
  19. public function byPackageID($packageid) {
  20. return $this->setFilter('packageid', $packageid);
  21. }
  22. public function getItemsWith($type, $relid) {
  23. $this->setFilter('type', $type);
  24. if($relid !== false)
  25. $this->setFilter('relid', $relid);
  26. return $this->get();
  27. }
  28. }