Overview

Namespaces

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

Classes

  • AbstractFieldCollection
  • AbstractTitleCollection
  • AssetCollection
  • CategoryCollection
  • CategoryFieldCollection
  • ChannelCollection
  • EntryCollection
  • FieldCollection
  • FileCollection
  • GridColCollection
  • GridRowCollection
  • MatrixColCollection
  • MatrixRowCollection
  • MemberFieldCollection
  • PlayaCollection
  • RelationshipCollection
  • SiteCollection
  • TitleCollection
  • UploadPrefCollection

Interfaces

  • FilterableInterface

Traits

  • FilterableTrait
  • 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\Collection;
11: 
12: use Illuminate\Database\Eloquent\Collection;
13: 
14: /**
15:  * Collection of \rsanchez\Deep\Model\AbstractField
16:  */
17: abstract class AbstractFieldCollection extends Collection
18: {
19:     /**
20:      * array of field_name => \rsanchez\Deep\Model\AbstractField
21:      * @var array
22:      */
23:     protected $fieldsByName = array();
24: 
25:     /**
26:      * {@inheritdoc}
27:      */
28:     public function __construct(array $fields = array())
29:     {
30:         foreach ($fields as $field) {
31:             $this->fieldsByName[$field->field_name] = $field;
32:         }
33: 
34:         parent::__construct($fields);
35:     }
36: 
37:     /**
38:      * Get the field_id for the specified field name
39:      *
40:      * @param  string $field name of the field
41:      * @return string
42:      */
43:     public function getFieldId($field)
44:     {
45:         return $this->fieldsByName[$field]->field_id;
46:     }
47: 
48:     /**
49:      * {@inheritdoc}
50:      */
51:     public function push($field)
52:     {
53:         $this->fieldsByName[$field->field_name] = $field;
54: 
55:         return parent::push($field);
56:     }
57: 
58:     /**
59:      * Check if this collection has the specified field name
60:      *
61:      * @param  string  $field the name of the field
62:      * @return boolean
63:      */
64:     public function hasField($field)
65:     {
66:         return array_key_exists($field, $this->fieldsByName);
67:     }
68: }
69: 
API documentation generated by ApiGen 2.8.0