$view = View::create($person);
$view->setFormat('json');
- return $view;
+ $viewHandler = $this->get('fos_rest.view_handler');
+ return $viewHandler->handle($view);
}
/**
$view = View::create($person);
$view->setFormat('json');
- return $view;
+ $viewHandler = $this->get('fos_rest.view_handler');
+ return $viewHandler->handle($view);
}
/**
$view = View::create($person->getFriends());
$view->setFormat('json');
- return $view;
+ $viewHandler = $this->get('fos_rest.view_handler');
+ return $viewHandler->handle($view);
}
/**
$view = View::create($person->getFriends());
$view->setFormat('json');
- return $view;
+ $viewHandler = $this->get('fos_rest.view_handler');
+ return $viewHandler->handle($view);
}
}
$this->friends_with_me->add($friendship);
}
- public function addFriend(User $friend)
+ public function addFriend(Person $friend)
{
$fs = new Friendship();
$fs->setPerson($this);