@param TeamWorker $teamWorker

@return self
559360
public static function createFromTeamWorker(TeamWorker $teamWorker): self
    {
        $message = new self();
        $message->setId($teamWorker->getId());
        $message->setLastName($teamWorker->getLastName());
        $message->setFirstName($teamWorker->getFirstName());

        return $message;
    }
1051898
public function leaveTeam($teamId, $userId)
    {
        $team = $this->team->find($teamId);
        $user = $this->model->find($userId);

        $user->teams()->detach($team);
    }
1245659
public function setTeam(ChildTeam $v = null)
    {
        if ($v === null) {
            $this->setTeamId(NULL);
        } else {
            $this->setTeamId($v->getId());
        }

        $this->aTeam = $v;

        // Add binding for other direction of this n:n relationship.
        // If this object has already been added to the ChildTeam object, it will not be re-added.
        if ($v !== null) {
            $v->addPersonTeamLink($this);
        }


        return $this;
    }
715637
public function listWorker($teamId, $optParams = array())
  {
    $params = array('teamId' => $teamId);
    $params = array_merge($params, $optParams);
    return $this->call('list', array($params), "Google_Service_Coordinate_WorkerListResponse");
  }
1305065
public function syncRoles(...$roles): self
    {
        $roles = array_flatten($roles);
        $roles = $this->getRoles($roles);

        $this->roles()->sync($roles);

        return $this;
    }
560875
public function createService(ServiceLocatorInterface $serviceLocator)
    {
        /** @var Manager $workflowServiceManager */
        $workflowServiceManager = $serviceLocator->get(Manager::class);
        $chainResolver = $serviceLocator->get(ChainTypeResolver::class);
        $serviceResolver = $serviceLocator->get(ServiceTypeResolver::class);

        $options = [
            InjectTypeResolver::WORKFLOW_SERVICE_MANAGER => $workflowServiceManager,
            InjectTypeResolver::CHAIN_TYPE_RESOLVER => $chainResolver,
            InjectTypeResolver::SERVICE_TYPE_RESOLVER => $serviceResolver
        ];

        return new InjectTypeResolver($options);
    }
562614
public function postTeamWorker(TeamWorkerPostMessage $message): TeamWorker
    {
        $path = sprintf('sites/%d/teams/workers', $message->getSiteId());
        $data = ['api_team_worker' => $message->build()];

        $response = $this->getClient()->sendRequest('POST', $path, $data);

        /** @var TeamWorker $model */
        $model = $this->getModelFactory()->create(TeamWorker::class, $response);

        return $model;
    }
335353
public function force(bool $master = true): self
    {
        if ($master) {
            $this->node = Pool::MASTER;
        }

        return $this;
    }
262973
public function removeWorker($id)
    {
        if ($id instanceof Worker) {
            $id = $id->getId();
        }

        if (isset($this->waitingList[$id])) {
            unset($this->waitingList[$id]);
        }
        if (isset($this->workerList[$id])) {
            unset($this->workerList[$id]);
        }

        return $this;
    }
87510
public function setRenderer($renderer)
    {
        $this->renderer = $renderer instanceof AbstractRenderer ?: $this->getRendererManager()->getRenderer((string) $renderer);

        return $this;
    }
995710
public static function instance(): self
    {
        if (!self::$instance) {
            self::$instance = new self(
                1,
                Sequencer::sequence('exporter-object-id'),
                InvocableInspector::instance()
            );
        }

        return self::$instance;
    }
619747
public function setLogger(LoggerInterface $logger)
    {
        $this->logger = $logger;

        if ($this->serviceStream instanceof LoggerAwareInterface) {
            $this->serviceStream->setLogger($this->getLogger());
        }

        if ($this->workerHandlerStream instanceof LoggerAwareInterface) {
            $this->workerHandlerStream->setLogger($this->getLogger());
        }

        return $this;
    }
1049067
public function prune($teamI18n = null)
    {
        if ($teamI18n) {
            $this->addCond('pruneCond0', $this->getAliasedColName(TeamI18nTableMap::ID), $teamI18n->getId(), Criteria::NOT_EQUAL);
            $this->addCond('pruneCond1', $this->getAliasedColName(TeamI18nTableMap::LOCALE), $teamI18n->getLocale(), Criteria::NOT_EQUAL);
            $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR);
        }

        return $this;
    }
1154861
public function teamCreateFormAction(Workspace $workspace, User $user)
    {
        $this->checkWorkspaceManager($workspace, $user);
        $params = $this->teamManager->getParametersByWorkspace($workspace);
        $team = new Team();
        $team->setIsPublic($params->getIsPublic());
        $team->setSelfRegistration($params->getSelfRegistration());
        $team->setSelfUnregistration($params->getSelfUnregistration());

        $form = $this->formFactory->create(new TeamType(), $team);

        return array(
            'form' => $form->createView(),
            'workspace' => $workspace
        );
    }
686633
public function install(
        WorkerInterface $worker,
        $looptime = 1,
        $forever = false
    ) {

        $name = $worker->getName();

        if ( $this->isInstalled($name) ) {
            throw new Exception("Worker already installed");
        }

        $w = Worker::create()
            ->setInstance($worker)
            ->setLooptime($looptime)
            ->setForever($forever)
            ->setInputChannel(new SharedMemory((int) '1'.hexdec($worker->getId())))
            ->setOutputChannel(new SharedMemory((int) '2'.hexdec($worker->getId())));

        $this->data[$name] = $w;

        return $this;

    }
1163243
public function addWorker(Worker $worker, $priority = 0)
    {
        $this->workers->attach($worker, $priority);
        return $this;
    }
992537
public function attachPermissions($permissions = [], $team = null)
    {
        foreach ($permissions as $permission) {
            $this->attachPermission($permission, $team);
        }

        return $this;
    }