/**
  * @param Post $post
  * @param Taxonomy $taxonomy
  */
 public function __construct(Post $post, Taxonomy $taxonomy)
 {
     parent::__construct();
     $this->set_id($post->get_id() . '-' . $taxonomy->get_id());
     $this->post = $post;
     $this->taxonomy = $taxonomy;
 }
 protected function do_create_array(Model $obj)
 {
     $batch = array();
     $user = $obj->get_creator();
     if ($user !== null) {
         $batch['post_author'] = $user->get_id();
     }
     $batch['post_date'] = $obj->get_date();
     $batch['post_date_gmt'] = $obj->get_date_gmt();
     $batch['post_content'] = '';
     $batch['post_title'] = $obj->get_title();
     $batch['post_status'] = $obj->get_status();
     $batch['comment_status'] = 'closed';
     $batch['ping_status'] = 'closed';
     $batch['post_modified'] = $obj->get_modified();
     $batch['post_modified_gmt'] = $obj->get_modified_gmt();
     $batch['guid'] = $obj->get_guid();
     $batch['post_type'] = 'sme_content_batch';
     return $batch;
 }
 /**
  * @param Model $obj
  * @return array
  */
 protected function do_create_array(Model $obj)
 {
     $parent = 0;
     if ($obj->get_parent() !== null) {
         $parent = $obj->get_parent()->get_id();
     }
     return array('post_author' => $obj->get_author(), 'post_date' => $obj->get_date(), 'post_date_gmt' => $obj->get_date_gmt(), 'post_content' => $obj->get_content(), 'post_title' => $obj->get_title(), 'post_excerpt' => $obj->get_excerpt(), 'post_status' => $obj->get_post_status(), 'comment_status' => $obj->get_comment_status(), 'ping_status' => $obj->get_ping_status(), 'post_password' => $obj->get_password(), 'post_name' => $obj->get_name(), 'to_ping' => $obj->get_to_ping(), 'pinged' => $obj->get_pinged(), 'post_modified' => $obj->get_modified(), 'post_modified_gmt' => $obj->get_modified_gmt(), 'post_content_filtered' => $obj->get_content_filtered(), 'post_parent' => $parent, 'guid' => $obj->get_guid(), 'menu_order' => $obj->get_menu_order(), 'post_type' => $obj->get_type(), 'post_mime_type' => $obj->get_mime_type(), 'comment_count' => $obj->get_comment_count());
 }
 /**
  * @param Model|Option $obj
  * @return array
  * @throws Exception
  */
 protected function do_create_array(Model $obj)
 {
     if (!$obj instanceof Option) {
         throw new Exception('Object must be of type \'Option\'');
     }
     return array('option_name' => $obj->get_name(), 'option_value' => $obj->get_value(), 'autoload' => $obj->get_autoload());
 }
 /**
  * @param Model $obj
  * @return array
  */
 protected function do_create_array(Model $obj)
 {
     return array('post_id' => $obj->get_post_id(), 'meta_key' => '', 'meta_value' => serialize(array('message' => $obj->get_message(), 'code' => $obj->get_code(), 'level' => $obj->get_level())));
 }
 /**
  * @param Model $obj
  * @return array
  */
 protected function do_create_array(Model $obj)
 {
     return array('name' => $obj->get_name(), 'slug' => $obj->get_slug(), 'term_group' => $obj->get_group());
 }
 /**
  * Constructor.
  */
 public function __construct($id = null)
 {
     parent::__construct((int) $id);
     $this->meta = array();
     $this->post_taxonomy_relationships = array();
 }
 /**
  * @param Model $obj
  * @return array
  */
 protected function do_create_array(Model $obj)
 {
     return array('user_login' => $obj->get_login(), 'user_pass' => $obj->get_password(), 'user_nicename' => $obj->get_nicename(), 'user_email' => $obj->get_email(), 'user_url' => $obj->get_url(), 'user_registered' => $obj->get_registered(), 'user_activation_key' => $obj->get_activation_key(), 'user_status' => $obj->get_status(), 'display_name' => $obj->get_display_name());
 }
 /**
  * @param Model $obj
  * @return array
  * @throws Exception
  */
 protected function do_create_array(Model $obj)
 {
     $parent = 0;
     if ($obj->get_parent() !== null) {
         if ($obj->get_parent()->get_term() !== null) {
             $parent = $obj->get_parent()->get_term()->get_id();
         }
     }
     $term = $obj->get_term();
     if (!$term instanceof Term) {
         throw new Exception('Taxonomy is missing a valid term.');
     }
     return array('term_id' => $term->get_id(), 'taxonomy' => $obj->get_taxonomy(), 'description' => $obj->get_description(), 'parent' => $parent, 'count' => $obj->get_count());
 }
Example #10
0
 /**
  * Constructor.
  *
  * @param int $id
  */
 public function __construct($id = null)
 {
     parent::__construct((int) $id);
     $this->meta_data = array();
     $this->posts = array();
     $this->attachments = array();
     $this->users = array();
     $this->post_rel_keys = array();
     $this->custom_data = array();
 }
 /**
  * @param Model $obj
  * @return array
  */
 protected function do_create_array(Model $obj)
 {
     return array('object_id' => $obj->get_post()->get_id(), 'term_taxonomy_id' => $obj->get_taxonomy()->get_id(), 'term_order' => $obj->get_term_order());
 }