load model instance.

@param integer|null $id

@return BaseActiveRecord|null the saved model or null if saving fails
162543
protected function loadModel($id = null)
	{
		/** @var BaseActiveRecord $modelClass */
		$modelClass = $this->modelClass();
		if($id) {
			$this->modelInstance = $modelClass::findOne($id);
		} else {
			$this->modelInstance = new $modelClass();
		}
		$this->modelInstance->load($this->attributes, '');
		return $this->modelInstance;
	}
506517
protected function doFetch($id)
	{
		$cached = $this->cache->load($id);
		return $cached === NULL ? FALSE : $cached;
	}
1015915
protected function findModel($id)
    {
        if (($model = Media::findOne($id)) !== null) {
            return $model;
        } else {
            throw new NotFoundHttpException(t('app', 'The requested page does not exist.'));
        }
    }
706540
protected function getNewUploadModel($id = null)
    {
        $uploadModel = $this->modelName();

        $upload = new $uploadModel;

        if ( ! $upload instanceof Uploadable)
        {
            throw new RuntimeException('The upload model must implement the "Kenarkose\Transit\Contract\Uploadable" interface.');
        }

        if ($id)
        {
            $upload->setKey($id);
        }

        return $upload;
    }
727805
public static function get($id = null)
    {
        if ($id === null && static::$activeDatabaseConnection === null) {
            throw new MissingDatabaseConnectionException('No databases defined.');
        }

        if ($id === null) {
            return static::$databaseConnections[static::$activeDatabaseConnection];
        } else {
            return static::$databaseConnections[$id];
        }
    }
590329
public function findByIntOrFail(int $id): Model
    {
        $model = $this->findByInt($id);
        if (empty($model)) {
            throw new ResourceNotFoundException();
        }

        return $model;
    }
1255303
public function load($id) {
		if (isset($this->_helpers[$id])) {
			return $this->_helpers[$id];
		}
		
		$helper = $this->loadHelper($id);
		
		if ($helper === null) {
			return;
		}
		
		if ($this->_onInit !== null) {
			$this->_onInit->__invoke($helper);
		}
		
		if ($helper instanceof LocatorAwareInterface && ! $helper->hasLocator() && $this->hasLocator()) {
			$helper->setLocator($this->getLocator());
		}
		
		$this->_helpers[$id] = $helper;
		
		return $helper;
	}
1134012
public function actionSave($id = NULL)
	{
		$asModel = NULL;

		if ($id == NULL)
		{
			$model = new Content;
	        $model->savePrototype(Yii::app()->user->id);

	        $this->redirect('/dashboard/content/save/id/' . $model->id);
		}
		else
		{
			$model = $this->loadModel($id);
			$asModel = ContentMetadata::model()->findByAttributes(array('content_id' => $model->id, 'key' => 'autosave'));
			if ($asModel != NULL)
			{
				$model->populate(CJSON::decode($asModel->value));
				$model->autosavedata = true;
			}
		}

		$this->render('save', array(
			'model' => $model
		));
	}
310123
public function get($id = null){
        if(!is_null($id)){
            return $this->find($id);
        }
        return $this->model->get();
    }
518087
public function load($id = null)
    {
        if(is_null($id) && Mage::getSingleton('customer/session')->isLoggedIn()) {
            $this->customer = Mage::getSingleton('customer/session')->getCustomer();
        } else if(is_int($id)){
            $this->customer = Mage::getModel('customer/customer')->load($id);
            
            // TODO: Implement
        }

        if(!$this->customer->getId()) {
            return $this;
        }

        if(!($socialconnectGid = $this->customer->getInchooSocialconnectGid()) ||
                !($socialconnectGtoken = $this->customer->getInchooSocialconnectGtoken())) {
            return $this;
        }

        $this->setAccessToken($socialconnectGtoken);
        $this->_load();

        return $this;
    }
1209549
public function view($id = null) {
		if (empty($id)) {
			$this->Flash->error(__('record invalid'));
			return $this->Common->autoRedirect(['action' => 'index']);
		}
		$mimeType = $this->MimeTypes->get($id);
		if (empty($mimeType)) {
			$this->Flash->error(__('record not exists'));
			return $this->Common->autoRedirect(['action' => 'index']);
		}
		$this->set(compact('mimeType'));
	}
303286
protected function get($id = null)
    {
        $this->filter();

        if ($this->eagerLoad) {
            $this->model = $this->model->with($this->eagerLoad);
        }

        if ($id) {
            return $this->model->where('id', $id)->firstOrFail();
        }

        return $this->model->get();
    }
156721
public function load($id)
    {

        // if not, try to load the customer with the passed entity ID
        $this->customerAddressStmt->execute(array(MemberNames::ENTITY_ID => $id));
        return $this->customerAddressStmt->fetch(\PDO::FETCH_ASSOC);
    }
426494
public static function find($id)
    {
        self::init();
        $query = 'SELECT * FROM ' . self::$modelTable . ' WHERE id = '.$id;
        $qb = new QueryBuilder(self::$connect, $query);
        $rows = $qb->get();
        $collection = self::makeCollection($rows);
        return !empty($collection) ? array_shift($collection) : null;
    }
772210
public function getById($id)
    {
        $model = $this
            ->prepareQuery()
            ->where($this->model->getTable() . '.id', $id)
            ->first();

        if (empty($model))
            return null;

        $model = $this->addPermissionsForModel($model);

        return $this->formatModel($model);
    }
1076622
public function getLoadedModel($id)
    {
        return isset($this->_loadModels[$id]) ? $this->_loadModels[$id] : null;
    }
96072
public static function find($id) 
    {
        self::_checkLoaded();

        $pk               = self::isIgnoringCase() ? strtolower(self::getPK()) : self::getPK();
        $builder          = self::_makeBuilder();
        $builder->fields  = self::extractColumns();
        $builder->where   = self::_extractWhereConditions(array($pk=>$id));
        $builder->limit   = 1;

        $cls  = get_called_class();
        $stmt = self::executePrepared($builder, array($id));
        $data = $stmt->fetch(\PDO::FETCH_ASSOC);

        if (!$data) {
            return null;
        }
        return new $cls($data);
    }