/**
  * Add WordPress options to batch.
  *
  * @param Batch $batch
  */
 private function add_options(Batch $batch)
 {
     // Check if options should be included with this batch.
     $include_options = get_post_meta($batch->get_id(), '_sme_include_wp_options', true);
     if ($include_options !== 'yes') {
         return;
     }
     $options = $this->option_dao->get_options_to_sync();
     $batch->set_options($options);
 }
 /**
  * @param array $raw
  * @return Batch
  */
 protected function do_create_object(array $raw, $args = array())
 {
     $obj = new Batch($raw['ID']);
     $user = $this->user_dao->find($raw['post_author']);
     $obj->set_guid($raw['guid']);
     $obj->set_title($raw['post_title']);
     $obj->set_creator($user);
     $obj->set_date($raw['post_date']);
     $obj->set_date_gmt($raw['post_date_gmt']);
     $obj->set_modified($raw['post_modified']);
     $obj->set_modified_gmt($raw['post_modified_gmt']);
     $obj->set_status($raw['post_status']);
     // Skip loading batch content?
     $skip_content = isset($args['skip_content']) ? $args['skip_content'] : false;
     $content = $this->get_batch_content($raw, $skip_content);
     $content = unserialize(base64_decode($content));
     /*
      * Previously $content would have contained a Batch object. This check
      * deals with legacy batches.
      */
     if (!is_array($content)) {
         $content = array();
     }
     if (isset($content['attachments'])) {
         $obj->set_attachments($content['attachments']);
     }
     if (isset($content['users'])) {
         $obj->set_users($content['users']);
     }
     if (isset($content['posts'])) {
         $obj->set_posts($content['posts']);
     }
     if (isset($content['options'])) {
         $obj->set_options($content['options']);
     }
     if (isset($content['custom_data'])) {
         $obj->set_custom_data($content['custom_data']);
     }
     if (isset($content['post_rel_keys'])) {
         $obj->set_post_rel_keys($content['post_rel_keys']);
     }
     return $obj;
 }