/** * Returns a domain model that matches a given identity * * @param array $identity A hash of fieldname => value to use to identify the model * @param BaseDomainModel * @return BaseDomainModel */ public function find($identity, BaseDomainModel $model) { $sql = "SELECT * FROM `%s` WHERE %s"; list($whereCondition, $bindings) = $this->getIdentityCondition($identity); $findSql = sprintf($sql, $this->tableName, $whereCondition); $row = $this->db->fetchRow($findSql, $bindings); return $row ? $model->__load($row) : null; }