public function setGroupByName($name, $entityManager) { if ($name == 'freelancer') { $this->setGroup($entityManager->getReference('\\User\\Entity\\UserGroup', UserGroup::FREELANCER_GROUP_ID)); $freelancer = new Freelancer(); $freelancer->save($entityManager); $this->freelancer = $freelancer; } else { if ($name == 'employer') { $this->setGroup($entityManager->getReference('\\User\\Entity\\UserGroup', UserGroup::EMPLOYER_GROUP_ID)); $employer = new Employer(); $employer->setData(['name' => $this->firstName . ', ' . $this->lastName, 'contracted' => 0, 'alias' => $this->getAlias($entityManager, UserGroup::EMPLOYER_GROUP_ID)]); $employer->save($entityManager); $this->employer = $employer; } else { if ($name == 'staff') { $this->setGroup($entityManager->getReference('\\User\\Entity\\UserGroup', UserGroup::ADMIN_GROUP_ID)); $staff = new Staff(); $staff->setData(['name' => $this->firstName . ', ' . $this->lastName, 'alias' => $this->getAlias($entityManager, UserGroup::EMPLOYER_GROUP_ID)]); $staff->save($entityManager); $this->staff = $staff; } } } }
public function getData() { return ['company' => $this->company ? $this->company->getData() : null, 'defaultServiceLevel' => $this->defaultServiceLevel, 'id' => $this->id, 'name' => $this->name ? $this->name : '', 'position' => $this->position, 'comments' => $this->comments, 'contracted' => $this->contracted, 'pm' => $this->pm ? $this->pm->getData() : null, 'sales' => $this->sales ? $this->sales->getData() : null]; }
public function getData() { $client = $this->client ? $this->client->getEmployer() ? $this->client->getEmployer()->getData() : null : null; if ($client) { $client['types'] = $this->client->getTypes(); } return ['client' => $client, 'user' => $this->client ? $this->client->getData() : null, 'userid' => $this->client->getId(), 'dueDate' => $this->dueDate, 'quote_no' => $this->quote_no, 'project_no' => $this->project_no, 'tax' => $this->tax, 'discount' => $this->discount, 'duration' => $this->duration, 'field' => $this->field ? $this->field->getData() : null, 'id' => $this->id, 'interpretingInfo' => $this->interpretingInfo, 'serviceLevel' => $this->serviceLevel, 'pm' => $this->pm ? $this->pm->getData() : null, 'priority' => $this->priority, 'reference' => $this->reference, 'sale' => $this->sale ? $this->sale->getData() : null, 'sourceLanguage' => $this->sourceLanguage->getData(), 'startDate' => $this->startDate, 'status' => $this->status, 'targetLanguages' => $this->getArrayData($this->targetLanguages), 'po' => $this->po, 'sourcetext' => $this->sourcetext, 'currency' => $this->currency, 'total_tmp' => $this->total_tmp, 'total' => $this->total, 'types' => $this->types, 'transGraph' => $this->transGraph, 'payStatus' => $this->payStatus, 'description' => $this->description]; }