Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7088829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:50:55+00:00 2026-05-28T07:50:55+00:00

I´m tryng to implement the Symfony\Component\Serializer\Normalizer\NormalizableInterface using Symfony 2.0.9. I added the implementation like

  • 0

I´m tryng to implement the Symfony\Component\Serializer\Normalizer\NormalizableInterface using Symfony 2.0.9.

I added the implementation like this:

class MRoute implements NormalizableInterface{
...
public function normalize($object, $format = null)
{
     $points = array();
     foreach ($this->getPoints() as $point) {
         $points[] = $point->normalize();
     }
    return array(
        'id' => $this->getId(),
        'name' => $this->getName(),
        'points' => $points

    );
}

/**
 * @see
 */
function denormalize(NormalizerInterface $normalizer, $data, $format = null)
{
    if (isset($data['name']))
    {
        $this->setName($data['name']);
    }

    if (isset($data['id']))
    {
        $this->setId($data['id']);
    }
}

But when I try to acces the web service I get an error like this:

Fatal error: Declaration of MyGIS\GISBundle\Entity\MRoute::normalize() must be compatible with that of Symfony\Component\Serializer\Normalizer\NormalizableInterface::normalize() in C:\NetbeansProjects\mroute_rest_service\src\MyGIS\GISBundle\Entity\MRoute.php on line 16

I opened the Symfony\Component\Serializer\Normalizer\NormalizableInterface.php and the signatures match.

What am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:50:56+00:00Added an answer on May 28, 2026 at 7:50 am

    The interface in v2.0.9 is quite different from what you have pasted here:
    https://github.com/symfony/symfony/blob/v2.0.9/src/Symfony/Component/Serializer/Normalizer/NormalizableInterface.php

    It looks like you have implemented the 2.1 interface, which is totally different:
    https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Serializer/Normalizer/NormalizableInterface.php

    If you are in fact using 2.1 (the master branch) you need to add a use statement for NormalizerInterface.

    use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

iam trying to implement an Searchmachine into my site. Iam using Zend_Search_Lucene for this.
Im trying to implement a UnitofWork pattern using this Scott Allen tutorial My current
trying to implement a dialog-box style behaviour using a separate div section with all
I'm using Symfony 2 security system. When some user trying to login, I want
I'm trying to autoload a class within symfony 2. The class lives in vendor/lessc/lessc.inc.php
I'm trying to implement change password functionality in Symfony 2 project. I have entity
I don't know what this is called but here goes. public class Person {
SetFocus I'm trying implement the above Se Focus code in a Class Library that
Trying to implement this gallery on my website. http://coffeescripter.com/code/ad-gallery/ It is noted in the
I have been looking at nestedSet behaviour in symfony using doctrine, to display a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.