<?php
class Project_Model_UserProfile_Repository extends Zf_Domain_Repository
{
/* @var Project_Dao_Db_UserProfile */
private $userProfileDao;
/* @var array IoC Spec */
private $inject = array(
'userProfileDao' => 'Project_Dao_Db_UserProfile'
);
public function getUserByUserId($id)
{
// Project_Dao_Db_UserProfile joins the User and Profile tables
$row = $this->getUserProfileDao()->findByUserId($id);
$user = new Project_Model_User();
$user->setId($row['id']);
$user->setName($row['name']);
$profile = new Project_Model_Profile($row);
$user->setProfile($profile);
return $user;
}
public function getUserByProfileId($id)
{
// Project_Dao_Db_UserProfile joins the User and Profile tables
$row = $this->getUserProfileDao()->findByProfileId($id);
$user = new Project_Model_User();
$user->setId($row['id']);
$user->setName($row['name']);
$profile = new Project_Model_Profile($row);
$user->setProfile($profile);
return $user;
}
}