Skip to content
This repository has been archived by the owner on Nov 5, 2021. It is now read-only.

WIP: Upgrade dependencies, allow Symfony 4 #3

Merged
merged 5 commits into from
Jan 7, 2018
Merged

WIP: Upgrade dependencies, allow Symfony 4 #3

merged 5 commits into from
Jan 7, 2018

Conversation

mhujer
Copy link
Owner

@mhujer mhujer commented Jan 5, 2018

Closes #2

@mhujer mhujer changed the title Upgrade dependencies, allow Symfony 4 WIP: Upgrade dependencies, allow Symfony 4 Jan 5, 2018
Repository owner deleted a comment from coveralls Jan 5, 2018
Repository owner deleted a comment from coveralls Jan 5, 2018
@mhujer
Copy link
Owner Author

mhujer commented Jan 5, 2018

@din-gi can you please test this branch, which supports Symfony 4?

It should be specified like this in composer.json:
"mhujer/jms-serializer-uuid-bundle": "dev-mh-upgrade"

@dinbrca
Copy link

dinbrca commented Jan 5, 2018

@mhujer

I have installed the package but for some reason it tells me: Class uuid does not exist

this is after adding the following to services.yml in the services section:

    mhujer.jms_serializer.uuid.uuid_serializer_handler:
        class: Mhujer\JmsSerializer\Uuid\UuidSerializerHandler
        tags:
            - { name: jms_serializer.subscribing_handler }

And the following to bundles.php:

Mhujer\JmsSerializer\Uuid\SymfonyBundle\MhujerJmsSerializerUuidBundle::class => ['all' => true],

Have any idea why?

Thanks for the help :)

@mhujer
Copy link
Owner Author

mhujer commented Jan 6, 2018

Adding a serivce manually should not be necessary - that's what the bundle is doing. Only registering the bundle in bundles.php as you did, should be enough.

Have you cleaned-up the cache? (just in case :-) )

I tested it yesterday. I had a testing class:

<?php declare(strict_types = 1);

namespace App;

use JMS\Serializer\Annotation as JMS;

class User
{
	/**
	 * @JMS\Type("uuid")
	 * @var \Ramsey\Uuid\UuidInterface
	 */
	public $id;
}

And a DemoController:

<?php

namespace App\Controller;

use App\User;
use JMS\Serializer\SerializerInterface;
use Ramsey\Uuid\Uuid;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Annotation\Route;

class DemoController extends Controller
{

	/** @var \JMS\Serializer\SerializerInterface */
	private $serializer;

	/**
	 */
	public function __construct(
		SerializerInterface $serializer
	)
	{
		$this->serializer = $serializer;
	}

	/**
	 * @Route("/")
	 * @return \Symfony\Component\HttpFoundation\Response
	 */
	public function demoAction()
	{
		$user = new User();
		$user->id = Uuid::uuid4();

		return new JsonResponse(
			$this->serializer->serialize($user, 'json')
		);
	}
}

@dinbrca
Copy link

dinbrca commented Jan 6, 2018

Hey.. so I got some time today to check everything..
And I have to say I am sorry..
I tried doing your example and everything was ok.. I then knew that it must be something wrong with my project and I must be an idiot or something..

So turns out I was using the wrong serializer (I had couple of instances) and that my used instance didn't have the UUID extension registered..

Again - sorry..

Everything seems to be working well - if you can approve the pull so that it will stick to the master that will be amazing :)

Thanks a bunch!

@mhujer mhujer merged commit 171d74b into master Jan 7, 2018
@mhujer mhujer deleted the mh-upgrade branch January 7, 2018 10:30
@mhujer
Copy link
Owner Author

mhujer commented Jan 7, 2018

@dinbrca merged and released as 3.0.0, thanks for testing it! 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants