public function getMenuList($sub = 0, $parent = 0)
{
$criteria = $this->getOwnerCriteria();
if (!$parent) {
$parent = $this->getOwner()->getPrimaryKey();
}
if ($parent) {
$criteria->compare($this->primaryKeyAttribute, $this->getChildsArray($parent));
}
$items = $this->cached($this->getOwner())->findAll($criteria);
$categories = [];
foreach ($items as $item) {
$categories[(int) $item->{$this->parentAttribute}][] = $item;
}
return $this->_getMenuListRecursive($categories, $parent, $sub);
}