original_string: public static function firstOrNew($id)
      {
          if ($entity = self::getDataMapperInstance()->first($id)) {
              return $entity;
          }
  
          $entity = new static();
          $entity->_id = $id;
  
          return $entity;
      }
code: public static function firstOrNew($id)
      {
          if ($entity = self::getDataMapperInstance()->first($id)) {
              return $entity;
          }
  
          $entity = new static();
          $entity->_id = $id;
  
          return $entity;
      }
code_tokens: public static function firstOrNew ( $ id ) { if ( $ entity = self :: getDataMapperInstance ( ) -> first ( $ id ) ) { return $ entity ; } $ entity = new static ( ) ; $ entity -> _id = $ id ; return $ entity ; }
docstring: Gets the first entity of this kind that matches the query. If no
  document was found, a new entity will be returned with the
  _if field filled.
  
  @param mixed $id document id
  
  @return ActiveRecord
docstring_tokens: Gets the first entity of this kind that matches the query . If no document was found a new entity will be returned with the _if field filled .