why would it throw an exception if your result set is empty?
User::find( $id ) throws an exception if the row with primary key == $id doesn't exist, so why should the functionality be different for equally-strong searches on another field? If I switched "email" to the primary key, I would get an exception.
In fact, if I change that call in any way to break it:
$user = User::find( 'first', array( 'conditions' => array( 'emails=?', $this->params->login_email ) ) );
$user = User::find( 'first', array( 'condition' => array( 'email=?', $this->params->login_email ) ) );
$user = User::find( 'firsts', array( 'conditions' => array( 'email=?', $this->params->login_email ) ) );
I get a meaningful exception, based on which I can control execution flow. Running a query that results in an empty set is--by definition--an exceptional event, so I don't understand why it wouldn't also throw an exception.
My experience with ActiveRecord in rails is limited; is this how the functionality works there? Maybe my complaint is just too uninformed :)
(1-2/2)
Subject: Troubles with finders
The following code:
$user = User::find( 'first', array( 'conditions' => array( 'email=?', $this->params->login_email ) ) );
Does not throw an exception and also does not return any results. There is no record in the database that matches the conditions. How am I supposed to know if I'm getting anything back from ::find?!