Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function generateUrl($route, $parameters = [], $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)
 {
     if (array_key_exists('id', $parameters)) {
         $parameters['id'] = IriHelper::extractId($parameters['id']);
     }
     return parent::generateUrl($route, $parameters, $referenceType);
 }
Exemplo n.º 2
0
 public function onPreSetData(FormEvent $event)
 {
     $data = $event->getData();
     $data['@id'] = IriHelper::extractId($data['@id']);
     if (isset($data['studentConvention']['@id'])) {
         $data['studentConvention']['@id'] = IriHelper::extractId($data['studentConvention']['@id']);
     }
     $event->setData($data);
 }
 /**
  * {@inheritdoc}
  */
 public function reverseTransform($value)
 {
     if (null === $value) {
         return;
     }
     if (isset($value['@id']) && false === empty($value['@id'])) {
         $value['@id'] = sprintf('%s/%s', self::API_URI_PREFIX, IriHelper::extractId($value['@id']));
     }
     if (isset($value['dateOfSignature']) && $value['dateOfSignature'] instanceof \DateTime) {
         $value['dateOfSignature'] = $value['dateOfSignature']->format('Y-m-d\\TH:i:sP');
     }
     return $value;
 }
Exemplo n.º 4
0
 /**
  * @testdox Test RoleHierarchyHelper::extractId().
  *
  * @covers       ::extractId
  * @dataProvider uriProvider
  *
  * @param string      $uri
  * @param string|null $expected
  */
 public function testExtractId($uri, $expected)
 {
     $this->assertEquals($expected, IriHelper::extractId($uri));
 }