| Conditions | 2 |
| Paths | 2 |
| Total Lines | 24 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 9 | ||
| Bugs | 4 | Features | 0 |
| 1 | <?php |
||
| 8 | public function Elements() |
||
| 9 | { |
||
| 10 | $result = $this->getComponents('Widgets'); |
||
| 11 | |||
| 12 | if ($result instanceof UnsavedRelationList) { |
||
| 13 | // Setup a proper UnsavedRelationList so that an page using this extension can be created |
||
| 14 | // programmatically and have unsaved/saved BaseElement records attached to it. |
||
| 15 | |||
| 16 | // NOTE(SilbinaryWolf): Able to set protected var 'dataClass' due to ViewableData using magic get/set for properties |
||
| 17 | $result->dataClass = 'BaseElement'; // Change from 'Widget' to 'BaseElement' |
||
| 18 | return $result; |
||
| 19 | } |
||
| 20 | |||
| 21 | $list = new HasManyList('BaseElement', $result->getForeignKey()); |
||
| 22 | $list->setDataModel($this->model); |
||
| 23 | $list->sort('Sort ASC'); |
||
| 24 | |||
| 25 | $list = $list->forForeignID($this->ID); |
||
| 26 | $list = $list->filter(array( |
||
| 27 | 'Enabled' => 1 |
||
| 28 | )); |
||
| 29 | |||
| 30 | return $list; |
||
| 31 | } |
||
| 32 | |||
| 71 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.