Open ianitsky opened 7 years ago
I made the proposed configurations, but I only got this error:
An exception occurred while executing 'SELECT t0.id AS id_1, t0.name AS name_2 FROM customer t0 WHERE t0.id = ?' with params [1]:
Notice: Undefined index: CURLOPT_HTTPHEADER
My doctrine config : (I'm using the AcreedIntegratorBundle)
doctrine: dbal: default_connection: mysql types: json: Sonata\Doctrine\Types\JsonType connections: mysql: driver: pdo_mysql host: "%database_host%" port: "%database_port%" dbname: "%database_name%" user: "%database_user%" password: "%database_password%" charset: UTF8 rest: driver_class: "Circle\\DoctrineRestDriver\\Driver" host: "%default_api_url%" port: "%default_api_port%" user: "%default_api_user%" password: "%default_api_password%" options: format: "json" authenticator_class: "HttpAuthentication" CURLOPT_CURLOPT_FOLLOWLOCATION: true CURLOPT_HEADER: true orm: default_entity_manager: mysql auto_generate_proxy_classes: "%kernel.debug%" entity_managers: mysql: connection: mysql naming_strategy: doctrine.orm.naming_strategy.underscore mappings: AppBundle: ~ rest: connection: rest naming_strategy: doctrine.orm.naming_strategy.underscore mappings: AcreedIntegratorBundle: ~
Entity:
<?php namespace AcreedIntegratorBundle\Entity; use Doctrine\ORM\Mapping as ORM; /** * Customer * @ORM\Entity * @ORM\Table(name="customer") */ class Customer { /** * @var int * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ private $id; /** * @var string * * @ORM\Column(name="name", type="string", length=255) */ private $name; /** * Get id * * @return int */ public function getId() { return $this->id; } /** * Set name * * @param string $name * * @return Customer */ public function setName($name) { $this->name = $name; return $this; } /** * Get name * * @return string */ public function getName() { return $this->name; } }
And my Controller action:
/** * @Route("/test", name="test") */ public function indexAction() { $em = $this->getDoctrine()->getManager('rest'); $entity = $em->getRepository('AcreedIntegratorBundle:Customer')->find(1); return new Response($entity->getName()); }
How can I reproduce it?
I made the proposed configurations, but I only got this error:
An exception occurred while executing 'SELECT t0.id AS id_1, t0.name AS name_2 FROM customer t0 WHERE t0.id = ?' with params [1]:
Notice: Undefined index: CURLOPT_HTTPHEADER
My doctrine config : (I'm using the AcreedIntegratorBundle)
Entity:
And my Controller action: