If the model is not the same as the owner then prefix the field so we know the model.
@param $model CActiveRecord
@return string
184813
protected function getModelFieldPrefix($model)
    {
        return (get_class($this->owner) != get_class($model)) ? get_class($this->owner) . '.' : '';
    }
952056
public static function ownedVia($model, $attribute = null)
    {
        if (is_null($attribute)) {
            static::$ownership['*'] = $model;
        }

        static::$ownership[$model] = $attribute;
    }
410604
protected function _getSchema($model = null) {
		$result = null;
		if (empty($model)) {
			return $result;
		}

		$modelObj = ClassRegistry::init($model, true);
		if ($modelObj === false) {
			return $result;
		}

		$result = $modelObj->schema();
		if (empty($modelObj->virtualFields)) {
			return $result;
		}

		foreach ($modelObj->virtualFields as $virtualFieldName => $virtualFieldVal) {
			$result[$virtualFieldName] = ['type' => 'string'];
		}

		return $result;
	}
445416
protected function getValueFromModel($model)
    {
        if ( ! ($model instanceof Model)) {
            return null;
        }

        return get_class($model)
             . static::CLASS_AND_KEY_SEPARATOR
             . $model->getKey();
    }
1319445
public function associate($model)
    {
        $ownerKey = $model instanceof Model ? $model->getAttribute($this->ownerKey) : $model;

        $this->child->setAttribute($this->foreignKey, $ownerKey);

        if ($model instanceof Model) {
            $this->child->setRelation($this->relationName, $model);
        } elseif ($this->child->isDirty($this->foreignKey)) {
            $this->child->unsetRelation($this->relationName);
        }

        return $this->child;
    }
1016022
private function getId($model)
    {
        // Check to see if we can get an id via our defined methods
        foreach (self::$methods as $method) {
            if (method_exists($model, $method) && is_callable([$model, $method])) {
                return $model->$method();
            }
        }

        // Check to see if we can get an id via our defined properties
        foreach (self::$properties as $property) {
            if (isset($model->$property)) {
                return $model->$property;
            }
        }
    }
234089
protected function _getSchemaCache($model = null) {
		if (empty($model) || !isset($this->_schemaCache[$model])) {
			return null;
		}

		return $this->_schemaCache[$model];
	}
792012
public function getIdentifierMade($model)
    {
        if (!is_object($model)) {
            throw new \InvalidArgumentException(sprintf('You must give a object, "%s" given.', gettype($model)));
        }

        $methodMadeBy = 'get' . ucfirst($this->definition->getMadeBy());
        if (!method_exists($model, $methodMadeBy)) {
            throw new \RuntimeException(sprintf('Model "%s" must have method "%s".', get_class($model), $methodMadeBy));
        }

        $modelMade = $model->$methodMadeBy();
        if (!is_object($modelMade)) {
            throw new \RuntimeException(sprintf('Model "%s::%s()" must already return object, "%s" given.', get_class($model), $methodMadeBy, gettype($modelMade)));
        }

        $methodMadeField = 'get' . ucfirst($this->definition->getMadeField());
        if (!method_exists($model->{'get'.$this->definition->getMadeBy()}(), $modelMade)) {
            throw new \RuntimeException(sprintf('Model "%s" must have method "%s".', get_class($modelMade), $methodMadeField));
        }

        return $model->{'get'.ucfirst($this->definition->getMadeBy())}()->{'get'.ucfirst($this->definition->getMadeField())}();
    }
58640
protected function _normalizeModel(&$model) {
        if ($model instanceof Garp_Model_Db) {
            $model = get_class($model);
        }
        $model = strpos($model, 'Model_') !== false ? $model : 'Model_' . $model;
    }
612655
public static function model($model = null)
    {
        if ($model) {
            self::$_model = $model;
        }

        if (!self::$_model) {
            self::$_model = TableRegistry::get('Settings.Configurations');
        }

        return self::$_model;
    }
1111196
protected function getModelPrimaryKeyString($model)
    {
        return is_array($model->getPrimaryKey()) ? implode('-', $model->getPrimaryKey()) : $model->getPrimaryKey();
    }
959569
protected function getReferenceFallback(Model $model)
    {
        // Use reference method if the model has one
        if (method_exists($model, 'getReferenceAttribute')) {
            return $model->reference;
        }

        if (method_exists($model, 'getReference')) {
            return $model->getReference();
        }

        return (string) $model->getKey();
    }
1324868
protected function determineRouteAction(Model $model)
    {
        $routeHelper = $this->getRouteHelper();

        $permissionPrefix = $routeHelper->getPermissionPrefixForModelSlug(
            $routeHelper->getRouteSlugForModelClass(get_class($model))
        );

        // Change the action to show if we don't have edit permissions
        if ( ! cms_auth()->can($permissionPrefix . 'edit')) {
            return 'show';
        }

        return 'edit';
    }
571862
public function check($model)
    {
        if ($this->isSubQuery()) {
            return Builder::make($model, $this->property)->check() && Builder::make($model, $this->propertyToCompare)->check();
        }

        switch ($this->operator) {
            case '=':
                return $this->attribute($model, $this->property) === $this->attribute($model, $this->propertyToCompare);
                break;
            case '>=':
                return $this->attribute($model, $this->property) >= $this->attribute($model, $this->propertyToCompare);
                break;
            case '<=':
                return $this->attribute($model, $this->property) <= $this->attribute($model, $this->propertyToCompare);
                break;
            case '<>':
                return $this->attribute($model, $this->property) !== $this->attribute($model, $this->propertyToCompare);
                break;
            case '>':
                return $this->attribute($model, $this->property) > $this->attribute($model, $this->propertyToCompare);
                break;
            case '<':
                return $this->attribute($model, $this->property) < $this->attribute($model, $this->propertyToCompare);
                break;
        }
        throw new BadMethodCallException('Operator not supported: '.$this->operator);
    }
187346
protected function getForeignKeyName(Model $model)
    {
        $table = $model->getTable();

        if (array_key_exists($table, $this->foreignKeyLookup)) {
            return $this->foreignKeyLookup[$table];
        }

        return Str::singular($table).'_id';
    }
381858
public static function determineModelClassNameQualified(string $model): string
    {
        $classNameModel = static::getModelClassNameQualifiedOrNull($model);

        if (is_null($classNameModel)) {
            throw new BunqException(self::ERROR_MODEL_NOT_DEFINED, [$model]);
        }

        return $classNameModel;
    }
22554
public function getTable($model)
    {
        if (false !== $pos = array_search($model, $this->map)) {
            return $pos;
        }

        return null;
    }