Re: [symfony-users] DoctrineExtensions Timestampable with mongodb

2011-06-04 Thread Gediminas Morkevicius
hi, you can simply use: https://github.com/stof/DoctrineExtensionsBundle
read the doc in this bundle on how to configure it. It should work smoothly,
have fun :)

On Sat, Jun 4, 2011 at 1:03 PM, amit  wrote:

> Hi,
>  I am following the instructions as given here
>
> http://www.gediminasm.org/article/timestampable-behavior-extension-for-doctrine-2
>
>  I have symfony2 and mongoDB working fine and now I wanted to use
> Timestampable using DoctrineExtensions
>
>  Can someone please tell me how do I register the listener? I just
> started with symfony2 two days back so any pointer will be
> appreciated.
>
> I am using following in config.yml is this correct?
>
> services:
>  timestamble.listener:
>class: Gedmo\Timestampable\TimestampableListener
>tags:
>- { name: doctrine.event_subscriber }
>
> I have following in my document
> /**
> * @mongodb:Field(type="timestamp")
> *
> * @gedmo:Timestampable(on="create")
> */
>private $createdAt;
>
>/**
> * @mongodb:Field(type="timestamp")
> *
> * @gedmo:Timestampable
> */
>private $updatedAt;
>
> and I am updating the record as following:
> $user = new User();
>$user->setName('Amit');
>
>$dm = $this->get('doctrine.odm.mongodb.document_manager');
>//$dm->getEventManager()->addEventSubscriber(new
> TimestampableListener()); - I tried this but this gives an exception
> complaining the .scm.yml mapping file is not present.
>$dm->persist($user);
>$dm->flush();
>
>  so far I am not getting createdAt/updatedAt data.
>
> Kindly help
>
> --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to symfony-users@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] DoctrineExtensions Timestampable with mongodb

2011-06-04 Thread amit
Hi,
 I am following the instructions as given here
http://www.gediminasm.org/article/timestampable-behavior-extension-for-doctrine-2

 I have symfony2 and mongoDB working fine and now I wanted to use
Timestampable using DoctrineExtensions

 Can someone please tell me how do I register the listener? I just
started with symfony2 two days back so any pointer will be
appreciated.

I am using following in config.yml is this correct?

services:
  timestamble.listener:
class: Gedmo\Timestampable\TimestampableListener
tags:
- { name: doctrine.event_subscriber }

I have following in my document
/**
 * @mongodb:Field(type="timestamp")
 *
 * @gedmo:Timestampable(on="create")
 */
private $createdAt;

/**
 * @mongodb:Field(type="timestamp")
 *
 * @gedmo:Timestampable
 */
private $updatedAt;

and I am updating the record as following:
$user = new User();
$user->setName('Amit');

$dm = $this->get('doctrine.odm.mongodb.document_manager');
//$dm->getEventManager()->addEventSubscriber(new
TimestampableListener()); - I tried this but this gives an exception
complaining the .scm.yml mapping file is not present.
$dm->persist($user);
$dm->flush();

 so far I am not getting createdAt/updatedAt data.

Kindly help

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en