Giter VIP home page Giter VIP logo

Comments (9)

Remo avatar Remo commented on May 20, 2024

once I started debugging I saw the problem, looks like there's an endless loop, not sure why it happens yet. The following lines are repeated:

[Mon Sep 07 11:37:52 2015] PHP 119. NilPortugues\Serializer\Serializer->serializeData() /home/remo/jsonapi1/vendor\nilportugues/serializer/src/Serializer.php:469
[Mon Sep 07 11:37:52 2015] PHP 120. NilPortugues\Serializer\DeepCopySerializer->serializeObject() /home/remo/jsonapi1/vendor/nilportugues/serializer/src\Serializer.php:146
[Mon Sep 07 11:37:52 2015] PHP 121. NilPortugues\Serializer\Serializer->serializeInternalClass() /home/remo/jsonapi1/vendor/nilportugues/serializer/src\DeepCopySerializer.php:34

from laravel5-jsonapi.

nilportugues avatar nilportugues commented on May 20, 2024

Could you provide an example? I'll look into it...

from laravel5-jsonapi.

nilportugues avatar nilportugues commented on May 20, 2024

Seems to be failing because it cannot retrieve class properties from internal class... so question is, what's the internal class being used? If it's a special case, I should write its own serializer.

from laravel5-jsonapi.

Remo avatar Remo commented on May 20, 2024

I'm using the current laravel version and a super simple class:

namespace Ortic\Models;
class Post extends Model {
}

and in my controller:

        $posts = $this->post->all();
        //$posts = $this->post->find(1, ['id']);
        $transformer = $this->serializer->getTransformer();
        $transformer->setSelfUrl(route('posts.index', []));

        $response =  $this->response($this->serializer->serialize($posts));
        return $response;

and my config:

<?php
return [
    [
        'class' => 'OrticDb\Models\Post',
        'alias' => '',
        'aliased_properties' => [
        ],
        'hide_properties' => [
        ],
        'id_properties' => [
            'id',
        ],
        'urls' => [
            'self' => 'posts.index',
        ],
    ],
];

from laravel5-jsonapi.

nilportugues avatar nilportugues commented on May 20, 2024

Laravel Models out of the box use __get(), meaning properties are magic. I see the problem.

Should code a special case for theIlluminate\Database\Eloquent\Model class, indeed.

I'll treat this as a bug.

from laravel5-jsonapi.

nilportugues avatar nilportugues commented on May 20, 2024

Alright I've done some small testing and if nothing goes wrong this fix should up and ready today/tomorrow 👍

from laravel5-jsonapi.

nilportugues avatar nilportugues commented on May 20, 2024

@Remo you'll love this: https://github.com/nilportugues/laravel5-jsonapi-transformer/releases/tag/1.2.0

Thanks once again :) 👍

from laravel5-jsonapi.

Remo avatar Remo commented on May 20, 2024

You're fast, awesome! I'll continue my tests, thanks!

from laravel5-jsonapi.

nilportugues avatar nilportugues commented on May 20, 2024

@Remo let me know how it goes :)

from laravel5-jsonapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.