Create group V2

@return \OpenOrchestra\GroupBundle\Document\Group
498805
protected function createDemoGroup()
    {
        $nodePerimeter = $this->createPerimeter(NodeInterface::ENTITY_TYPE, array(
            'root/fixture_page_legal_mentions',
            'root/fixture_page_contact'
        ));
        $nodeProfileCollection = $this->createProfileCollection(array('profile-Contributor'));

        $group = new Group();
        $group->addLabel('en', 'Demo group');
        $group->addLabel('fr', 'Groupe de démo');
        $group->setSite($this->getReference('site2'));
        $group->addWorkflowProfileCollection(NodeInterface::ENTITY_TYPE, $nodeProfileCollection);
        $group->addPerimeter($nodePerimeter);

        return $group;
    }
881908
public function create()
    {
        $instance = self::createStripeGateway($this);
        $this->setId($instance->getId());
        return $instance;
    }
658408
public static function create() {
		$composer = Composer::getComposerJson( WPEMERGE_CLI_DIR );

		$application = new Application( 'WPEmerge CLI', $composer['version'] );

		$application->add( new AssetsBuild() );
		$application->add( new CreateConfigJson() );
		$application->add( new Install() );
		$application->add( new InstallCarbonFields() );
		$application->add( new InstallCleanComposer() );
		$application->add( new InstallCssFramework() );
		$application->add( new InstallDependencies() );
		$application->add( new InstallFontAwesome() );
		$application->add( new InstallGravityFormsUtilities() );
		$application->add( new InstallHtmlBurgerEnv() );
		$application->add( new InstallPhpTests() );
		$application->add( new MakeController() );
		$application->add( new MakeFacade() );
		$application->add( new MakeViewComposer() );

		return $application;
	}
1163379
def create_grupo_usuario(self):
        """"""
        return GrupoUsuario(
            self.networkapi_url,
            self.user,
            self.password,
            self.user_ldap)
883400
public function build()
    {
        if ($this->constraints->count() == 1) {
            return $this->constraints->first();
        }

        return new Group($this->constraints);
    }
1139567
public function create($vastVersion = '2.0')
    {
        $xml = $this->createDomDocument();

        // root
        $root = $xml->createElement('VAST');
        $xml->appendChild($root);

        // version
        $vastVersionAttribute = $xml->createAttribute('version');
        $vastVersionAttribute->value = $vastVersion;
        $root->appendChild($vastVersionAttribute);

        // return
        return new Document($xml);
    }
57578
public static function create_groupings($groupings) {
        global $CFG, $DB;
        require_once("$CFG->dirroot/group/lib.php");

        $params = self::validate_parameters(self::create_groupings_parameters(), array('groupings'=>$groupings));

        $transaction = $DB->start_delegated_transaction();

        $groupings = array();

        foreach ($params['groupings'] as $grouping) {
            $grouping = (object)$grouping;

            if (trim($grouping->name) == '') {
                throw new invalid_parameter_exception('Invalid grouping name');
            }
            if ($DB->count_records('groupings', array('courseid'=>$grouping->courseid, 'name'=>$grouping->name))) {
                throw new invalid_parameter_exception('Grouping with the same name already exists in the course');
            }

            // Now security checks            .
            $context = context_course::instance($grouping->courseid);
            try {
                self::validate_context($context);
            } catch (Exception $e) {
                $exceptionparam = new stdClass();
                $exceptionparam->message = $e->getMessage();
                $exceptionparam->courseid = $grouping->courseid;
                throw new moodle_exception('errorcoursecontextnotvalid' , 'webservice', '', $exceptionparam);
            }
            require_capability('moodle/course:managegroups', $context);

            $grouping->descriptionformat = external_validate_format($grouping->descriptionformat);

            // Finally create the grouping.
            $grouping->id = groups_create_grouping($grouping);
            $groupings[] = (array)$grouping;
        }

        $transaction->allow_commit();

        return $groupings;
    }
378190
public function createGroup(GroupCreateStruct $createStruct)
    {
        $group = $this->mapper->createGroupFromCreateStruct(
            $createStruct
        );

        $group->id = $this->contentTypeGateway->insertGroup(
            $group
        );

        return $group;
    }
1193326
public function createGroup(Api\GroupCreate $group)
    {
        $json = Serialize::group($group);
        $result = $this->_post($this->_url('/groups'), $json);
        return Deserialize::groupResponse($result);
    }
148945
public function createByeGroup($groupSize): Collection
    {
        $byeFighter = $this->createByeFighter();
        $group = new Collection();
        for ($i = 0; $i < $groupSize; $i++) {
            $group->push($byeFighter);
        }

        return $group;
    }
1024889
function create_group($group_name)
    {
        $new_dn      = 'cn=' . rcube_ldap_generic::quote_string($group_name, true) . ',' . $this->groups_base_dn;
        $new_gid     = self::dn_encode($new_dn);
        $member_attr = $this->get_group_member_attr();
        $name_attr   = $this->prop['groups']['name_attr'] ?: 'cn';
        $new_entry   = array(
            'objectClass' => $this->prop['groups']['object_classes'],
            $name_attr    => $group_name,
            $member_attr  => '',
        );

        if (!$this->ldap->add_entry($new_dn, $new_entry)) {
            $this->set_error(self::ERROR_SAVING, 'errorsaving');
            return false;
        }

        if ($this->cache) {
            $this->cache->remove('groups');
        }

        return array('id' => $new_gid, 'name' => $group_name);
    }
866245
public function groupAction($gname)
    {
        $group = $this->get('admin.configuration.configgroup_manager')->getRepository()->findOneByName($gname);
        if (!$group) {
            $message = $this->get('translator')->trans('The group with name "%name%" does not exist.', array('%name%'=>$gname), 'VinceTAdminConfigurationBundle');
            throw $this->createNotFoundException($message);
        }

        return $this->renderTemplate($group);
    }
1069656
public function createAction()
	{
		$this->isPostRequest();

		$page = new GroupPage();

		$localeId = $this->getCurrentLocale()->getId();

		$localization = Localization::factory($page, $localeId);
		/* @var $localization \Supra\Package\Cms\Entity\GroupLocalization */

		$title = trim($this->getRequestParameter('title', ''));

		if (empty($title)) {
			throw new CmsException(null, 'Group title cannot be empty.');
		}

		$localization->setTitle($title);

		$parentLocalizationId = $this->getRequestParameter('parent_id');

		if (empty($parentLocalizationId)) {
			throw new \UnexpectedValueException(
					'Parent ID is empty while it is not allowed Group to be root.'
			);
		}

		$parentLocalization = $this->getEntityManager()
					->find(Localization::CN(), $parentLocalizationId);

		if ($parentLocalization === null) {
			throw new CmsException(null, sprintf(
					'Specified parent page [%s] not found.',
					$parentLocalizationId
			));
		}

		$entityManager = $this->getEntityManager();

		$entityManager->transactional(function (EntityManager $entityManager) use ($page, $localization, $parentLocalization) {

			$this->lockNestedSet($page);

			$entityManager->persist($page);
			$entityManager->persist($localization);

			if ($parentLocalization) {
				$page->moveAsLastChildOf($parentLocalization->getMaster());
			}

			$this->unlockNestedSet($page);
		});

		return new SupraJsonResponse($this->loadNodeMainData($localization));
	}
440670
public function group()
    {
        if (func_num_args() > 0) {
            $types = func_get_args();
            $this->groupForRender = array();
            foreach ($types as $type) {
                $this->addToGrouping($type);
            }
        }

        return $this;
    }
47204
public function create()
    {
        $instance = self::createVariant($this);
        $this->setId($instance->getId());
        return $instance;
    }
501417
public function group() : Stage\Group
    {
        $stage = new Stage\Group($this);
        $this->addStage($stage);

        return $stage;
    }
66782
public static function group(Api\GroupCreate $group)
    {
        $fields = [];

        if ($group->getName() != null) {
            $fields['name'] = $group->getName();
        }

        if (!empty($group->getMembers())) {
            $fields['members'] = $group->getMembers();
        }

        if (!empty($group->getChildGroups())) {
            $fields['child_groups'] = $group->getChildGroups();
        }

        if ($group->getAutoUpdate() != null) {
            $fields['auto_update'] = Serialize::_groupAutoUpdateHelper(
                $group->getAutoUpdate()
            );
        }

        if (!empty($group->getTags())) {
            $fields['tags'] = $group->getTags();
        }

        return Serialize::_toJson($fields);
    }