/** * Create a simple associative array with Group entity. * * @param RZ\Roadiz\Core\Entities\Group $group * * @return array */ public function toArray($group) { $data = []; $data['name'] = $group->getName(); $data['roles'] = []; foreach ($group->getRolesEntities() as $role) { $data['roles'][] = $this->roleSerializer->toArray($role); } return $data; }
/** * Create a simple associative array with Group entity. * * @param RZ\Roadiz\Core\Entities\Group $group * * @return array */ public static function toArray($group) { $data = []; $data['name'] = $group->getName(); $data['roles'] = []; foreach ($group->getRolesEntities() as $role) { $data['roles'][] = RoleJsonSerializer::toArray($role); } return $data; }