Ejemplo n.º 1
0
 public function fixPostAction()
 {
     echo 'fix posts' . PHP_EOL;
     $postTbl = new Book_Model_DbTable_Posts();
     $postSelect = $postTbl->select()->where('rawpost_id > 0');
     $postSelect->limit(200);
     $rawPostIds = array();
     $posts = $postTbl->fetchAll($postSelect);
     echo 'number of posts : ' . count($posts) . PHP_EOL;
     foreach ($posts as $post) {
         array_push($rawPostIds, $post->rawpost_id);
     }
     $rawPostTbl = new Book_Model_DbTable_Rawposts();
     $rawPostTbl->delete(array('rawpost_id IN (?)' => $rawPostIds));
     foreach ($posts as $post) {
         $post->delete();
     }
     echo 'The posts have been deleted !' . PHP_EOL;
     die;
 }