public function getComponents($componentName, $filter = "", $sort = "", $join = "", $limit = null)
 {
     $result = null;
     if (!($componentClass = $this->has_many($componentName))) {
         user_error("DataObject::getComponents(): Unknown 1-to-many component '{$componentName}'" . " on class '{$this->class}'", E_USER_ERROR);
     }
     if ($join) {
         throw new \InvalidArgumentException('The $join argument has been removed. Use leftJoin($table, $joinClause) instead.');
     }
     // If we haven't been written yet, we can't save these relations, so use a list that handles this case
     if (!$this->ID) {
         if (!isset($this->unsavedRelations[$componentName])) {
             $this->unsavedRelations[$componentName] = UnsavedRelationList::create($this->class, $componentName, $componentClass);
         }
         return $this->unsavedRelations[$componentName];
     }
     $joinField = $this->getRemoteJoinField($componentName, 'has_many');
     $result = HasManyList::create($componentClass, $joinField);
     if ($this->model) {
         $result->setDataModel($this->model);
     }
     $result = $result->forForeignID($this->ID);
     $result = $result->where($filter)->limit($limit)->sort($sort);
     return $result;
 }
    /**
     * Returns a one-to-many relation as a HasManyList
     *
     * @param string $componentName Name of the component
     * @param string|null $filter Deprecated. A filter to be inserted into the WHERE clause
     * @param string|null|array $sort Deprecated. A sort expression to be inserted into the ORDER BY clause. If omitted,
     *                                the static field $default_sort on the component class will be used.
     * @param string $join Deprecated, use leftJoin($table, $joinClause) instead
     * @param string|null|array $limit Deprecated. A limit expression to be inserted into the LIMIT clause
     *
     * @return HasManyList The components of the one-to-many relationship.
     */
    public function getComponents($componentName, $filter = null, $sort = null, $join = null, $limit = null)
    {
        $result = null;
        if (!($componentClass = $this->hasManyComponent($componentName))) {
            user_error("DataObject::getComponents(): Unknown 1-to-many component '{$componentName}'" . " on class '{$this->class}'", E_USER_ERROR);
        }
        if ($join) {
            throw new \InvalidArgumentException('The $join argument has been removed. Use leftJoin($table, $joinClause) instead.');
        }
        if ($filter !== null || $sort !== null || $limit !== null) {
            Deprecation::notice('4.0', 'The $filter, $sort and $limit parameters for DataObject::getComponents() 
				have been deprecated. Please manipluate the returned list directly.', Deprecation::SCOPE_GLOBAL);
        }
        // If we haven't been written yet, we can't save these relations, so use a list that handles this case
        if (!$this->ID) {
            if (!isset($this->unsavedRelations[$componentName])) {
                $this->unsavedRelations[$componentName] = new UnsavedRelationList($this->class, $componentName, $componentClass);
            }
            return $this->unsavedRelations[$componentName];
        }
        // Determine type and nature of foreign relation
        $joinField = $this->getRemoteJoinField($componentName, 'has_many', $polymorphic);
        if ($polymorphic) {
            $result = PolymorphicHasManyList::create($componentClass, $joinField, $this->class);
        } else {
            $result = HasManyList::create($componentClass, $joinField);
        }
        if ($this->model) {
            $result->setDataModel($this->model);
        }
        return $result->forForeignID($this->ID)->where($filter)->limit($limit)->sort($sort);
    }
 /**
  * Returns a one-to-many relation as a HasManyList
  *
  * @param string $componentName Name of the component
  * @return HasManyList The components of the one-to-many relationship.
  */
 public function getComponents($componentName)
 {
     $result = null;
     $componentClass = $this->hasManyComponent($componentName);
     if (!$componentClass) {
         throw new InvalidArgumentException(sprintf("DataObject::getComponents(): Unknown 1-to-many component '%s' on class '%s'", $componentName, $this->class));
     }
     // If we haven't been written yet, we can't save these relations, so use a list that handles this case
     if (!$this->ID) {
         if (!isset($this->unsavedRelations[$componentName])) {
             $this->unsavedRelations[$componentName] = new UnsavedRelationList($this->class, $componentName, $componentClass);
         }
         return $this->unsavedRelations[$componentName];
     }
     // Determine type and nature of foreign relation
     $joinField = $this->getRemoteJoinField($componentName, 'has_many', $polymorphic);
     /** @var HasManyList $result */
     if ($polymorphic) {
         $result = PolymorphicHasManyList::create($componentClass, $joinField, $this->class);
     } else {
         $result = HasManyList::create($componentClass, $joinField);
     }
     if ($this->model) {
         $result->setDataModel($this->model);
     }
     return $result->setDataQueryParam($this->getInheritableQueryParams())->forForeignID($this->ID);
 }