Overrides the default find method to allow the latest revision to be found
by default.

If any new options to find are added the switch statement will have to be
updated too.

@param type $id
@param array $options
@return type
503857
public static function find($id = null, array $options = array())
	{
		$timestamp_end_name = static::temporal_property('end_column');
		$max_timestamp = static::temporal_property('max_timestamp');

		switch ($id)
		{
			case 'all':
			case 'first':
			case 'last':
				break;
			default:
				$id = (array) $id;
				$count = 0;
				foreach(static::getNonTimestampPks() as $key)
				{
					$options['where'][] = array($key, $id[$count]);

					$count++;
				}
				break;
		}

		$options['where'][] = array($timestamp_end_name, $max_timestamp);

		static::enable_id_only_primary_key();
		$result = parent::find($id, $options);
		static::disable_id_only_primary_key();

		return $result;
	}
1028175
public static function createReversal($id, $params = null, $opts = null)
    {
        return self::_createNestedResource($id, static::PATH_REVERSALS, $params, $opts);
    }
1229235
public function getUrl($id, $options = [])
    {
        $cloudinary = $this->cloudinary;

        return $cloudinary::cloudinary_url($id, $options);
    }
1008407
public function findDocument($id)
    {
        $documentPath = '/'.$this->databaseName.'/'.urlencode($id);

        return $this->httpClient->request('GET', $documentPath);
    }
1155461
public function getRenderedEditor($id, array $options = array())
    {
        $config = clone $this->options;
        $config->setFromArray($options);
        
        $basePath = $this->getView()->basePath($config->getBasePath());
        $editor = new \CKEditor($basePath);
        
        return $editor->replace($id, $this->optionsToCKEditorConfig($config));
    }
802545
public function deleteDocument($collection, $id, array $options = [])
    {
        $this->setOptions($options);
        $doc = new Document($this->client, $this->database, $collection);
        $doc->setHeaders($this->getHeaders());
        $rs = $doc->delete($id);
        $this->checkResponse($rs);
        unset($rs['_curl_info']);

        return $rs;
    }
750910
public static function allReversals($id, $params = null, $opts = null)
    {
        return self::_allNestedResources($id, static::PATH_REVERSALS, $params, $opts);
    }
1297184
public function update($id = NULL, $options = NULL) {
        return $this->request("PATCH", self::URL_PLANS . $id . "/", $api_key = $this->culqi->api_key, $options);
    }
675919
public function update($id, $data, array $options = []) {
        return $this->query(Query::UPDATE)
            ->where($this->getPrimaryKey(), $id)
            ->save($data, $options);
    }
670908
public function load($id, $options = null)
	{
	    $id = $this->normalizeServiceId($id);
	    
	    if(!isset($this->services[$id])){
	        throw new Exception\ServiceNotFoundException(
                sprintf('Service ID "%s" does not exist', $id)
	        );
	    }
	    
        if($options == null){
            $options = $this->services[$id]['options'];
        }
        
        return $this->getServicePluginManager()->get($id, $options, true, true);
	}
838915
public function find($id, array $options = [])
    {
        $event = Arr::get($options, 'event');

        if (!$event) {
            throw new InvalidArgumentException("You must specify the 'event' key in the options array");
        }

        $endpoint = null;

        switch ($event) {
            case 'charge.created':
            case 'charge.succeeded':
            case 'charge.refunded':
            case 'charge.cancelled':
            case 'charge.failed':
            case 'charge.rescored.to.decline':
                $endpoint = 'charges'; break;

            case 'chargeback.created':
            case 'chargeback.accepted':
            case 'chargeback.rejected':
                $endpoint = 'charges'; break;

            case 'fee.refund.succeeded':
            case 'fee.succeeded':
                $endpoint = 'charges'; break;

            case 'order.activated':
            case 'order.cancelled':
            case 'order.completed':
            case 'order.created':
            case 'order.expired':
            case 'order.payment.cancelled':
            case 'order.payment.received':
                $endpoint = 'charges'; break;

            case 'payout.created':
            case 'payout.failed':
            case 'payout.succeeded':
                $endpoint = 'charges'; break;

            case 'spei.received':
                $endpoint = 'charges'; break;

            case 'subscription.charge.failed':
                $endpoint = 'charges'; break;

            case 'transfer.succeeded':
                $endpoint = 'charges'; break;
        }

        if (!$endpoint) {
            throw new InvalidArgumentException(sprintf("The specified event '%s' is not valid", $event));
        }

        /* @var \Shoperti\PayMe\Response $response */
        $response = $this->gateway->commit('get', $this->gateway->buildUrlFromString("{$endpoint}/{$id}"));
        $response->type = $event;

        return $response;
    }
116297
public function read($id, array $options = [], Closure $callback = null) {
        return $this->select()
            ->where($this->getPrimaryKey(), $id)
            ->bindCallback($callback)
            ->first($options);
    }
1135829
public function saveUser($id, array $options = [ ]) {
        $data = $options;
        $data['id'] = $id;
        return $this->apiPost('user', $data);
    }
1022066
public function fetchRole($id, array $options = [])
    {
        $data = [
            '_id' => $id
        ];

        $response = $this->kuzzle->query(
            $this->buildQueryArgs('getRole'),
            $data,
            $options
        );

        return new Role($this, $response['result']['_id'], $response['result']['_source'], $response['result']['_meta']);
    }
915103
public static function find($id = null, array $options = array())
	{
		// deal with null valued PK's
		if (is_null($id))
		{
			// if no options are present, simply return null. a PK with a null value can exist
			return func_num_args() === 2 ? static::query($options) : null;
		}

		// Return all that match $options array
		elseif ($id === 'all')
		{
			return static::query($options)->get();
		}

		// Return first or last row that matches $options array
		elseif ($id === 'first' or $id === 'last')
		{
			$query = static::query($options);

			foreach(static::primary_key() as $pk)
			{
				$query->order_by($pk, $id == 'first' ? 'ASC' : 'DESC');
			}

			return $query->get_one();
		}

		// Return specific request row by ID
		else
		{
			$cache_pk = $where = array();
			$id = (array) $id;
			foreach (static::primary_key() as $pk)
			{
				$where[] = array($pk, '=', current($id));
				$cache_pk[$pk] = current($id);
				next($id);
			}

			if (array_key_exists(get_called_class(), static::$_cached_objects)
			    and array_key_exists(static::implode_pk($cache_pk), static::$_cached_objects[get_called_class()])
			    and (! isset($options['from_cache']) or $options['from_cache'] == true))
			{
				return static::$_cached_objects[get_called_class()][static::implode_pk($cache_pk)];
			}

			array_key_exists('where', $options) and $where = array_merge($options['where'], $where);
			$options['where'] = $where;
			return static::query($options)->get_one();
		}
	}
1192575
public function find($id, $draft = false)
    {
        if ($draft) {
            $this->setDraftVersionFilter(! $draft);
        }

        $block = $this->getRepository()->find($id);

        if ($draft) {
            if (null !== $revision = $this->revisionManager->getDraftRevision($block)) {
                $this->revisionManager->revert($block, $revision);
            }
        }

        return $block;
    }
963024
public static function reverse($id, $options = null)
    {
        $url = static::classUrl().'/'.$id.'/reverse';
        $params = [];
        return static::_directRequest('post', $url, $params, $options);
    }