/** * @param int|array $keys * @return bool */ public function load( $keys = null ) { if ( is_array( $keys ) ) { return false; } $this->_post->load( (int) $keys ); if ( ! $this->_post->exists() ) { $this->_post->set( 'id', 0 ); } $this->post( $this->_post ); return true; }
/** * Returns KunenaForumMessage object. * * @param null $identifier The message to load - Can be only an integer. * @param bool $reload * * @return KunenaForumMessage The message object. */ static public function get($identifier = null, $reload = false) { if ($identifier instanceof KunenaForumMessage) { return $identifier; } $id = (int) $identifier; if ($id < 1) { return new KunenaForumMessage; } if (empty(self::$_instances[$id])) { $instance = new KunenaForumMessage; // Only load messages which haven't been preloaded before (including missing ones). $instance->load(!array_key_exists($id, self::$_instances) ? $id : null); $instance->id = $id; self::$_instances[$id] = $instance; } elseif ($reload) { self::$_instances[$id]->load(); } return self::$_instances[$id]; }