本文整理匯總了PHP中Teacher::setPerson方法的典型用法代碼示例。如果您正苦於以下問題:PHP Teacher::setPerson方法的具體用法?PHP Teacher::setPerson怎麽用?PHP Teacher::setPerson使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Teacher
的用法示例。
在下文中一共展示了Teacher::setPerson方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: createTeacher
public function createTeacher(PropelPDO $con = null)
{
$con = is_null($con) ? Propel::getConnection() : $con;
$teacher = new Teacher();
$teacher->setPerson($this->getPerson());
$teacher->save($con);
$guard_user = $this->getPersonSfGuardUser();
if (!is_null($guard_user)) {
$teacher_group = BaseCustomOptionsHolder::getInstance('GuardGroups')->getStringFor(GuardGroups::TEACHER);
if (!array_key_exists($teacher_group, $guard_user->getGroups())) {
$guard_user->addGroupByName($teacher_group);
$guard_user->save($con);
}
}
}
示例2: __construct
public $age;
public function __construct($name, $age)
{
$this->name = $name;
$this->age = $age;
}
public function getName()
{
return $this->name;
}
public function getAge()
{
return $this->age;
}
}
class Teacher
{
public $person;
public function setPerson($name, $age)
{
$this->person = new Person($name, $age);
}
public function getPerson()
{
return $this->person;
}
}
$teacher = new Teacher();
$teacher->setPerson('Jackie', 26);
echo $teacher->getPerson()->getName();
echo $teacher->getPerson()->getAge();