public static function getInstance($row)
 {
     if (!$row instanceof stdClass) {
         show_error("El row debe ser una instancia de stdClass.");
     }
     $subcategory = new CI_Subcategory();
     $subcategory->id = isset($row->subcategory_id) ? $row->subcategory_id : 0;
     $subcategory->category = isset($row->category_id) ? CI_Category::getById($row->category_id) : '';
     $subcategory->description = isset($row->description) ? $row->description : '';
     $subcategory->commonState = isset($row->common_state_id) ? CI_CommonState::getById($row->common_state_id) : '';
     return $subcategory;
 }
 protected static function getInstance($row)
 {
     if (!$row instanceof stdClass) {
         show_error("El row debe ser una instancia de stdClass.");
     }
     $publication = new stdClass();
     $publication->id = isset($row->publication_id) ? $row->publication_id : 0;
     $publication->title = isset($row->title) ? $row->title : '';
     $publication->description = isset($row->description) ? $row->description : '';
     $publication->category = isset($row->category_id) ? CI_Category::getById($row->category_id) : '';
     $publication->subcategory = isset($row->subcategory_id) ? CI_Subcategory::getById($row->category_id, $row->subcategory_id) : '';
     $publication->object = isset($row->object_id) ? CI_Object::getById($row->object_id) : '';
     $publication->quantity = isset($row->quantity) ? $row->quantity : '';
     $publication->views = isset($row->views) ? $row->views : '';
     $publication->processState = isset($row->process_state_id) ? CI_ProcessState::getById($row->process_state_id) : '';
     $publication->creationDate = isset($row->creation_date) ? $row->creation_date : '';
     $publication->expirationDate = isset($row->expiration_date) ? $row->expiration_date : '';
     $publication->image = isset($row->publication_id) ? CI_Image::getByPublicationId($row->publication_id) : '';
     if (isset($row->isFavorite)) {
         $publication->isFavorite = isset($row->isFavorite) ? $row->isFavorite : '';
     }
     if (isset($row->isOwner)) {
         $publication->isOwner = isset($row->isOwner) ? $row->isOwner : '';
     }
     if (isset($row->user_id)) {
         $publication->userId = isset($row->user_id) ? $row->user_id : '';
     }
     return $publication;
 }