/**
  * get single GameUserItems instance from a DOMElement
  *
  * @param DOMElement $node
  * @return GameUserItems
  */
 public static function fromDOMElement(DOMElement $node)
 {
     $o = new GameUserItems();
     $o->assignByHash(self::domNodeToHash($node, self::$FIELD_NAMES, self::$DEFAULT_VALUES, self::$FIELD_TYPES));
     $o->notifyPristine();
     return $o;
 }
Esempio n. 2
0
 public static function getUserItem($userId, $itemCode)
 {
     if (!empty($userId) && !empty($itemCode)) {
         $items = GameUserItems::findByExample(DBUtils::getConnection(), GameUserItems::create()->setItemCode($itemCode)->setUserId($userId));
         if (!empty($items)) {
             if (is_array($items) && sizeof($items) > 0) {
                 return $items[0];
             } else {
                 return $items;
             }
         }
     }
     return null;
 }