1 | <?php |
||
37 | class Records extends SortableAssociations |
||
38 | { |
||
39 | use Accessor; |
||
40 | |||
41 | /** |
||
42 | * @inheritdoc |
||
43 | */ |
||
44 | const SOURCE_ATTRIBUTE = MetaRecord::SOURCE_ATTRIBUTE; |
||
45 | |||
46 | /** |
||
47 | * @inheritdoc |
||
48 | */ |
||
49 | const TARGET_ATTRIBUTE = MetaRecord::TARGET_ATTRIBUTE; |
||
50 | |||
51 | /** |
||
52 | * @inheritdoc |
||
53 | */ |
||
54 | public static function recordClass(): string |
||
58 | |||
59 | /** |
||
60 | * @inheritdoc |
||
61 | */ |
||
62 | protected static function tableAlias(): string |
||
66 | |||
67 | /** |
||
68 | * @inheritdoc |
||
69 | * @return MetaQuery |
||
70 | */ |
||
71 | public function getQuery($config = []): SortableAssociationQueryInterface |
||
75 | |||
76 | /** |
||
77 | * @inheritdoc |
||
78 | * |
||
79 | * @param MetaRecord $record |
||
80 | * @return MetaQuery |
||
81 | */ |
||
82 | protected function associationQuery( |
||
91 | |||
92 | /** |
||
93 | * @inheritdoc |
||
94 | * |
||
95 | * @param MetaQuery $query |
||
96 | * @return array |
||
97 | */ |
||
98 | protected function existingAssociations( |
||
111 | |||
112 | /** |
||
113 | * @param $source |
||
114 | * @param int $fieldId |
||
115 | * @param int $siteId |
||
116 | * @return SortableAssociationQueryInterface|ActiveQuery |
||
117 | */ |
||
118 | private function query( |
||
131 | |||
132 | /** |
||
133 | * @param $source |
||
134 | * @param int $fieldId |
||
135 | * @param int $siteId |
||
136 | * @return array |
||
137 | */ |
||
138 | private function associations( |
||
147 | |||
148 | // /** |
||
149 | // * @param SortableAssociationQueryInterface $query |
||
150 | // * @return \flipbox\domains\fields\Domains|null |
||
151 | // */ |
||
152 | // protected function resolveFieldFromQuery( |
||
153 | // SortableAssociationQueryInterface $query |
||
154 | // ) { |
||
155 | // if (null === ($fieldId = $this->resolveStringAttribute($query, 'fieldId'))) { |
||
156 | // return null; |
||
157 | // } |
||
158 | // |
||
159 | // return MetaPlugin::getInstance()->getFields()->findById($fieldId); |
||
160 | // } |
||
161 | // |
||
162 | // /** |
||
163 | // * @inheritdoc |
||
164 | // * @param bool $validate |
||
165 | // * @throws \Exception |
||
166 | // */ |
||
167 | // public function save( |
||
168 | // SortableAssociationQueryInterface $query, |
||
169 | // bool $validate = true |
||
170 | // ): bool { |
||
171 | // if ($validate === true && null !== ($field = $this->resolveFieldFromQuery($query))) { |
||
172 | // $error = ''; |
||
173 | // |
||
174 | // (new MinMaxValidator([ |
||
175 | // 'min' => $field->min, |
||
176 | // 'max' => $field->max |
||
177 | // ]))->validate($query, $error); |
||
178 | // |
||
179 | // if (!empty($error)) { |
||
180 | // MetaPlugin::error(sprintf( |
||
181 | // "Meta failed to save due to the following validation errors: '%s'", |
||
182 | // Json::encode($error) |
||
183 | // )); |
||
184 | // return false; |
||
185 | // } |
||
186 | // } |
||
187 | // |
||
188 | // return parent::save($query); |
||
189 | // } |
||
190 | } |
||
191 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: