for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace ScayTrase\Api\Cruds\Adaptors\JmsSerializer;
use Doctrine\Common\Persistence\ManagerRegistry;
use JMS\Serializer\Context;
use JMS\Serializer\VisitorInterface;
use ScayTrase\Api\Cruds\Adaptors\DoctrineOrm\EntityToIdConverter;
final class JmsDoctrineHandler
{
const TYPE = 'DoctrineAssociation';
/** @var ManagerRegistry */
private $registry;
/** @var EntityToIdConverter */
private $converter;
/**
* JmsDoctrineHandler constructor.
*
* @param ManagerRegistry $registry
*/
public function __construct(ManagerRegistry $registry)
$this->registry = $registry;
$this->converter = new EntityToIdConverter($this->registry);
}
public function serializeRelation(VisitorInterface $visitor, $relation, array $type, Context $context)
$visitor
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
$type
$context
if ($relation instanceof \Traversable) {
$relation = iterator_to_array($relation);
if (is_array($relation)) {
return array_map([$this, 'convertEntityToIds'], $relation);
return $this->converter->convert($relation);
public function deserializeRelation(VisitorInterface $visitor, $data, array $type, Context $context)
$data
// fixme
throw new \BadMethodCallException('Not supported at the moment');
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.