本文整理汇总了PHP中Company::setId方法的典型用法代码示例。如果您正苦于以下问题:PHP Company::setId方法的具体用法?PHP Company::setId怎么用?PHP Company::setId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Company
的用法示例。
在下文中一共展示了Company::setId方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createCompany
/**
* @param int $id
* @param string $name
* @param string $contactname
* @param string $email
* @param string $phonenumber
* @param string $region
* @param string $website
* @param int $status
* @return Company
*/
public static function createCompany($id, $name, $contactname, $email, $phonenumber, $region, $website, $status)
{
$newCompany = new Company();
$newCompany->setId($id);
$newCompany->setName($name);
$newCompany->setContactName($contactname);
$newCompany->setEmail($email);
$newCompany->setPhoneNumber($phonenumber);
$newCompany->setRegion($region);
$newCompany->setWebsite($website);
$newCompany->setStatus($status);
return $newCompany;
}
示例2: mapDtoToCompany
public function mapDtoToCompany(CompanyDto $companyDto)
{
$company = new Company();
$company->setId($companyDto->getId());
$company->setName($companyDto->getName());
$company->setContactName($companyDto->getContactName());
$company->setEmail($companyDto->getEmail());
$company->setPhoneNumber($companyDto->getPhoneNumber());
$company->setRegion($companyDto->getRegion());
$company->setWebsite($companyDto->getWebsite());
$company->setStatus($companyDto->getStatus());
return $company;
}
示例3: loadCompany
function loadCompany($jsonObject)
{
$id = $jsonObject->id;
// name
$request = "SELECT * FROM company WHERE id = {$id}";
$result = mysql_query($request);
$row = mysql_fetch_object($result);
// create company object
$company = new Company();
$company->setId($row->id);
$company->setName($row->name);
// departments
$company->setDepartments(loadDepartmentsForCompany($id));
// return company object
return $company;
}
示例4: createAction
/**
* Creates a new company
*/
public function createAction()
{
if (!$this->request->isPost()) {
return $this->dispatcher->forward(array("controller" => "company", "action" => "index"));
}
$company = new Company();
$company->setId($this->request->getPost("id"));
$company->setName($this->request->getPost("name"));
if (!$company->save()) {
foreach ($company->getMessages() as $message) {
$this->flash->error($message);
}
return $this->dispatcher->forward(array("controller" => "company", "action" => "new"));
}
$this->flash->success("company was created successfully");
return $this->dispatcher->forward(array("controller" => "company", "action" => "index"));
}
示例5: loadCompany
function loadCompany($jsonObject)
{
$id = $jsonObject->id;
// name
$request = "SELECT * FROM company WHERE id = {$id}";
$result = mysql_query($request);
$row = mysql_fetch_object($result);
$name = $row->name;
// total
$request = "SELECT * FROM employee";
$result = mysql_query($request);
$total = 0;
while ($row = mysql_fetch_object($result)) {
$total += $row->salary;
}
// create company object
$company = new Company();
$company->setId($id);
$company->setName($name);
$company->setTotal($total);
// return company object
return $company;
}
示例6: die
/**
* Finish the installation - create owner company and administrator
*
* @param void
* @return null
*/
function complete_installation()
{
if (Companies::getOwnerCompany() instanceof Company) {
die('Owner company already exists');
// Somebody is trying to access this method even if the user already exists
}
// if
$this->setLayout('complete_install');
$form_data = array_var($_POST, 'form');
tpl_assign('form_data', $form_data);
if (array_var($form_data, 'submitted') == 'submitted') {
try {
$admin_password = trim(array_var($form_data, 'admin_password'));
$admin_password_a = trim(array_var($form_data, 'admin_password_a'));
if (trim($admin_password) == '') {
throw new Error(lang('password value required'));
}
// if
if ($admin_password != $admin_password_a) {
throw new Error(lang('passwords dont match'));
}
// if
DB::beginWork();
Users::delete();
// clear users table
Companies::delete();
// clear companies table
// Create the administrator user
$administrator = new User();
$administrator->setId(1);
$administrator->setUsername(array_var($form_data, 'admin_username'));
$administrator->setEmail(array_var($form_data, 'admin_email'));
$administrator->setPassword($admin_password);
$administrator->setIsAdmin(true);
$administrator->setAutoAssign(true);
$administrator->save();
// Create the contact for administrator
$administrator_contact = new Contact();
$administrator_contact->setId(1);
$administrator_contact->setCompanyId(1);
$administrator_contact->setEmail(array_var($form_data, 'admin_email'));
$administrator_contact->setUserId($administrator->getId());
$administrator_contact->setDisplayName($administrator->getUsername());
$administrator_contact->save();
// Create a company
$company = new Company();
$company->setId(1);
$company->setClientOfId(0);
$company->setName(array_var($form_data, 'company_name'));
$company->setCreatedById(1);
$company->save();
DB::commit();
$this->redirectTo('access', 'login');
} catch (Exception $e) {
tpl_assign('error', $e);
DB::rollback();
}
// try
}
// if
}
示例7: _create
/**
* Create object with given data
*
* @param array $data
* @param static $instance
* @return static
*/
public static function _create($data, $instance = null)
{
if (null === $instance || !is_object($instance)) {
$instance = new static();
}
$instance->created = true;
foreach ($data as $key => $value) {
$key = trim($key);
switch ($key) {
// Skip some -other- elements
case 'language_name':
case 'contact_or_company':
break;
case substr($key, 0, 3) == 'cf_':
$id = substr($key, 3);
$instance->addCustomField($id, $value);
break;
case 'for_id':
case 'contact_or_company_id':
$target = isset($data['for']) ? $data['for'] : $data['contact_or_company'];
$id = isset($data['for_id']) ? $data['for_id'] : $data['contact_or_company_id'];
switch ($target) {
case 'company':
$value = new Company();
$value->setId($id);
break;
case 'contact':
$value = new Contact();
$value->setId($id);
break;
default:
exit('SHOULD STILL MAP: ' . $target . '! Please report at https://github.com/bmoex/teamleader!');
break;
}
if (method_exists($instance, 'setClient')) {
$instance->setClient($value);
}
break;
case 'deleted':
$instance->setDeleted($value == 1);
break;
default:
$key = str_replace(' ', '', ucwords(str_replace('_', ' ', $key)));
$methodName = 'set' . $key;
if (method_exists($instance, $methodName)) {
call_user_func(array($instance, $methodName), $value);
} else {
// Ignore empty values
if (empty($value)) {
continue;
}
$key = lcfirst($key);
// Always try to set the key
if (!isset($instance->{$key})) {
$instance->{$key} = $value;
}
}
}
}
return $instance;
}
示例8: die
/**
* Finish the installation - create owner company and administrator
*
* @param void
* @return null
*/
function complete_installation()
{
if (Companies::getOwnerCompany() instanceof Company) {
die('Owner company already exists');
// Somebody is trying to access this method even if the user already exists
}
// if
$form_data = array_var($_POST, 'form');
tpl_assign('form_data', $form_data);
if (array_var($form_data, 'submited') == 'submited') {
try {
$admin_password = trim(array_var($form_data, 'admin_password'));
$admin_password_a = trim(array_var($form_data, 'admin_password_a'));
if (trim($admin_password) == '') {
throw new Error(lang('password value required'));
}
// if
if ($admin_password != $admin_password_a) {
throw new Error(lang('passwords dont match'));
}
// if
DB::beginWork();
Users::delete();
// clear users table
Companies::delete();
// clear companies table
// Create the administrator user
$administrator = new User();
$administrator->setId(1);
$administrator->setCompanyId(1);
$administrator->setUsername(array_var($form_data, 'admin_username'));
$administrator->setEmail(array_var($form_data, 'admin_email'));
$administrator->setPassword($admin_password);
$administrator->setCanEditCompanyData(true);
$administrator->setCanManageConfiguration(true);
$administrator->setCanManageSecurity(true);
$administrator->setCanManageWorkspaces(true);
$administrator->setCanManageContacts(true);
$administrator->setCanManageTemplates(true);
$administrator->setCanManageReports(true);
$administrator->setCanManageTime(true);
$administrator->setCanAddMailAccounts(true);
$administrator->setAutoAssign(false);
$administrator->setPersonalProjectId(1);
$administrator->setType('admin');
$administrator->save();
$group = new Group();
$group->setName('administrators');
$group->setAllPermissions(true);
$group->setId(Group::CONST_ADMIN_GROUP_ID);
$group->save();
$group_user = new GroupUser();
$group_user->setGroupId(Group::CONST_ADMIN_GROUP_ID);
$group_user->setUserId($administrator->getId());
$group_user->save();
$project = new Project();
$project->setId(1);
$project->setP1(1);
$project->setName(new_personal_project_name($administrator->getUsername()));
$project->setDescription(lang('files'));
$project->setCreatedById($administrator->getId());
$project->save();
$project_user = new ProjectUser();
$project_user->setProjectId($project->getId());
$project_user->setUserId($administrator->getId());
$project_user->setCreatedById($administrator->getId());
$project_user->setAllPermissions(true);
$project_user->save();
// Create a company
$company = new Company();
$company->setId(1);
$company->setClientOfId(0);
$company->setName(array_var($form_data, 'company_name'));
$company->setCreatedById(1);
$company->save();
DB::commit();
$this->redirectTo('access', 'login');
} catch (Exception $e) {
tpl_assign('error', $e);
DB::rollback();
}
// try
}
// if
}