Get an instance of a record

@param   integer  $link_id
@param   string   $domain_key
@return  mixed    Object on success, False on failure
354665
public static function oneByLinkAndKey($link_id, $domain_key)
	{
		$row = self::all()
			->whereEquals('link_id', $link_id)
			->whereEquals('domain_key', $domain_key)
			->row();

		if (!$row || !$row->get('id'))
		{
			$row = self::blank();
		}

		return $row;
	}
1374099
protected function getSortableLinkStart($column_key)
    {
        if ($this->getColumnOption($column_key, self::COLUMN_OPTION_SORTABLE, false))
        {
            $sortable_url = $this->createUrl(array(
                "column_orders[{$column_key}]" => (isset($this->columnOrders[$column_key]) && $this->columnOrders[$column_key] == 'asc') ? 'desc' : 'asc',
                'single_order' => $column_key
            ));

            echo '<a href="' . $sortable_url . '">';
        }
    }
829450
private function get_network( $network_id ) {
		global $wpdb;

		// Load network data
		$networks = $wpdb->get_results(
			$wpdb->prepare(
				"SELECT * FROM $wpdb->site WHERE id = %d",
				$network_id
			)
		);

		if ( ! empty( $networks ) ) {
			// Only care about domain and path which are set here
			return $networks[0];
		}

		return false;
	}
572743
public static function getXDomainUserId($domain_username, $domain)
	{
		$db = \App::get('db');

		if (empty($domain) || ($domain == 'hubzero'))
		{
			return $domain_username;
		}

		$query = 'SELECT uidNumber FROM #__xdomain_users,#__xdomains WHERE ' .
				 '#__xdomains.domain_id=#__xdomain_users.domain_id AND ' .
				 '#__xdomains.domain=' . $db->quote($domain) . ' AND ' .
				 '#__xdomain_users.domain_username=' . $db->quote($domain_username);
		$db->setQuery($query);

		$result = $db->loadObject();

		if (empty($result))
		{
			return false;
		}

		return $result->uidNumber;
	}
1209013
public static function retrieveByPK($user_id, $role_id, PropelPDO $con = null) {
        $_instancePoolKey = serialize(array((string) $user_id, (string) $role_id));
         if (null !== ($obj = UserRolePeer::getInstanceFromPool($_instancePoolKey))) {
             return $obj;
        }

        if ($con === null) {
            $con = Propel::getConnection(UserRolePeer::DATABASE_NAME, Propel::CONNECTION_READ);
        }
        $criteria = new Criteria(UserRolePeer::DATABASE_NAME);
        $criteria->add(UserRolePeer::USER_ID, $user_id);
        $criteria->add(UserRolePeer::ROLE_ID, $role_id);
        $v = UserRolePeer::doSelect($criteria, $con);

        return !empty($v) ? $v[0] : null;
    }
1210554
public function getRecordAction(Request $request, $databox_id, $record_id)
    {
        try {
            $record = $this->findDataboxById($databox_id)->get_record($record_id);

            return Result::create($request, ['record' => $this->listRecord($request, $record)])->createResponse();
        } catch (NotFoundHttpException $e) {
            return Result::createError($request, 404, $this->app->trans('Record Not Found'))->createResponse();
        } catch (\Exception $e) {
            return $this->getBadRequestAction($request, $this->app->trans('An error occurred'));
        }
    }
1043852
public function find($id)
    {
        $resultSet = $this->findAllBy(array(
            $this->getIdColumn() => $id,
        ));

        if (count($resultSet)) {
            return $resultSet[0];
        }

        throw new \DomainException(
            sprintf(
                '%s record not found by %s %s',
                $this->getTableName(),
                $this->getIdColumn(),
                $id
            )
        );
    }
1031379
private void convertLink2Record(final Object iKey) {
		if (status == MULTIVALUE_CONTENT_TYPE.ALL_RECORDS)
			return;

		final Object value;

		if (iKey instanceof ORID)
			value = iKey;
		else
			value = super.get(iKey);

		if (value != null && value instanceof ORID) {
			final ORID rid = (ORID) value;
			marshalling = true;
			try {
				try {
					// OVERWRITE IT
					super.put(iKey, rid.getRecord());
				} catch (ORecordNotFoundException e) {
					// IGNORE THIS
				}
			} finally {
				marshalling = false;
			}
		}
	}
897621
public static function getInstance($auth_domain_id, $username)
	{
		$row = self::all()
			->whereEquals('auth_domain_id', $auth_domain_id)
			->whereEquals('username', $username)
			->row();

		if (!$row || !$row->get('id'))
		{
			return false;
		}

		return $row;
	}
425799
public static function get_widget_instance( $widget_id ) {
		global $wp_registered_widgets;

		if ( ! isset( $wp_registered_widgets[ $widget_id ] ) ) {
			return false;
		}

		$model = $wp_registered_widgets[ $widget_id ]['callback'][0];

		if ( ! is_a( $model, 'Lean\Widgets\Models\AbstractWidget' ) ) {
			return false;
		}

		$key = $wp_registered_widgets[ $widget_id ]['params'][0]['number'];

		$model->_set( $key );

		return $model;
	}
770031
public function getLtiByRlid($resource_link_id)
    {
        foreach($this->lessons->modules as $mod) {
            if ( ! isset($mod->lti) ) continue;
            foreach($mod->lti as $lti ) {
                if ( $lti->resource_link_id == $resource_link_id) return $lti;
            }
        }
        return null;
    }
854299
def get_record(self, zone_name, record_id):
        
        return self._client.get(
            '/domain/zone/{}/record/{}'.format(zone_name, record_id))
834128
public function getLink($link_rel_string)
    {
        $search_string = $link_rel_string;
        if (!in_array($link_rel_string, $this->registered_link_relations)
            && strpos($link_rel_string, "fx:") === FALSE
            && strpos($link_rel_string, static::LINK_RELATIONSHIPS_BASE_URI) === FALSE) {
                if ($this->getAcceptContentType() == static::DEFAULT_ACCEPT_CONTENT_TYPE) {
                    $search_string = 'fx:' . $search_string;
                } else {
                    $search_string = static::LINK_RELATIONSHIPS_BASE_URI . $search_string;
                }
        }
        if (isset($this->links[$search_string])) {
            return $this->links[$search_string];
        } else {
            return "";
        }
    }
375892
def search_records(self, domain, record_type, name=None, data=None):
        
        search_params = []
        if name:
            search_params.append("name=%s" % name)
        if data:
            search_params.append("data=%s" % data)
        query_string = "&".join(search_params)
        dom_id = utils.get_id(domain)
        uri = "/domains/%s/records?type=%s" % (dom_id, record_type)
        if query_string:
            uri = "%s&%s" % (uri, query_string)
        resp, body = self._retry_get(uri)
        records = body.get("records", [])
        self._reset_paging("record", body)
        rec_paging = self._paging.get("record", {})
        while rec_paging.get("next_uri"):
            resp, body = self._retry_get(rec_paging.get("next_uri"))
            self._reset_paging("record", body)
            records.extend(body.get("records", []))
        for record in records:
            record["domain_id"] = dom_id
        return [CloudDNSRecord(self, record, loaded=False)
                for record in records if record]
217792
public function getRecord($id) {
        $className='Snippet';
        if($className && $id instanceof $className) {
            return $id;
        }else if($id=='root') {
            return singleton($className);
        }else if(is_numeric($id)) {
            return DataObject::get_by_id($className, $id);
        }else {
            return false;
        }
    }
783444
public static function createInstance($auth_domain_id, $username)
	{
		if (empty($auth_domain_id) || empty($username))
		{
			return false;
		}

		$row = self::blank();
		$row->set('auth_domain_id', $auth_domain_id);
		$row->set('username', $username);
		$row->save();

		if (!$row->get('id'))
		{
			return false;
		}

		return $row;
	}
1209739
public function getRecord($recordId, $dataDimensions = null)
    {

        if ($dataDimensions == null) {
            $dataDimensions = $this->getCurrentDataDimensions();
        }

        if ($this->isSingleContentRecordCaching()) {
            $cacheKey = $this->createCacheKey('record', [$this->getCurrentContentTypeName(), $recordId],
                                              $dataDimensions);

            $data = $this->getCacheProvider()->fetch($cacheKey);

            if ($data) {

                $data = json_decode($data, true);
                $recordFactory = $this->getRecordFactory();
                $record        = $recordFactory->createRecordFromJSON($this->getCurrentContentTypeDefinition(), $data);

                $record->setLanguage($dataDimensions->getLanguage());
                $record->setWorkspace($dataDimensions->getWorkspace());
                $record->setViewName($dataDimensions->getViewName());

                $record->setRepository($this);

                return $record;
            }

            $record = parent::getRecord($recordId, $dataDimensions);

            if ($record) {
                $data = json_encode($record);

                $this->getCacheProvider()->save($cacheKey, $data, $this->singleContentRecordCaching);
            }

            return $record;
        }

        return parent::getRecord($recordId, $dataDimensions);
    }