当前位置: 首页>>代码示例>>PHP>>正文


PHP Department::addEmployee方法代码示例

本文整理汇总了PHP中Department::addEmployee方法的典型用法代码示例。如果您正苦于以下问题:PHP Department::addEmployee方法的具体用法?PHP Department::addEmployee怎么用?PHP Department::addEmployee使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Department的用法示例。


在下文中一共展示了Department::addEmployee方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fillDepartment

function fillDepartment(Department $department, array $people)
{
    foreach ($people as $value) {
        for ($i = 0; $i < $value[0]; $i++) {
            $department->addEmployee(new $value[1]($value[2]));
        }
    }
}
开发者ID:never3ver,项目名称:vector,代码行数:8,代码来源:staff.php

示例2: fillTheDepartment

 private function fillTheDepartment(Department $department, $addToDepartment)
 {
     foreach ($addToDepartment as $item) {
         foreach ($item as $count => $employee) {
             for ($i = 0; $i < $count; $i++) {
                 $em = new $employee[0]($employee[1], $employee[2]);
                 $department->addEmployee($em);
             }
         }
     }
 }
开发者ID:shiyake,项目名称:myTestSite.dev,代码行数:11,代码来源:Vecktor.php

示例3: setDepartment

 /**
  * Declares an association between this object and a Department object.
  *
  * @param      Department $v
  * @return     Employee The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setDepartment(Department $v = null)
 {
     if ($v === null) {
         $this->setDepartmentId(NULL);
     } else {
         $this->setDepartmentId($v->getId());
     }
     $this->aDepartment = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Department object, it will not be re-added.
     if ($v !== null) {
         $v->addEmployee($this);
     }
     return $this;
 }
开发者ID:lejacome,项目名称:hospital-mgt,代码行数:22,代码来源:BaseEmployee.php

示例4: getName

{
    private $_name;
    function __construct($name)
    {
        $this->_name = $name;
    }
    function getName()
    {
        return $this->_name;
    }
}
// End of Employee class.
# ***** END OF CLASSES ***** #
// Create a department:
$hr = new Department('Human Resources');
// Create employees:
$e1 = new Employee('Jane Doe');
$e2 = new Employee('John Doe');
// Add the employees to the department:
$hr->addEmployee($e1);
$hr->addEmployee($e2);
// Loop through the department:
echo "<h2>Department Employees</h2>";
foreach ($hr as $e) {
    echo "<p>{$e->getName()}</p>";
}
// Delete the objects:
unset($hr, $e1, $e2);
?>
</body>
</html>
开发者ID:raynaldmo,项目名称:php-education,代码行数:31,代码来源:iterator.php


注:本文中的Department::addEmployee方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。