Git Product home page Git Product logo

jad's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

jad's Issues

Singular/plural

Remove the singular plural issue, every resource name should be in plural

Mapping not found in custom relation

Warning: array_merge(): Argument #2 is not an array in 
/Users/oli/PhpstormProjects/jad/src/Document/Resource.php on line 137

Pick up target entity and add, in this case, "support-rep" to mapping so it can be included. EntitySerializer.php:78 returns null (mapping not found)

 /**
     * @ORM\ManyToOne(targetEntity="Employees", fetch="EAGER")
     * @ORM\JoinColumn(name="SupportRepId", referencedColumnName="EmployeeId")
     */
    protected $supportRep;

Filter resource type does not kebabify

Description

api/jad/work-classification?filter[work-classification][classification][like]=Xf renders error:

{"errors":[{"status":"0","title":"Query error","detail":"[Syntax Error] line 0, col 13: Error: Expected Doctrine\\ORM\\Query\\Lexer::T_FROM, got '-'"}]}

api/jad/work-classification?filter[workClassification][classification][like]=Xf however, works as excepted.

When creating a new resource adding relationship generates an error

Description

When creating a new resource adding relationship generates an error.

{
  "data": {
    "type": "photos",
    "attributes": {
      "title": "Ember Hamster",
      "src": "http://example.com/images/productivity.png"
    },
    "relationships": {
      "photographer": {
        "data": { "type": "people", "id": "9" }
      }
    }
  }
}

Many to Many

Description

How to update "many to many" relation correctly?

{
  "data": {
  	"id":2,
    "type": "users",
    "attributes": {
    },
    "relationships": {
      "groups": {
        "data": 
        [
          { "type": "groups", "id": 1 },
          { "type": "groups", "id": 5 }
        ]
      }
    }
  }
}

Above its add to pivot table, but how only update data in pivot table?

[Description of the bug or feature]

Bad formatting: The data seems to be duplicated

Description

I have 3 languages: english, portuguese and spanish.
In "Postman" when I call "/languages" in "preview" seems correct, but when I change to "Pretty" show me a "syntax error". I paste the response in JsonLint and the data seems to be duplicade.

The database:

captura de tela em 2017-12-21 09-21-29

captura de tela em 2017-12-21 09-06-11

captura de tela em 2017-12-21 09-06-29

The "LanguageController":

captura de tela em 2017-12-21 09-07-27

This is the response:

{"data":[{"id":"1","type":"languages","attributes":{"name":"Portugu\u00eas","alias":"br","active":true,"deleted-at":null,"created-at":"2017-12-20 14:51:32","updated-at":"2017-12-20 14:51:32"}},{"id":"2","type":"languages","attributes":{"name":"Espanhol","alias":"es","active":true,"deleted-at":null,"created-at":"2017-12-20 14:51:33","updated-at":"2017-12-20 14:51:33"}},{"id":"3","type":"languages","attributes":{"name":"Ingl\u00eas","alias":"en","active":true,"deleted-at":null,"created-at":"2017-12-20 14:51:33","updated-at":"2017-12-20 14:51:33"}}],"links":{"self":"http:\/\/localhost\/languages"}}{"data":[{"id":"1","type":"languages","attributes":{"name":"Portugu\u00eas","alias":"br","active":true,"deleted-at":null,"created-at":"2017-12-20 14:51:32","updated-at":"2017-12-20 14:51:32"}},{"id":"2","type":"languages","attributes":{"name":"Espanhol","alias":"es","active":true,"deleted-at":null,"created-at":"2017-12-20 14:51:33","updated-at":"2017-12-20 14:51:33"}},{"id":"3","type":"languages","attributes":{"name":"Ingl\u00eas","alias":"en","active":true,"deleted-at":null,"created-at":"2017-12-20 14:51:33","updated-at":"2017-12-20 14:51:33"}}],"links":{"self":"http:\/\/localhost\/languages"}}

[Description of the bug or feature]

captura de tela em 2017-12-21 09-09-58

Wrong jad header type renders php merge error

Description

This
* @JAD\Header(type="work-wrong-type")

should have been:
* @JAD\Header(type="work-classification")

You get the following error:
{"errors":[{"status":"0","title":"Error Exception error","detail":"array_merge(): Argument #2 is not an array"}]}

Meta information

Description

Add relevant meta information (not specified).

When in pagination, total count, number of pages.

Includes should not require fetch="EAGER" in entities

Description

When including entities, Doctrine does not do the join due to lazy loading. This should not be required by JAD. If a entity is included, make Doctrine join in related table despite the entity's fetch option.

Filter Relations

Description

{{url}}:8000/api/jad/tracks?filter[tracks.albums][and][title][like]=taste

Above. Why is necessary filter[tracks.albums] instead of filter[albums]? I think everything is about Tracks entity.

[Description of the bug or feature]

Processing isNull and inNotNull in filters

Simple fix for the operation of filter parameters with isNull and isNotNull.
Now you can do something like this:
?filters[status][isNull]=status (or empty some string | empty value)
or
?filters[status][isNotNull]=status (or empty some string | empty value)

Result count is off when filtering

Description

Pagination and result count specifically does not take into account filtering properties and thus count is off (always counts total number of records).

Custom event handling

Description

Possibility to hook in event listeners to JAD before and after operations.

preRender(string $type, $id),
postRender(string $type, $id),
preFlush(string $type, $id),
postFlush(string $type, $id)

Serializer tries to serialize empty entities

Description

EntitySerializer tries to serialize even if the entity is empty.

In Serializers/EntitySerializer.php:87, fetching the relationship by type may return NULL or empty result set.

Charset decoding

When reading from endpoint /api/jad/customers/1 in demo:

"first-name": "Lu\u00eds",
"last-name": "Gon\u00e7alves"

Requirements not resolved to an installable set of packages

In order to get this to work with Symfony 4, the dependencies and if not the code needs to be updated to support the newer versions of symfony/http-foundation and not just 3.2 which it seems to be requesting.

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - oligus/jad v1.1.3 requires symfony/http-foundation ^3.2 -> no matching package found.
    - oligus/jad v1.1.2 requires symfony/http-foundation ^3.2 -> no matching package found.
    - oligus/jad v1.1.1 requires symfony/http-foundation ^3.2 -> no matching package found.
    - oligus/jad v1.1.0 requires symfony/http-foundation ^3.2 -> no matching package found.
    - Installation request for oligus/jad ^1.1 -> satisfiable by oligus/jad[v1.1.0, v1.1.1, v1.1.2, v1.1.3].

At least that's what I'm pretty sure the issue is.

Standalone example

Description

Hi Oli, kudos for a job well done! I have a question regarding standalone usage.
Let's assume that I have my router that takes Symfony\Component\HttpFoundation\Request and returns Symfony\Component\HttpFoundation\Response. Can you please tell me how can I can achieve something like that:

<?php

use Jad\Jad;
use Jad\Map\AnnotationsMapper;
use Jad\Request\JsonApiRequest;
use Jad\Request\Parameters;
use Jad\Response\JsonApiResponse;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

class JsonApiRouter
{
    public function __invoke(Request $request): Response
    {
        $parameters = new Parameters();
        $parameters->setArguments($request->query->all());

        $mapper = new AnnotationsMapper($this->getEm());
        
        $jsonApiRequest = new JsonApiRequest($request, $parameters);
        $jsonApiRequest->setPathPrefix('/json');

        $response = new JsonApiResponse($jsonApiRequest, $mapper);

        return $response->getRawResponse(); // this is what I miss :)
    }
}

Serializer getMeta

Automatically add meta data such as pagination information and counts

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.