本文整理汇总了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();