protected static function getInstance($row) { if (!$row instanceof stdClass) { show_error("El row debe ser una instancia de stdClass."); } $object = new self(); $object->id = isset($row->donation_id) ? $row->donation_id : 0; $object->userId = isset($row->user_id) ? $row->user_id : ''; $object->publicationId = isset($row->publication_id) ? $row->publication_id : ''; //CI_Publication::getById($row->publication_id) : ''; $object->donationDate = isset($row->donation_date) ? $row->donation_date : ''; $object->processState = isset($row->process_state_id) ? CI_ProcessState::getById($row->process_state_id) : ''; $object->donatedObjects = isset($row->publication_id) ? CI_DonatedObject::getByDonationId($row->donation_id) : ''; return $object; }
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; }
public static function getInstance($row) { if (!$row instanceof stdClass) { show_error("El row debe ser una instancia de stdClass."); } $offer = parent::getInstance($row); $offer->processStateOffer = CI_ProcessState::getById($row->process_state_offer); $offer->type = CI_OfferType::getById($row->offer_type_id); $offer->quantityUsersToPaused = isset($row->quantity_users_to_paused) ? $row->quantity_users_to_paused : ''; $offer->favorites = CI_Offer::getFavorite($row->publication_id); return $offer; }