/** * {@inheritdoc} */ public function calculateDBValue(IObject $object, $localeId = null) { if (!$object instanceof IHierarchicObject) { throw new RuntimeException($this->translate('Cannot calculate order value for nonhierarchical object.')); } if (null != ($order = $object->getProperty($this->getName())->getDbValue())) { return $order; } return $object->getCollection()->getMaxOrder($object->getParent()) + 1; }
/** * {@inheritdoc} */ public function calculateDBValue(IObject $object, $localeId = null) { if (!$object instanceof IHierarchicObject) { throw new RuntimeException($this->translate('Cannot calculate materialized path value for nonhierarchical object.')); } if ($parent = $object->getParent()) { return $parent->getMaterializedPath() . self::MPATH_SEPARATOR . $object->getId(); } else { return self::MPATH_START_SYMBOL . $object->getId(); } }