/** * Adds many_many relationships based off relationship_name and related_class_name, and many_many_extraFields such as 'Sort'. * * @param null $class * @param null $extension * @return array */ public function extraStatics($class = null, $extension = null) { $extra = []; if (static::sortable()) { $extra = ['many_many_extraFields' => [static::relationship_name() => [static::SortFieldName => 'Int']]]; } return array_merge_recursive(parent::extraStatics($class, $extension), $extra, ['many_many' => [static::relationship_name() => static::related_class_name()]]); }
public function extraStatics($class = null, $extension = null) { return array_merge_recursive(parent::extraStatics($class, $extension) ?: [], ['has_many' => [static::RelationshipName => static::RelatedClassName]]); }