# HG changeset patch # User clebeaupin # Date 1269857696 -7200 # Node ID 7de8d597588b5d96189ccd56fa209feb328c1f45 # Parent 4427c90bd892166094f698137d6484b89d3ae199 add event on models to index in solr diff -r 4427c90bd892 -r 7de8d597588b web/thdProject/apps/frontend/modules/test/actions/actions.class.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/thdProject/apps/frontend/modules/test/actions/actions.class.php Mon Mar 29 12:14:56 2010 +0200 @@ -0,0 +1,19 @@ +setRef('012056'); + $film->setTitle('Film test'); + $film->setPitch('Pitch test'); + $film->setDuration(8592); + $film->setDirectors(''); + $film->setActors(''); + $film->setSlugUrl(''); + $film->setOriginalTitle('Original title'); + $film->setProductionCountries(''); + $film->setProductionYear(5859); + $film->save(); + } +} diff -r 4427c90bd892 -r 7de8d597588b web/thdProject/config/ProjectConfiguration.class.php --- a/web/thdProject/config/ProjectConfiguration.class.php Wed Mar 24 19:04:36 2010 +0100 +++ b/web/thdProject/config/ProjectConfiguration.class.php Mon Mar 29 12:14:56 2010 +0200 @@ -16,4 +16,8 @@ { $this->enableAllPluginsExcept(array('sfPropelPlugin', 'sfCompat10Plugin')); } + + public function configureDoctrineConnection(Doctrine_Connection $conn) { + $conn->addRecordListener(new ThdDoctrineListener()); + } } diff -r 4427c90bd892 -r 7de8d597588b web/thdProject/lib/model/doctrine/ThdDoctrineListener.class.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/thdProject/lib/model/doctrine/ThdDoctrineListener.class.php Mon Mar 29 12:14:56 2010 +0200 @@ -0,0 +1,18 @@ +getInvoker(); + + // Index in solr + sfContext::getInstance()->getLogger()->info("Insert object. Index in solr"); + } + + public function postUpdate(Doctrine_Event $event) { + $obj = $event->getInvoker(); + + // Reindex in solr + sfContext::getInstance()->getLogger()->info("Update object. Reindex in solr"); + } +} \ No newline at end of file