Skip to content

Gedmo Unrecognized field: createdAt - Error! #599

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
safaksaylam opened this issue Aug 2, 2017 · 4 comments
Closed

Gedmo Unrecognized field: createdAt - Error! #599

safaksaylam opened this issue Aug 2, 2017 · 4 comments

Comments

@safaksaylam
Copy link

safaksaylam commented Aug 2, 2017

Hi,
I use to Gedmo TimestampableEntity. And I didn't serializer object to json.
HTTP 500 Internal Server Error - Unrecognized field: createdAt

User Class Example:

class User extends \DPX\AdminBundle\Model\User
{
    use TimestampableEntity, SoftDeleteableEntity;
    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @var string
     *
     * @ORM\Column(name="username", type="string", length=255, unique=true)
     */
    protected $username;

Action Example
$this->get('jms_serializer')->serialize($user, 'json')

Config Yaml added handlers

jms_serializer:
    handlers:
        datetime:
            default_format: "c"
            default_timezone: "UTC"`

I added JMS Type DateTime in TimestampableEntity createdAt and updatedAt. But It doesn't work. How can i fixed?

@goetas
Copy link
Collaborator

goetas commented Aug 2, 2017

please clear your cache directory

@goetas goetas closed this as completed Aug 2, 2017
@safaksaylam
Copy link
Author

safaksaylam commented Aug 2, 2017

I cleared cache. But it doesn't work. @goetas

@goetas
Copy link
Collaborator

goetas commented Aug 2, 2017

can you post the full stack-trace for the exception?

@safaksaylam
Copy link
Author

I can fixed. Problem is ORM\OrderBy doesn't work with serializer.

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