/** * Returns a many-to-many component, as a ManyManyList. * @param string $componentName Name of the many-many component * @return ManyManyList The set of components * * @todo Implement query-params */ public function getManyManyComponents($componentName, $filter = "", $sort = "", $join = "", $limit = "") { list($parentClass, $componentClass, $parentField, $componentField, $table) = $this->many_many($componentName); $result = new ManyManyList($componentClass, $table, $componentField, $parentField, $this->many_many_extraFields($componentName)); if($this->model) $result->setModel($this->model); // If this is called on a singleton, then we return an 'orphaned relation' that can have the // foreignID set elsewhere. $result->setForeignID($this->ID); return $result->where($filter)->sort($sort)->limit($limit); }