Coder Social home page Coder Social logo

Comments (7)

cedriclombardot avatar cedriclombardot commented on August 16, 2024

Please set 4 ` to make a pre block your question would be easiest to read.

timestampseems not be a good type http://www.doctrine-project.org/docs/orm/2.0/en/reference/basic-mapping.html, you've to use datetime

datetime: Type that maps an SQL DATETIME/TIMESTAMP to a PHP DateTime object.

from admingeneratorgeneratorbundle.

suncat2000 avatar suncat2000 commented on August 16, 2024

I am read this part of doctrine doc, but i need use PostgreSQL, in which no 'datetime' type.
Use of 2 fields: 'date' and 'time'? Not gracefully...
Especially if the entity has:

  • creation date
  • date of change
  • date start of activity
  • date end of activity

from admingeneratorgeneratorbundle.

cedriclombardot avatar cedriclombardot commented on August 16, 2024

I don t know how doctrine will store your timestamp type but you can overwrite the dbType option for the field telling at the admingenerator thats a datetime. If you find a documentation or code about doctrine and timestamp i could include this field into the guesser to determine it automatically

from admingeneratorgeneratorbundle.

suncat2000 avatar suncat2000 commented on August 16, 2024

New experiment:
From My.orm.yml:

...
fields:
    is_published:
        type: boolean
    date_create:
        type: datetime
    date_change:
        type: datetime
...

Create entity and update schema. In db fields (date_create, date_change) 'timestamp' type.
After fixtures:load in this fields i have strings in format: 2011-09-27 00:10:10.

When trying to display a list of entities that get the exception:

An exception has been thrown during the rendering of a template ("Catchable Fatal Error: Object of class DateTime could not be converted to string in ../app/cache/dev/twig/7c/bf/b46427bd1f75816d1dedbe6c2164.php line 336") in "Admingenerated/AdminTextBundle/Resources/views/TextList/index.html.twig" at line 136.

It string (136):

{% block list_td_column_date_create %}{{ Text.dateCreate }}{% endblock %}

from admingeneratorgeneratorbundle.

cedriclombardot avatar cedriclombardot commented on August 16, 2024

I'll try this but i think thats because the list haven't recognize the type "date" and fallback to default

from admingeneratorgeneratorbundle.

cedriclombardot avatar cedriclombardot commented on August 16, 2024

Ok should work now

from admingeneratorgeneratorbundle.

suncat2000 avatar suncat2000 commented on August 16, 2024

Its work, thanks

from admingeneratorgeneratorbundle.

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.