accessor

@param type $modelName

@return datasource
540430
protected function getDatasource(ListenerAccessibleInterface $modelName) {

        /**
         * CP-251 - added multiple datasources to a single function. Need to check
         * for requested modelName before defaulting to datasourceKey which is
         * specified in default routing config.
         */
        if (is_object($modelName) && array_key_exists($modelName->getTablename(), $this->datasources)) {
            $datasource = $this->datasourceFactory->getDatasource($this->datasources[$modelName->getTablename()], $this->logger);
            $datasource->setDatasourceKey($this->datasources[$modelName->getTablename()]);
        } elseif (!is_object($modelName) && array_key_exists($modelName, $this->datasources)) {
            $datasource = $this->datasourceFactory->getDatasource($this->datasources[$modelName], $this->logger);
            $datasource->setDatasourceKey($this->datasources[$modelName]);
        } elseif (!is_null($this->datasourceKey)) {
            $datasource = $this->datasourceFactory->getDatasource($this->datasourceKey, $this->logger);
            $datasource->setDatasourceKey($this->datasourceKey);
        } else {
            throw new \Exception($modelName . ' datasource key missing from listeners configuration');
        }

        return $datasource;
    }
423610
public function get($alias)
    {
        $alias = $this->normalizeNamespace($alias);

        if (isset($this->byAlias[$alias])) {
            return $this->byAlias[$alias];
        }

        if (isset($this->byEntity[$alias])) {
            return $this->byEntity[$alias];
        }

        throw new ModelException(sprintf('Model for entity "%s" does not exists', $alias));
    }
287643
public function rowsPerPage($modelName)
    {
        $dataTable = app('admin_datatable');

        //get the inputted rows and the model rows
        $rows = (int) $this->request->input('rows', 20);
        $dataTable->setRowsPerPage(app('session.store'), 0, $rows);

        return response()->JSON(array('success' => true));
    }
190284
protected function generateSearchClassName($modelClassName)
    {
        $searchClassName = $this->searchModelClass;
        if (empty($searchClassName) || strpos($this->tableName, '*') !== false) {
            $searchClassName = $modelClassName;
        }
        return $searchClassName;
    }
359662
public function get($modelName)
    {
        $modelNamespace = Configuration::read('mvc.model.namespace');
        $modelNamespace = $modelNamespace . '\\' . ucFirst($modelName);
        if (!class_exists($modelNamespace)) {
            trigger_error('Model "' . $modelNamespace . '" doesn\'t exist.', E_USER_ERROR);
            return false;
        }
        return new $modelNamespace();
    }
1191191
protected function getModel($key)
    {
        if (!array_key_exists($key, $this->models)) {
            list($namespace, $key) = $this->splitNamespaceAndKey($key);

            $this->models[$key] = Config::query()
                                        ->where(Config::FIELD_NAMESPACE, $namespace)
                                        ->where(Config::FIELD_KEY, $key)
                                        ->first();

            // Cache if data is found in database
            if ($this->models[$key] !== null) {
                $this->cache->forever($key, $this->models[$key]->value);
            }
        }

        return $this->models[$key];
    }
605343
public function getMemberByUsername($username)
    {
        $timeStamp = time();
        $result = $this->em->getRepository($this->entity['m']['name'])->findOneBy(array('username' => $username));
        if (is_null($result)) {
            return new ModelResponse($result, 0, 0, null, true, 'E:D:002', 'Unable to find request entry in database.', $timeStamp, time());
        }
        return new ModelResponse($result, 1, 0, null, false, 'S:D:002', 'Entries successfully fetched from database.', $timeStamp, time());
    }
564682
protected function _getSchemaCache($modelName = null) {
		if (empty($modelName)) {
			return null;
		}

		$modelName = (string)$modelName;
		if (!isset($this->_schemaCache[$modelName])) {
			return null;
		}

		return $this->_schemaCache[$modelName];
	}
713225
protected function getDataTable() {
		if (! $this->_datatable) {
			if (in_array($this->params('table'), $this->getNameManager()->getTableNames())) {
				$DataTable = "\\{$this->getNameManager()->namespace_model}\\{$this->getNameManager()->modelName}";
				$this->_datatable = new $DataTable();
			}
		}
		return $this->_datatable;
	}
1082482
protected function getModelName($tableName)
    {
        $modelName = ResourceMapper::pluckFirst($tableName, 'table-name', 'model-name');

        return $modelName ?: $this->makeModelName($tableName);
    }
171783
protected function getEntity($modelName, $primaryModelClass) {
		if ($this->getConfig(static::CONFIG_PLUGIN) && $modelName !== $primaryModelClass && !strpos($modelName, '.')) {
			$modelName = $this->getConfig(static::CONFIG_PLUGIN) . '.' . $modelName;
		}

		try {
			$table = TableRegistry::get($modelName);
			$entityClassName = $table->getEntityClass();
		} catch (Exception $exception) {
			return '\Cake\ORM\Entity';
		}

		return $entityClassName;
	}
1327996
public function relation($relationName)
    {
        if (!$relation = $this->findRelationByName($relationName)) {
            throw new ModelException(sprintf('Unknown relation, relation "%s" not found in model "%s"', $relationName, $this->entity));
        }

        return $relation;
    }
502040
public function LoadModel($mdlname=''){
		if(empty($mdlname)){
			bimport('mvc.model');
			return new BModel();
			}
		$fn=BCOMPONENTSAPPLICATIONPATH.$this->componentname.DIRECTORY_SEPARATOR.'models'.DIRECTORY_SEPARATOR.$mdlname.'.php';
		if(!file_exists($fn)){
			$fn=BCOMPONENTSFRAMEWORKPATH.$this->componentname.DIRECTORY_SEPARATOR.'models'.DIRECTORY_SEPARATOR.$mdlname.'.php';
			}
		$class='Model_'.$this->componentname.'_'.$mdlname;
		if(!file_exists($fn)){
			echo('File "'.$fn.'" does not exist!');
			return NULL;
			}
		require_once($fn);
		$model=new $class;
		$model->controller=$this;
		return $model;
		}
704128
protected function getParameterModel($paramName, $modelClassName, $requestParams)
    {
        $paramModel = new $modelClassName;

        if (!$paramModel instanceof \yii\base\Model) {
            throw new \yii\base\InvalidParamException("Parameter '{$paramName}' must be instance of \yii\base\Model");
        }

        if (in_array($this->scenario, $paramModel->scenarios())) {
            $paramModel->scenario = $this->scenario;
            $paramModel->setAttributes($requestParams[$paramName], true);
        } else {
            $paramModel->setAttributes($requestParams[$paramName], false);
        }

        if (!$paramModel->validate()) {
            throw new ValidationException('Invalid JSON-RPC request parameters.', 0, $paramModel->getErrors());
        }

        return $paramModel;
    }
905979
public function getIncludes($modelName) {
		if ($this->models->has($modelName)
				&& $this->models->get($modelName)->has('includes')) {
			return $this->models->get($modelName)->get('includes');
		}
		return new ArrayList();
	}
1204478
final protected function getDbConnector($resource_name = 'db.default', $prefix = '')
    {
        if (!$this->di->exists($resource_name)) {
            Throw new ModelException(sprintf('A database service with name "%s" ist not registered', $resource_name));
        }

        /* @var $db Db */
        $db = $this->di->get($resource_name);

        if ($prefix) {
            $db->setPrefix($prefix);
        }

        if (!empty($this->scheme)) {
            $db->setScheme($this->scheme);
        }

        return $db;
    }
1008333
public function resolveModel($collectionName)
    {
        if (!array_key_exists($collectionName, $this->map)) {
            throw new CannotResolveModelException($collectionName);
        }
        $modelClassName = $this->map[$collectionName];
        try {
            if (!array_key_exists($modelClassName, $this->modelInstances)) {
                $reflectionClass = new \ReflectionClass($modelClassName);
                $modelInstance = $reflectionClass->newInstance();
                $this->modelInstances[$modelClassName] = $modelInstance;
            }
            return $this->modelInstances[$modelClassName];
        } catch (\Exception $e) {
            throw new CannotResolveModelException($collectionName);
        }
    }