User "NeilK" posted a comment on MediaWiki.r99619.

Full URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/99619#c24455
Commit summary:

Follow up to r99618; matching fix made in contest extension

Comment:

This code seems a bit confused. 

What is the authoritative way to show that we definitely have an existing 
campaign -- is it the presence of an id, or a name? Why both?

The paradigm you have of creating a new object when you want to update an 
existing one is very counterintuitive. Wouldn't it be better to do something 
like this:

if ( we got an id ) {
   $campaign = get the campaign identified by that id
} else {
   $campaign = new campaign // or better yet the form should somehow specify 
that you want a new campaign, rather than relying on the absence of stuff
}

$campaign->setEnabled($enabled);
$campaign->setData($data);

$campaign->writeToDB();


_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview

Reply via email to