public function exchangeArray(array $data)
{
$legacyIdentifierName = false;
foreach ($data as $key => $value) {
$key = strtolower($key);
$key = str_replace('_', '', $key);
switch ($key) {
case 'acceptwhitelist':
$this->acceptWhitelist = $value;
break;
case 'collectionclass':
$this->collectionClass = $value;
break;
case 'collectionhttpmethods':
$this->collectionHttpMethods = $value;
break;
case 'collectionname':
$this->collectionName = $value;
break;
case 'collectionquerywhitelist':
$this->collectionQueryWhitelist = $value;
break;
case 'contenttypewhitelist':
$this->contentTypeWhitelist = $value;
break;
case 'controllerservicename':
$this->controllerServiceName = $value;
break;
case 'entityclass':
$this->entityClass = $value;
break;
case 'entityhttpmethods':
$this->entityHttpMethods = $value;
break;
case 'entityidentifiername':
$this->entityIdentifierName = $value;
break;
case 'hydratorname':
$this->hydratorName = $value;
break;
case 'identifiername':
$legacyIdentifierName = $value;
break;
case 'inputfilters':
if ($value instanceof InputFilterCollection || $value instanceof HalCollection) {
$this->inputFilters = $value;
}
break;
case 'documentation':
$this->documentation = $value;
break;
case 'module':
$this->module = $value;
break;
case 'pagesize':
$this->pageSize = $value;
break;
case 'pagesizeparam':
$this->pageSizeParam = $value;
break;
case 'resourceclass':
$this->resourceClass = $value;
break;
case 'resourcehttpmethods':
$this->entityHttpMethods = $value;
break;
case 'routeidentifiername':
$this->routeIdentifierName = $value;
break;
case 'routematch':
$this->routeMatch = $value;
break;
case 'routename':
$this->routeName = $value;
break;
case 'selector':
$this->selector = $value;
break;
case 'servicename':
$this->serviceName = $value;
break;
}
}
if ($legacyIdentifierName && !$this->routeIdentifierName) {
$this->routeIdentifierName = $legacyIdentifierName;
}
if ($legacyIdentifierName && !$this->entityIdentifierName) {
$this->entityIdentifierName = $legacyIdentifierName;
}
}
public function exchangeArray(array $data) { parent::exchangeArray($data); foreach ($data as $key => $value) { $key = strtolower($key); $key = str_replace('_', '', $key); switch ($key) { case 'servicename': $this->serviceName = $value; break; } } if (null === $this->serviceName) { throw new CreationException('No service name provided; cannot create RESTful resource', 422); } if (null === $this->routeIdentifierName) { $this->routeIdentifierName = sprintf('%s_id', $this->normalizeServiceNameForIdentifier($this->serviceName)); } if (null === $this->routeMatch) { $this->routeMatch = sprintf('/%s', $this->normalizeServiceNameForRoute($this->serviceName)); } if (null === $this->collectionName) { $this->collectionName = $this->normalizeServiceNameForIdentifier($this->serviceName); } }