Created
August 28, 2014 18:10
-
-
Save chartjes/18e8c5cc31626319c13d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace OpenCFP\Entity\Mapper; | |
use Spot\Mapper; | |
class User extends Mapper | |
{ | |
/** | |
* Return an array that grabs info from the User and Speaker entities | |
* | |
* @param integer $user_id | |
* @return array | |
*/ | |
public function getDetails($user_id) | |
{ | |
$user = $this->all() | |
->where(['id' => $user_id]) | |
->with(['speaker']) | |
->limit(1); | |
return [ | |
'photo_path' => $user[0]->photo_path, | |
'first_name' => $user[0]->first_name, | |
'last_name' => $user[0]->last_name, | |
'airport' => $user[0]->airport, | |
'email' => $user[0]->email, | |
'twitter' => $user[0]->twitter, | |
'bio' => $user[0]->speaker->bio, | |
'info' => $user[0]->speaker->info, | |
'transportation' => $user[0]->transportation, | |
'hotel' => $user[0]->hotel | |
]; | |
} | |
} |
If you have access to the statement obj, just do a return $stmt-->fetch()
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This could probably be better done like this: