Propel and Primary keys

Today I was writing an administrator backend for a project we have. I had the code:

$old_feeds=RssFeedRelationPeer::doSelect($c);
if(count($old_feeds)>0){
   foreach ($old_feeds as $old) $old->delete();
}

I was trying to remove some old foreign constraints before I deleted the main object, however, for the longest time the “$old” objects were not deleting, but no errors were being thrown. I did the usual debugging, added a die() statement inside the count, it was going there. I added a die statement in the foreach, it went there. I thought, “It must not be pulling the right ‘old’ objects.” I then added a $old->getName(); to see exactly what objects it was going through-they were the right ones. It made no sense. I next tired after the $old->delete();to add a $old->save();. The error I received was “You cannot save an object that has been deleted.” This didn’t make sense, since the object was still in the database. It hit me then, I had this problem in the past. Propel hates tables without primary keys. I quickly just added a simple primary key to the model, and the delete statements worked.

Moral: If dealing with Propel and you are getting some unexpected behavior, with zero errors, check to see if you have a primary key; it may save you hours of head banging.

Launched Wikia Evolution!

So I spent the summer working over at Wikia Inc as an engineer on their search project – http://re.search.wikia.com

Last month I wrote a Firefox 3.0 extension which launched yesterday – https://addons.update.mozilla.org/en-US/firefox/addon/8267

From the official Wikia blog:

One of our core values at Wikia Search is Community. We want everyone to be able to participate in the Wikia Search project. That’s why we are proud to introduce Wikia Evolution, our new Firefox toolbar. You can download it here, or via Mozilla’s Firefox Add-On Library.

The mission of Wikia Evolution: To empower users to interact with search.

We want to make it dead-simple for you to add URLs into our index under appropriate keywords. Already, we’re the cutting edge when it comes to incorporating user feedback into our search results, so much so that Google is experimenting with eerily similar features. Wikia Evolution pushes the envelope even further. It allows you to quickly and easily add the web page you are on into Wikia Search, directly from your browser, for whatever keyword is appropriate. Instant indexing! Then, you can modify the search result to make it really killer, all without leaving the page you’re on.

The release was even covered by Techcrunch!

http://www.techcrunch.com/2008/08/06/wikia-evolution-to-help-suck-search-data-from-google-yahoo/

Like everything at Wikia, the toolbar is open source. A public SVN is up at http://people.swlabs.org/~bartek/websvn/listing.php?repname=SearchUI&path=%2Fcool%2Ftoolbar%2F and you can download the code from the Mozilla add-ons site.