/** * Precondition : hasUniqueField() is true and $this->owner->$ssField is set */ function getUObjectByUniqueField() { list($uField, $ssField) = $this->stat('unique_fields'); $uObjects = UnleashedAPI::get($this->stat('u_class'), array(lcfirst($uField) => $this->owner->{$ssField})); if ($uObjects) { foreach ($uObjects as $uObject) { if ($uObject[$uField] == $this->owner->{$ssField}) { return $uObject; } } } }
function getUTax() { if (self::$u_tax_guid) { $taxes = UnleashedAPI::get('Taxes'); if ($taxes) { foreach ($taxes as $tax) { if ($tax['Guid'] == self::$u_tax_guid) { return $tax; } } } } }