In Eloquent, you can do this:

public function children() {
    return $this->hasMany('page');
}

And in Ardent, you can do this:

public static $relationsData = [
    'children' => [self::HAS_MANY, 'Page'],
];

In Eloquent, you can also do this:

public function children() {
    return $this->hasMany('page')->orderBy('sort_order', 'desc');
}

Is there any way to do that, or get the same effect as that in Ardent?

I really like the short Ardent notation, but don't want to have to call $page->children->ordered() with a scope just to order them, as they'll need to be ordered every single time it's called anyway.

有帮助吗?

解决方案

As it turns out, it's just not possible. You need the full definition if you want to do anything more than the basic relation functionality.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top