Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6792277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:56:58+00:00 2026-05-26T17:56:58+00:00

I’m having problems with the Timestampable functionality in Doctrine 1.2.2 and 1.2.3. The error

  • 0

I’m having problems with the Timestampable functionality in Doctrine 1.2.2 and 1.2.3.

The error I get on trying to save() my Record is:

Uncaught exception ‘Doctrine_Validator_Exception’ with message ‘Validation failed in class XXX 1 field had validation error: * 1 validator failed on created_at (unsigned) ‘ in …

I’ve created the relevant field in the MySQL table as:

created_at DATETIME NOT NULL,

Then in setTableDefinition() I have:

    $this->hasColumn('created_at', 'timestamp', null, array(
         'type' => 'timestamp',
         'fixed' => false,
         'unsigned' => false,
         'primary' => false,
         'notnull' => true,
         'autoincrement' => false,
         ));

Which is taken straight from the output of generateModelsFromDb().

And finally my setUp() looks like:

public function setUp()
{
    parent::setUp();
    $this->actAs('Timestampable', array(
                                    'created' => array(
                                                    'name' => 'created_at',
                                                    'type' => 'timestamp',
                                                    'format' => 'Y-m-d H:i:s',
                                                    'disabled' => false,
                                                    'options' =>  array()
                                  ),
                                    'updated' => array(
                                                    'disabled' => true
                                  )));
}

(I’ve tried not defining all of those fields for ‘created’, but I get the same problem.)

I’m a bit stumped as to what I’m doing wrong – for one thing I can’t see why Doctrine would be running any unsigned checks against a ‘timestamp’ datatype…

Updated

I’m on Debian Lenny (5.0.8) with MySQL (5.0.51a-24+lenny5O). The problem is occurring with Doctrine 1.2.3 and 1.2.2. I noticed that Doctrine’s examples use TIMESTAMP MySQL columns rather than DATETIMEs, so I changed that and re-generated, but the problem still recurred. I also thought it might be a problem with the MySQL definition, so I ran generateSqlFromModels to get the right SQL, but that was fine too (DATETIME NOT NULL).

I’m totally stumped – have logged a bug in Doctrine JIRA to see if I can get this figured out: DC-965

Any help gratefully received!

Alex

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:56:58+00:00Added an answer on May 26, 2026 at 5:56 pm

    Yesss solved on my case!
    And hopefully on your case as well!

    When I started the project I worked on, I wanted by default all my columns to be:

    notnull: true
    unsigned: true
    

    which you can set in yml config files in symfony or with plain php like:
    $manager->setAttribute(Doctrine::ATTR_DEFAULT_COLUMN_OPTIONS, array(‘notnull’ => true, ‘unsigned’ => true));

    And of course unsigned attribute DOES NOT get applied in the database for string columns right?
    Which made me assume Doctrine wouldn’t care either about it… WRONG

    When you activate Validators: http://www.doctrine-project.org/projects/orm/1.2/docs/manual/component-overview/pl#validator, Doctrine tries to validate that string column, or timestamp/datime column with an unsigned validator!

    On my case removing that default column attribute solved it. And if you haven’t set defaults then maybe you should set unsigned as False using that method and then do it per column in your model definition where you need it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to create an if statement in PHP that prevents a single post
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.