Skip to content

User defined ordering function #379

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
ogizanagi opened this issue Dec 31, 2014 · 1 comment
Closed

User defined ordering function #379

ogizanagi opened this issue Dec 31, 2014 · 1 comment

Comments

@ogizanagi
Copy link

Hi there.

Many thanks for the amazing work on this library.

I wonder if a custom user defined ordering function might be useful ?
Concrete case: All my entities use a TimestampableTrait (very similar to the one provided by DoctrineExtensions), adding both createdAt and updatedAt fields. Those fields are declared with proper annotations in order to allow serialization. (VirtualProperty on a custom method or Expose directly on the trait properties).

As for readability, the traits use is declared at the top of my entities, without any defined order policy (ACCESSOR_ORDER_UNDEFINED), this results in the fact that created_at and updated_at fields are always before any other fields after serialization.

For this use case, the aim is to provide a way to use a custom ordering function, which will always put created_at and updated_at fields at the bottom.

I think there might be some other use cases.

What do you think ?

Note: I guess VirtualProperty are still ignored as mentioned in the #349. So, this will only work for properties for now.

@goetas
Copy link
Collaborator

goetas commented Apr 24, 2017

Closing, Sorry for the long feedback loop.

This can be already solved with http://jmsyst.com/libs/serializer/master/reference/annotations#accessororder

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

2 participants