https://bugzilla.wikimedia.org/show_bug.cgi?id=64873

            Bug ID: 64873
           Summary: Restore convenience functions for setting labels, etc
           Product: MediaWiki extensions
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: WikidataRepo
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
       Web browser: ---
   Mobile Platform: ---

As of the introduction of the Fingerprint class, the setLabel, setDescription
etc functions are now deprecated. This means that the preferred way to set a
label is now:

    $fingerprint = $item->getFingerprint();
    $fingerprint->setLable( new Term( 'en', 'Foo' ) );
    $item->setFingerprint( $fingerprint );

Compare top the previous:

    $item->setLabel( 'en', 'Foo' );

That's quite verbose and hard to read, and it's even unclear/undocumented
whether the setFingerprint is needed, or whether manipulating the Fingerprint
object returned by getFingerprint is sufficient.

I suggest to restore the convenience functions at least for
adding/setting/removing labels, descriptions, and aliases. They should just
wrap the respective functionality in Fingerprint. 

The situation for getting a label or a list of aliases has also become more
complicated, and should probably be improved:

    $label = $item->getFingerprint()->getLabel( 'en' )->getText();
    $aliases = $item->getFingerprint()->getAliasGroup( 'en' )->getAliases();

instead of before: 

    $label = $item->getLabel( 'en' );
    $aliases = $item->getAliases( 'en' );

I see the benefit of using composition for the fingerprint; I do not see the
benefit of deprecating the convenience functions. The new way just makes
reading harder by adding redundant noise.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to