Skip to content

How to get data in the service onPostSerialize? #331

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
iBet7o opened this issue Oct 3, 2013 · 0 comments
Closed

How to get data in the service onPostSerialize? #331

iBet7o opened this issue Oct 3, 2013 · 0 comments

Comments

@iBet7o
Copy link

iBet7o commented Oct 3, 2013

Hello,

I try to add more fields to the response, but do not know how you get the data I need.

This is my code.

. . .
public function onPostSerialize(ObjectEvent $event)
{
    if ($event->getObject() instanceof Historia)
    {
        $visitor = $event->getVisitor();

        $img1 = $this->avalancheService->getBrowserPath($this->dirImages . $visitor->getData('image'), 'frontend_full_width');
        $img2 = $this->avalancheService->getBrowserPath($this->dirImages . $visitor->getData('image'), 'frontend_medium_width');

        $visitor->addData('img_full_width', $img1);
        $visitor->addData('img_medium_width', $img2);
    }
}
. . .

Thanks in advance

@iBet7o iBet7o closed this as completed Oct 4, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant