Logging with Timestamps and Doctrine Event Listeners

February 12th, 2010

This short video is going to be the last in my 2009-2010 series on Doctrine 1.2. I’m wrapping it up with a little example of adding timestamps, logging and using Doctrine’s event listener architecture.

Grab a copy of the project or browse the repository.

ServerGrove will be sponsoring 3 videos this month! ServerGrove specializes in Zend Framework hosting and they’ve offered a 10% rebate on hosting with coupon code “zc”. If you’re looking for a host, be sure to check them out (referral). They’ve also added an additional coupon for “Mini Hosting” plans, get $2 off by using code “zcmini”.

 

discuss video in the forum

6 Responses to “Logging with Timestamps and Doctrine Event Listeners”

  1. milan l. says:

    Thanks for great video. Can’t wait for vids about doctrine 2.0!

  2. [...] ZendCasts.com site has recently posted a quick video covering logging and Doctrine event listeners in a Zend Framework application. This short video is going to be the last in my 2009-2010 series [...]

  3. Insight says:

    sorry, why schema.yml doesn’t have information about createAt & so on data?

  4. matze says:

    Very good screencast!

    I’ve got a little problem with it. On my local sever the project works.
    But when I try to install it on my live webserver I get an error, building the database with “./doctrine build-all-reload”:
    ———————————————
    ./doctrine build-all-reload
    X-Powered-By: PHP/5.2.9
    Content-type: text/html

    build-all-reload – Are you sure you wish to drop your databases? (y/n)
    build-all-reload – Successfully cancelled
    Couldn’t write file /srv/htdocs/doctrine-event-listeners/application/models//Base/User.php
    ———————————————

    The question is: Why is there a double slash between “models” and “Base”? Because the models path doesn’t end with a slash. This must be caused by doctrine, because if I dump the path in front of “$cli->run($_SERVER['argv'];” I get it the right way.
    Anyone got the same problem and solved it?

    Greets

  5. mysticav says:

    I’m gonna try it. I would like to know what data the event parameter contains. Because it is very important to know what kind of action occurred:

    creation, update, delete. etc.

  6. JohnB says:

    In schema.yml for Log to really create and use just the createdAt column you have to explicitly specify that you don;t want an update column:
    updated:
    disabled: true

    more on that here:
    http://www.doctrine-project.org/documentation/manual/1_0/ru/behaviors#core-behaviors:timestampable

Leave a Reply

Desktop RSS feed iPhone + iPod