Serializes a Group entity.

@param Group $group
@param array $options

@return array
427592
public function serialize(Group $group, array $options = [])
    {
        return [
            'id' => $group->getUuid(),
            'name' => $group->getName(),
            'roles' => array_map(function (Role $role) use ($options) {
                return $this->roleSerializer->serialize($role, $options);
            }, $group->getEntityRoles()->toArray()),
            'organizations' => array_map(function (Organization $organization) use ($options) {
                return $this->organizationSerializer->serialize($organization, $options);
            }, $group->getOrganizations()->toArray()),
        ];
    }
1051014
public function deserialize(array $data, AnnouncementAggregate $aggregate = null, array $options = [])
    {
        $aggregate = $aggregate ?: new AnnouncementAggregate();

        if (!in_array(Options::REFRESH_UUID, $options)) {
            $this->sipe('id', 'setUuid', $data, $aggregate);
        } else {
            $aggregate->refreshUuid();
        }

        $existingAnnounces = [];
        foreach ($aggregate->getAnnouncements() as $announce) {
            $existingAnnounces[$announce->getUuid()] = $announce;
        }

        $announceIds = []; // will be used to remove announces which no longer exist
        if (isset($data['posts'])) {
            foreach ($data['posts'] as $post) {
                $announce = $this->announcementSerializer->deserialize($post, $existingAnnounces[$post['id']] ?? null, $options);

                $announce->setAggregate($aggregate);
                $announceIds[] = $announce->getUuid();
            }
        }

        // remove announces which no longer exist
        foreach ($aggregate->getAnnouncements() as $announce) {
            if (!in_array($announce->getUuid(), $announceIds)) {
                // no longer exists
                $announce->setAggregate(null);
            }
        }

        return $aggregate;
    }
850661
public function sendCreateGroupMail( $group ) {

		$fromEmail	= $this->mailProperties->getSenderEmail();
		$fromName	= $this->mailProperties->getSenderName();

		$email = Yii::$app->factory->get( 'groupService' )->getEmail( $group );

		if( !empty( $email ) ) {

			// Send Mail
			$this->getMailer()->compose( self::MAIL_GROUP_CREATE, [ 'coreProperties' => $this->coreProperties, 'group' => $group, 'email' => $email ] )
				->setTo( $email )
				->setFrom( [ $fromEmail => $fromName ] )
				->setSubject( "Group Registration | " . $this->coreProperties->getSiteName() )
				//->setTextBody( "text" )
				->send();
		}
	}
365104
public function serialize(Level $level, array $options = [])
    {
        $serialized = [
            'id' => $level->getUuid(),
            'name' => $level->getName(),
            'value' => $level->getValue(),
        ];

        return $serialized;
    }
541413
public function render(Group $group)
    {
        if ($group->isAuthorized()) {
            $items = [];
            foreach ($group->getItems() as $item) {
                $items[] = (new IlluminateItemRenderer($this->factory))->render($item);
            }

            return $this->factory->make($this->view, [
                'group' => $group,
                'items' => $items
            ])->render();
        }
    }
1216794
public function serialize(Options $options)
    {
        return [
            'id' => $options->getId(),
            'data' => $options->getOptions(),
            'user' => $this->userSerializer->serialize($options->getUser()),
        ];
    }
495550
public function serialize(Field $field, array $options = [])
    {
        $serialized = [
            'id' => $field->getUuid(),
            'autoId' => $field->getId(),
            'name' => $field->getName(),
            'label' => $field->getName(),
            'type' => $field->getFieldType(),
            'required' => $field->isRequired(),
            'help' => $field->getHelp(),
            'restrictions' => [
                'isMetadata' => $field->getIsMetadata(),
                'locked' => $field->isLocked(),
                'lockedEditionOnly' => $field->getLockedEditionOnly(),
                'hidden' => $field->isHidden(),
                'order' => $field->getOrder(),
            ],
        ];

        if (count($field->getDetails()) > 0) {
            $serialized['options'] = $field->getDetails();
        }
        if (in_array($field->getType(), [FieldFacet::CHOICE_TYPE, FieldFacet::CASCADE_TYPE])) {
            $serialized['options']['choices'] = array_map(function (FieldFacetChoice $choice) {
                return $this->fieldFacetChoiceSerializer->serialize($choice);
            }, $field->getFieldFacet()->getRootFieldFacetChoices());
        }
        if (!in_array(Options::SERIALIZE_MINIMAL, $options)) {
            $serialized = array_merge($serialized, [
                'fieldFacet' => $this->fieldFacetSerializer->serialize($field->getFieldFacet()),
            ]);
        } else {
            $serialized = array_merge($serialized, [
                'fieldFacet' => [
                    'id' => $field->getUuid(),
                ],
            ]);
        }

        return $serialized;
    }
263499
public function serialize(Category $category, array $options = [])
    {
        $serialized = [
            'id' => $category->getUuid(),
            'name' => $category->getName(),
            'details' => $category->getDetails(),
        ];

        if (!in_array(Options::SERIALIZE_MINIMAL, $options)) {
            $serialized = array_merge($serialized, [
                'managers' => array_map(function (User $manager) {
                    return $this->userSerializer->serialize($manager, [Options::SERIALIZE_MINIMAL]);
                }, $category->getManagers()),
            ]);
            $serialized = array_merge($serialized, [
                'fieldsValues' => array_map(function (FieldChoiceCategory $fcc) {
                    return $this->fieldChoiceCategorySerializer->serialize($fcc);
                }, $this->fieldChoiceCategoryRepo->findBy(['category' => $category])),
            ]);
        }

        return $serialized;
    }
666407
private static function select_optgroup($groupname, $options, array $selected) {
        if (empty($options)) {
            return '';
        }
        $attributes = array('label'=>$groupname);
        $output = '';
        foreach ($options as $value=>$label) {
            $output .= self::select_option($label, $value, $selected);
        }
        return self::tag('optgroup', $output, $attributes);
    }
845538
public function serialize(Location $location, array $options = [])
    {
        return [
            'autoId' => $location->getId(),
            'id' => $location->getUuid(),
            'name' => $location->getName(),
            'meta' => [
                'type' => $location->getType(),
            ],
            'street' => $location->getStreet(),
            'boxNumber' => $location->getBoxNumber(),
            'streetNumber' => $location->getStreetNumber(),
            'zipCode' => $location->getPc(),
            'town' => $location->getTown(),
            'country' => $location->getCountry(),
            'phone' => $location->getPhone(),
            'gps' => [
                'latitude' => $location->getLatitude(),
                'longitude' => $location->getLongitude(),
            ],
        ];
    }
204027
public function serialize(Facet $facet, array $options = [])
    {
        return [
          'id' => $facet->getUuid(),
          'title' => $facet->getName(),
          'position' => $facet->getPosition(),
          'display' => [
            'creation' => $facet->getForceCreationForm(),
          ],
          'roles' => array_map(function (Role $role) {
              return $this->roleSerializer->serialize($role, [Options::SERIALIZE_MINIMAL]);
          }, $facet->getRoles()->toArray()),
          'meta' => [
              'main' => $facet->isMain(),
          ],
          'sections' => array_map(function ($panel) use ($options) { // todo check user rights
              return $this->pfSerializer->serialize($panel, $options);
          }, $facet->getPanelFacets()->toArray()),
        ];
    }
476410
public function serialize(AnnouncementAggregate $announcements, array $options = [])
    {
        $announcePosts = $announcements->getAnnouncements()->toArray();

        if (in_array(static::VISIBLE_POSTS_ONLY, $options)) {
            // filter embed announces to only get visible ones
            $now = new \DateTime('now');
            $announcePosts = array_values(// reindex array for correct serialization
                array_filter($announcePosts, function (Announcement $announcement) use ($now) {
                    return $announcement->isVisible()
                        && (empty($announcement->getVisibleFrom()) || $announcement->getVisibleFrom() <= $now)
                        && (empty($announcement->getVisibleUntil()) || $announcement->getVisibleUntil() > $now);
                })
            );
        }

        return [
            'id' => $announcements->getUuid(),
            'posts' => array_map(function (Announcement $announcement) {
                return $this->announcementSerializer->serialize($announcement);
            }, $announcePosts),
        ];
    }
316992
public static function getKeys($group)
    {
        self::loadKeys();
        self::$keys[$group] = isset(self::$keys[$group]) ? self::$keys[$group] : [];

        return self::$keys[$group];
    }
734679
public function GetGroup(\Google\Cloud\Monitoring\V3\GetGroupRequest $argument,
      $metadata = [], $options = []) {
        return $this->_simpleRequest('/google.monitoring.v3.GroupService/GetGroup',
        $argument,
        ['\Google\Cloud\Monitoring\V3\Group', 'decode'],
        $metadata, $options);
    }
621794
protected function constraintGroupToArray(ConstraintGroup $group)
    {
        $array = [];

        foreach ($group->constraints() as $constraint) {
            foreach ($this->constraintToArray($constraint) as $key=>$value) {
                $array[$key] = $value;
            }
        }

        return $array;
    }
1255499
protected function saveFields(FieldGroup $group, array $fields = [])
    {
        if (empty($fields)) {
            return false;
        }
        foreach ($fields as $field) {
            $type = $this->getFieldType($field);

            $insert = [
                'type_id'  => $type->id,
                'group_id' => $group->id
            ];

            foreach ($this->brands as $brand) {
                $this->saveField($brand, $field, $insert);
            }
        }
    }
1320713
public function group($group = null)
    {
        if ($group !== null) {
            $this->_group = $group;
        }
        return $this->_group;
    }