Skip to content

Commit

Permalink
Erweiterung für Verknüpfungen auf ID-Basis
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Blum committed Nov 14, 2016
1 parent d189fbb commit 0dbe0b3
Show file tree
Hide file tree
Showing 27 changed files with 87 additions and 81 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea
vendor
Empty file modified Visionline/Crm/WebApi/Cache.php
100644 → 100755
Empty file.
15 changes: 4 additions & 11 deletions Visionline/Crm/WebApi/CacheEntry.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -102,24 +102,17 @@ public function merge(CacheEntry $other)
return $result;
}

/**
* Returns the key under which this cache entry can be stored or retrieved.
* @return string The key under which this cache entry can be stored or retrieved.
*/
public function getKey()
{
return CacheEntry::computeKey($this->type, $this->id);
}

/**
* Computes the key under which a cache entry can be stored or retrieved.
* @param string $type The entity type
* @param string $id the entity id
* @param string $language the language
* @param bool $return_ids Whether the cache entry contains IDs instead of values for relation fields
* @return string The key under which a cache entry can be stored or retrieved.
*/
public static function computeKey($type, $id)
public static function computeKey($type, $id, $language, $return_ids)
{
return $type . '#' . $id;
return $type . '#' . $id . '-' . strtolower($language) . ($return_ids ? '-ids' : '');
}
}

Expand Down
Empty file modified Visionline/Crm/WebApi/Connection.php
100644 → 100755
Empty file.
Empty file modified Visionline/Crm/WebApi/CreateEnquiryResult.php
100644 → 100755
Empty file.
Empty file modified Visionline/Crm/WebApi/Enquiry.php
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions Visionline/Crm/WebApi/EntityType.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ class EntityType
/**
* Constant for entity-type 'Aktivität'
*/
const Aktivität = "Aktivität";
const Aktivität = "Aktivität";

/**
* Empty private constructor
*/
private function __construct() {}
}
}
Empty file modified Visionline/Crm/WebApi/EnumFieldsResult.php
100644 → 100755
Empty file.
Empty file modified Visionline/Crm/WebApi/Expression.php
100644 → 100755
Empty file.
Empty file modified Visionline/Crm/WebApi/FileCache.php
100644 → 100755
Empty file.
Empty file modified Visionline/Crm/WebApi/FileGetOperation.php
100644 → 100755
Empty file.
Empty file modified Visionline/Crm/WebApi/FileOperation.php
100644 → 100755
Empty file.
Empty file modified Visionline/Crm/WebApi/FilePassthruOperation.php
100644 → 100755
Empty file.
2 changes: 2 additions & 0 deletions Visionline/Crm/WebApi/FileSaveOperation.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ protected function getResult()
* @param int $width The width to which an image should be resized
* @param int $height The height to which an image should be resized
* @param string $resizeMode Specifies how an image should be resized
* @return bool Whether the file should be downloaded
* @see \Visionline\Crm\WebApi\FileOperation::shouldDownload()
*/
protected function shouldDownload(QueryResult $document, $width, $height, $resizeMode)
Expand Down Expand Up @@ -178,6 +179,7 @@ protected function shouldDownload(QueryResult $document, $width, $height, $resiz
* @param string $resizeMode Specifies how an image should be resized
* @param string $contentType The content type of the file
* @param string $extension The file extension of the file
* @return string The filename
*/
private function getFilename($id, $width = null, $height = null, $resizeMode = null, $contentType = null, $extension = null)
{
Expand Down
Empty file modified Visionline/Crm/WebApi/Filter.php
100644 → 100755
Empty file.
Empty file modified Visionline/Crm/WebApi/Interest.php
100644 → 100755
Empty file.
Empty file modified Visionline/Crm/WebApi/Junction.php
100644 → 100755
Empty file.
Empty file modified Visionline/Crm/WebApi/Language.php
100644 → 100755
Empty file.
Empty file modified Visionline/Crm/WebApi/Operator.php
100644 → 100755
Empty file.
Empty file modified Visionline/Crm/WebApi/Order.php
100644 → 100755
Empty file.
41 changes: 21 additions & 20 deletions Visionline/Crm/WebApi/Query.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* Defines the class Query
* @package pagepackage
*/
/**
* Defines the class Query
* @package pagepackage
*/

namespace Visionline\Crm\WebApi;

Expand Down Expand Up @@ -79,21 +79,21 @@ public function order($order)
return $this->addOrder($order);
}

/**
* Adds an order to the query
* @param Order $order The order to add to this query
* @return \Visionline\Crm\WebApi\Query A reference to this query.
*/
public function addOrder($order)
{
array_push($this->orders, $order);
return $this;
/**
* Adds an order to the query
* @param Order $order The order to add to this query
* @return \Visionline\Crm\WebApi\Query A reference to this query.
*/
public function addOrder($order)
{
array_push($this->orders, $order);
return $this;
}

/**
* Specifies the index of first result to be retrieved by this query
* @param int $first The index of first result to be retrieved by this query
* @return \Visionline\Crm\WebApi\Query A reference to this query.
/**
* Specifies the index of first result to be retrieved by this query
* @param int $first The index of first result to be retrieved by this query
* @return \Visionline\Crm\WebApi\Query A reference to this query.
*/
public function first($first)
{
Expand Down Expand Up @@ -145,16 +145,17 @@ public function uniqueResult()
/**
* Runs this query by calling result() and returns the specified fields of the matching entities by calling WebApi::get for the query results.
* @param array $fields An array of strings specifying which fields should be returned. The strings in the array have to be UTF-8 encoded.
* @return A two-dimensional array that contains the results. The keys of the first level are
* @param bool $return_ids Whether to return ids instead of values for relations
* @return array A two-dimensional array that contains the results. The keys of the first level are
* the ids of the entities. The keys of the second level are the field identifiers and values are
* the corresponding field values. The field values are UTF-8 encoded strings.
* @throws \SoapFault if a remote error occurs.
* @see WebApi::get
*/
public function fields(array $fields)
public function fields(array $fields, $return_ids = false)
{
$queryResults = $this->result();
$fieldResults = $this->webapi->get($this->type, $queryResults, $fields);
$fieldResults = $this->webapi->get($this->type, $queryResults, $fields, $return_ids);

uksort($fieldResults, function($id1, $id2) use ($queryResults) {
foreach ($queryResults as $queryResult)
Expand Down
Empty file modified Visionline/Crm/WebApi/QueryResult.php
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion Visionline/Crm/WebApi/RelatedQueryResult.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ public function init()
$this->lastModified = strtotime($this->lastModified);
}
}
}
}
Empty file modified Visionline/Crm/WebApi/RelatedRoleQueryResult.php
100644 → 100755
Empty file.
Empty file modified Visionline/Crm/WebApi/ResizeMode.php
100644 → 100755
Empty file.
Empty file modified Visionline/Crm/WebApi/UriBuilder.php
100644 → 100755
Empty file.
Loading

0 comments on commit 0dbe0b3

Please sign in to comment.