Exemplo n.º 1
0
 /**
  * Create and initialize an object.
  *
  * <code>
  * $options = array(
  *     "project_id" => 1,
  *     "state" => Prism\Constants::PUBLISHED
  * );
  *
  * $rewards   = Crowdfunding\Rewards::getInstance(\JFactory::getDbo(), $options);
  * </code>
  *
  * @param \JDatabaseDriver $db
  * @param array            $options
  *
  * @return null|self
  */
 public static function getInstance(\JDatabaseDriver $db, $options = array())
 {
     $projectId = !isset($options["project_id"]) ? 0 : $options["project_id"];
     if (!isset(self::$instances[$projectId])) {
         $item = new Rewards($db);
         $item->load($options);
         self::$instances[$projectId] = $item;
     }
     return self::$instances[$projectId];
 }
Exemplo n.º 2
0
 /**
  * Create and initialize an object.
  *
  * <code>
  * $options = array(
  *     "project_id" => 1,
  *     "state" => Prism\Constants::PUBLISHED
  * );
  *
  * $rewards   = Crowdfunding\Rewards::getInstance(\JFactory::getDbo(), $options);
  * </code>
  *
  * @param \JDatabaseDriver $db
  * @param array            $options
  *
  * @return null|self
  */
 public static function getInstance(\JDatabaseDriver $db, array $options = array())
 {
     $projectId = !array_key_exists('project_id', $options) ? 0 : (int) $options['project_id'];
     if (!array_key_exists($projectId, self::$instances)) {
         $item = new Rewards($db);
         $item->load($options);
         self::$instances[$projectId] = $item;
     }
     return self::$instances[$projectId];
 }
Exemplo n.º 3
0
 /**
  * Return all project rewards.
  *
  * <code>
  * $rewardsOptions = array(
  *  "project_id" => 1
  *  "state" => Prism\Constants::PUBLISHED
  * );
  *
  * $project   = new Crowdfunding\Project(\JFactory::getDbo());
  * $project->load($rewardsOptions);
  *
  * $rewards = $project->getRewards($rewardsOptions);
  * </code>
  *
  * @param array $options
  *
  * @return Rewards
  */
 public function getRewards(array $options = array())
 {
     if ($this->rewards === null) {
         $options['project_id'] = (int) $this->id;
         $this->rewards = Rewards::getInstance($this->db, $options);
     }
     return $this->rewards;
 }
Exemplo n.º 4
0
 /**
  * Return all project rewards.
  *
  * <code>
  * $rewardsOptions = array(
  *  "project_id" => 1
  *  "state" => Prism\Constants::PUBLISHED
  * );
  *
  * $project   = new Crowdfunding\Project(\JFactory::getDbo());
  * $project->load($rewardsOptions);
  *
  * $rewards = $project->getRewards($rewardsOptions);
  * </code>
  *
  * @param array $options
  *
  * @return Rewards
  */
 public function getRewards($options = array())
 {
     if (is_null($this->rewards)) {
         $options["project_id"] = $this->id;
         $this->rewards = Rewards::getInstance($this->db, $options);
     }
     return $this->rewards;
 }