public static function getByPublicationId($publicationId) { $CI =& get_instance(); $CI->load->model('sponsor_model'); $results = $CI->sponsor_model->getByPublicationId($publicationId); $return = array(); if (!empty($results)) { foreach ($results as $result) { $return[] = CI_Sponsor::getInstance($result); } } return $return; }
public static function getInstance($row) { if (!$row instanceof stdClass) { show_error("El row debe ser una instancia de stdClass."); } $request = parent::getInstance($row); $request->votes = CI_Request::getVote($row->publication_id); $request->favorites = CI_Request::getFavorite($row->publication_id); $request->amountCollected = CI_Request::getAmountCollectedById($row->publication_id); $request->quantityDonated = CI_Request::getQuantityDonatedById($row->publication_id); $request->sponsors = CI_Sponsor::getByPublicationId($row->publication_id); if (isset($row->isVote)) { $request->isVote = $row->isVote; } return $request; }