ZF\Apigility\Doctrine\Admin\Model\DoctrineRestServiceEntity::exchangeArray PHP Method

exchangeArray() public method

public exchangeArray ( array $data )
$data array
    public function exchangeArray(array $data)
    {
        parent::exchangeArray($data);
        foreach ($data as $key => $value) {
            $key = strtolower($key);
            $key = str_replace('_', '', $key);
            switch ($key) {
                case 'hydrator':
                    $this->hydratorName = $value;
                    break;
                case 'objectmanager':
                    $this->objectManager = $value;
                    break;
                case 'byvalue':
                    $this->byValue = $value;
                    break;
                case 'strategies':
                    $this->hydratorStrategies = $value;
                    break;
                case 'usegeneratedhydrator':
                    $this->useGeneratedHydrator = $value;
                    break;
            }
        }
    }

Usage Example

 /**
  * Merge the content negotiation configuration for the given controller
  * service into the REST metadata
  *
  * @param string $controllerServiceName
  * @param DoctrineRestServiceEntity $metadata
  * @param array $config
  */
 protected function mergeContentNegotiationConfig($controllerServiceName, DoctrineRestServiceEntity $metadata, array $config)
 {
     if (!isset($config['zf-content-negotiation'])) {
         return;
     }
     $config = $config['zf-content-negotiation'];
     if (isset($config['controllers'][$controllerServiceName])) {
         $metadata->exchangeArray(['selector' => $config['controllers'][$controllerServiceName]]);
     }
     if (isset($config['accept-whitelist'][$controllerServiceName])) {
         $metadata->exchangeArray(['accept_whitelist' => $config['accept-whitelist'][$controllerServiceName]]);
     }
     if (isset($config['content-type-whitelist'][$controllerServiceName])) {
         $metadata->exchangeArray(['content-type-whitelist' => $config['content-type-whitelist'][$controllerServiceName]]);
     }
 }
All Usage Examples Of ZF\Apigility\Doctrine\Admin\Model\DoctrineRestServiceEntity::exchangeArray
DoctrineRestServiceEntity