Overview

Namespaces

  • rsanchez
    • Deep
      • App
        • EE
        • Laravel
          • Facade
      • Collection
      • Hydrator
      • Model
      • Plugin
      • Relations
      • Repository

Classes

  • AbstractDeferredRepository
  • AbstractFieldRepository
  • CategoryFieldRepository
  • ChannelRepository
  • ConfigUploadPrefRepository
  • FieldRepository
  • MemberFieldRepository
  • SiteRepository
  • UploadPrefRepository

Interfaces

  • RepositoryInterface
  • UploadPrefRepositoryInterface
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php
 2: 
 3: /**
 4:  * Deep
 5:  *
 6:  * @package      rsanchez\Deep
 7:  * @author       Rob Sanchez <info@robsanchez.com>
 8:  */
 9: 
10: namespace rsanchez\Deep\Repository;
11: 
12: use rsanchez\Deep\Collection\SiteCollection;
13: use rsanchez\Deep\Model\Site;
14: use rsanchez\Deep\Repository\AbstractDeferredRepository;
15: 
16: /**
17:  * Repository of all Sites
18:  */
19: class SiteRepository extends AbstractDeferredRepository
20: {
21:     /**
22:      * {@inheritdoc}
23:      *
24:      * @param \rsanchez\Deep\Model\Site $model
25:      */
26:     public function __construct(Site $model)
27:     {
28:         parent::__construct($model);
29:     }
30: 
31:     /**
32:      * Get Collection of all Sites
33:      *
34:      * @return \rsanchez\Deep\Collection\SiteCollection
35:      */
36:     public function getSites()
37:     {
38:         $this->boot();
39: 
40:         return $this->collection;
41:     }
42: 
43:     /**
44:      * Get the Page URI for the specified entry ID
45:      *
46:      * @param  int         $entryId
47:      * @return string|null
48:      */
49:     public function getPageUri($entryId)
50:     {
51:         foreach ($this->getSites() as $site) {
52:             if (isset($site->site_pages[$site->site_id]['uris'][$entryId])) {
53:                 return $site->site_pages[$site->site_id]['uris'][$entryId];
54:             }
55:         }
56: 
57:         return null;
58:     }
59: 
60:     /**
61:      * Get all the entry IDs of entries that have Page URIs
62:      *
63:      * @return array
64:      */
65:     public function getPageEntryIds()
66:     {
67:         $entryIds = array();
68: 
69:         foreach ($this->getSites() as $site) {
70:             if (isset($site->site_pages[$site->site_id]['uris'])) {
71:                 $entryIds = array_merge($entryIds, array_keys($site->site_pages[$site->site_id]['uris']));
72:             }
73:         }
74: 
75:         return $entryIds;
76:     }
77: }
78: 
API documentation generated by ApiGen 2.8.0