From ce12d3cb8941b1290606dc3d3867cd4ab847d944 Mon Sep 17 00:00:00 2001
From: Sebastian Marcet
Date: Fri, 27 May 2016 16:20:46 -0300
Subject: [PATCH] Upgrade Laravel Version and ORM Framework
upgraded laravel version from 5.0 to 5.2.
Changed ORM from eloquent to Doctrine to support better inheritance handling
basically eloquent does not suppor the inheritance model used by Silverstripe
which makes dificult to implement write apis on model hierarchies defined with
SS schema.
Refactoring.
Change-Id: I802e171c8b95e81dc21578543ddb6a02003985e5
---
.gitignore | 5 +-
Libs/ModelSerializers/AbstractSerializer.php | 187 +++
Libs/ModelSerializers/IModelSerializer.php | 25 +
...erAccessTokenAuthorizationHeaderParser.php | 0
.../oauth2 => Libs/OAuth2}/HttpMessage.php | 0
.../oauth2 => Libs/OAuth2}/HttpResponse.php | 0
.../OAuth2}/InvalidGrantTypeException.php | 0
.../OAuth2}/OAuth2DirectResponse.php | 0
.../OAuth2InvalidIntrospectionResponse.php | 0
...Auth2MissingBearerAccessTokenException.php | 0
.../oauth2 => Libs/OAuth2}/OAuth2Protocol.php | 0
.../OAuth2}/OAuth2ResourceServerException.php | 0
.../oauth2 => Libs/OAuth2}/OAuth2Response.php | 0
.../OAuth2WWWAuthenticateErrorResponse.php | 0
.../Utils}/ConfigurationException.php | 0
.../utils => Libs/Utils}/DateTimeUtils.php | 0
.../Libs/utils => Libs/Utils}/HTMLCleaner.php | 0
.../utils => Libs/Utils}/ICacheService.php | 0
.../Utils}/ITransactionService.php | 0
{app/Libs/utils => Libs/Utils}/JsonUtils.php | 8 +-
.../utils => Libs/Utils}/RequestUtils.php | 0
app/Commands/Command.php | 7 -
app/Console/Commands/Inspire.php | 33 +
app/Console/Commands/SummitJsonGenerator.php | 62 +-
app/Console/Kernel.php | 51 +-
app/Events/Event.php | 9 +-
app/Events/PresentationMaterialCreated.php | 45 +
.../SummitEventCreated.php} | 16 +-
.../SummitEventDeleted.php} | 15 +-
app/Events/SummitEventEntityStateChanged.php | 64 +
app/Events/SummitEventUpdated.php | 22 +
app/Exceptions/Handler.php | 27 +-
app/Factories/FactoriesProvider.php | 32 +
app/Factories/PresentationVideoFactory.php | 44 +
app/Handlers/Commands/.gitkeep | 0
app/Handlers/Events/.gitkeep | 0
app/Http/Controllers/Controller.php | 15 +-
app/Http/Controllers/JsonController.php | 8 +-
.../summit/CheckAttendeeStrategyFactory.php | 4 +-
.../summit/CheckSpeakerStrategyFactory.php | 5 +-
.../summit/ICheckAttendeeStrategy.php | 4 +-
.../summit/ICheckSpeakerStrategy.php | 4 +-
.../summit/ISummitFinderStrategy.php | 4 +-
.../OAuth2PresentationApiController.php | 133 ++
.../summit/OAuth2SummitApiController.php | 1371 +----------------
.../OAuth2SummitAttendeesApiController.php | 343 +++++
.../OAuth2SummitEventsApiController.php | 767 +++++++++
.../OAuth2SummitLocationsApiController.php | 240 +++
.../OAuth2SummitMembersApiController.php | 86 ++
.../OAuth2SummitSpeakersApiController.php | 178 +++
.../summit/SummitFinderStrategyFactory.php | 4 +-
.../strategies/CheckMeSpeakerStrategy.php | 10 +-
.../strategies/CheckMyOwnAttendeeStrategy.php | 2 +-
.../CurrentSummitFinderStrategy.php | 6 +-
.../RetrieveSummitEventsStrategy.php | 138 --
...trieveAllPublishedSummitEventsStrategy.php | 27 +-
...trieveAllSummitEventsBySummitStrategy.php} | 63 +-
.../RetrieveAllSummitEventsStrategy.php | 11 +-
...ePublishedSummitEventsBySummitStrategy.php | 29 +-
.../events/RetrieveSummitEventsStrategy.php | 98 ++
app/Http/Kernel.php | 58 +-
app/Http/Middleware/Authenticate.php | 70 +-
app/Http/Middleware/CORSMiddleware.php | 3 +-
app/Http/Middleware/CacheMiddleware.php | 14 +-
app/Http/Middleware/ETagsMiddleware.php | 6 +-
app/Http/Middleware/EncryptCookies.php | 17 +
...Auth2BearerAccessTokenRequestValidator.php | 3 +-
app/Http/Middleware/RateLimitMiddleware.php | 3 +-
.../Middleware/RedirectIfAuthenticated.php | 58 +-
app/Http/Middleware/SSLMiddleware.php | 7 +-
.../SecurityHTTPHeadersWriterMiddleware.php | 3 +-
app/Http/Middleware/VerifyCsrfToken.php | 31 +-
app/Http/Requests/Request.php | 11 +-
app/Http/Utils/DoctrineJoinFilterMapping.php | 71 +
.../Utils/ExistsFilterManyManyMapping.php | 55 -
.../Utils/ExistsFilterManyToOneMapping.php | 47 -
app/Http/Utils/Filter.php | 208 +--
app/Http/Utils/FilterParser.php | 2 +-
app/Http/Utils/Order.php | 40 +-
app/Http/Utils/PagingInfo.php | 8 +
app/Http/Utils/PagingResponse.php | 26 +-
app/Http/routes.php | 99 +-
app/Jobs/Job.php | 21 +
.../less/app.less => app/Listeners/.gitkeep | 0
.../CompanySerializer.php} | 21 +-
.../SummitAbstractLocationSerializer.php} | 26 +-
.../Locations/SummitAirportSerializer.php | 24 +
.../SummitExternalLocationSerializer.php | 25 +
.../SummitGeoLocatedLocationSerializer.php | 62 +
.../Locations/SummitHotelSerializer.php | 28 +
.../SummitLocationImageSerializer.php} | 48 +-
.../Locations/SummitVenueFloorSerializer.php | 64 +
.../Locations/SummitVenueRoomSerializer.php | 58 +
.../Locations/SummitVenueSerializer.php | 60 +
app/ModelSerializers/MemberSerializer.php | 92 ++
.../PresentationCategoryGroupSerializer.php} | 51 +-
.../PresentationCategorySerializer.php | 47 +
.../PresentationLinkSerializer.php | 26 +
.../PresentationMaterialSerializer.php} | 22 +-
.../PresentationSerializer.php | 114 ++
.../PresentationSlideSerializer.php | 43 +
.../PresentationSpeakerSerializer.php | 93 ++
.../PresentationVideoSerializer.php | 28 +
app/ModelSerializers/SerializerRegistry.php | 97 ++
.../SilverStripeSerializer.php | 27 +
.../SummitAttendeeScheduleSerializer.php | 43 +
.../SummitAttendeeSerializer.php | 128 ++
.../SummitEntityEventSerializer.php | 53 +
.../SummitEventFeedbackSerializer.php | 80 +
.../SummitEventSerializer.php | 130 ++
.../SummitEventTypeSerializer.php} | 30 +-
app/ModelSerializers/SummitSerializer.php | 150 ++
.../SummitTicketTypeSerializer.php | 41 +
.../SummitTypeSerializer.php} | 30 +-
.../TagSerializer.php} | 20 +-
.../EntityNotFoundException.php | 0
.../ValidationException.php | 4 +-
app/Models/Foundation/Main/Company.php | 59 +
app/Models/{main => Foundation/Main}/File.php | 53 +-
app/Models/Foundation/Main/Member.php | 185 +++
.../Main/Repositories/IMemberRepository.php | 30 +
app/Models/Foundation/Main/Tag.php | 58 +
.../Marketplace}/CompanyService.php | 0
.../Marketplace}/Consultant.php | 0
.../Marketplace}/DataCenterLocation.php | 0
.../Marketplace}/DataCenterRegion.php | 0
.../Marketplace}/ICloudService.php | 0
.../Marketplace}/ICloudServiceRepository.php | 0
.../ICompanyServiceRepository.php | 0
.../Marketplace}/IConsultant.php | 0
.../Marketplace}/IConsultantRepository.php | 0
.../IPrivateCloudServiceRepository.php | 0
.../IPublicCloudServiceRepository.php | 0
.../Marketplace}/Office.php | 0
.../Marketplace}/PrivateCloudService.php | 0
.../Marketplace}/PublicCloudService.php | 0
.../ConfirmationExternalOrderRequest.php | 92 ++
.../Summit/Attendees/SummitAttendee.php | 253 +++
.../Attendees/SummitAttendeeSchedule.php | 166 ++
.../Summit/Attendees/SummitAttendeeTicket.php | 179 +++
.../Summit/EntityEvents/EntityEventList.php | 126 ++
.../SummitEntityEventProcessContext.php | 170 ++
.../EntityEvents/Types/EntityEventType.php | 49 +
.../Types/EntityEventTypeFactory.php | 153 ++
.../Types/GenericSummitEntityEventType.php | 36 +
.../EntityEvents/Types/IEntityEventType.php} | 15 +-
.../Types/MyScheduleEntityEventType.php | 35 +
.../PresentationCategoryEntityEventType.php | 32 +
...esentationCategoryGroupEntityEventType.php | 34 +
.../PresentationMaterialEntityEventType.php | 37 +
.../PresentationSpeakerEntityEventType.php | 34 +
.../Types/SummitEntityEventType.php | 34 +
.../SummitEventEntityEventDeleteType.php | 30 +
...mmitEventEntityEventInsertOrUpdateType.php | 50 +
.../Types/SummitEventEntityEventType.php | 31 +
.../SummitEventRelationEntityEventType.php | 51 +
.../Types/SummitEventTypeEntityEventType.php | 33 +
.../Types/SummitLocationEntityEventType.php | 37 +
.../Types/SummitLocationImageEventType.php | 37 +
.../Types/SummitTicketTypeEntityEventType.php | 33 +
.../Types/SummitTypeEntityEventType.php | 34 +
.../Types/SummitVenueFloorEntityEventType.php | 37 +
.../Types/TrackFromTrackGroupEventType.php | 49 +
.../Types/WipeDataEntityEventType.php | 48 +
.../Materials/PresentationLink.php | 52 +
.../Materials/PresentationMaterial.php | 197 +++
.../Materials/PresentationSlide.php | 98 ++
.../Materials/PresentationVideo.php | 128 ++
.../Events/Presentations/Presentation.php | 308 ++++
.../Presentations/PresentationCategory.php | 132 ++
.../PresentationCategoryGroup.php | 139 ++
.../Presentations/PresentationSpeaker.php | 270 ++++
.../Summit/Events/SummitEntityEvent.php | 165 ++
.../Foundation/Summit/Events/SummitEvent.php | 722 +++++++++
.../Summit/Events/SummitEventFeedback.php | 148 ++
.../Summit/Events/SummitEventType.php | 121 ++
.../Factories/IPresentationVideoFactory.php | 26 +
.../Summit/Factories}/SummitEventFactory.php | 2 +-
.../Locations/SummitAbstractLocation.php | 136 ++
.../Summit/Locations/SummitAirport.php} | 44 +-
.../Locations/SummitExternalLocation.php | 57 +
.../Locations/SummitGeoLocatedLocation.php | 341 ++++
.../Summit/Locations/SummitHotel.php | 94 ++
.../Summit/Locations/SummitLocationImage.php | 174 +++
.../Summit/Locations/SummitVenue.php | 112 ++
.../Summit/Locations/SummitVenueFloor.php | 161 ++
.../Summit/Locations/SummitVenueRoom.php | 143 ++
.../IEventFeedbackRepository.php} | 29 +-
.../Repositories}/ISpeakerRepository.php | 3 +-
.../ISummitAttendeeRepository.php} | 12 +-
.../ISummitAttendeeTicketRepository.php | 30 +
.../ISummitEntityEventRepository.php | 48 +
.../Repositories}/ISummitEventRepository.php | 20 +-
.../Repositories}/ISummitRepository.php | 0
app/Models/Foundation/Summit/Summit.php | 811 ++++++++++
app/Models/Foundation/Summit/SummitOwned.php | 53 +
.../Foundation/Summit/SummitTicketType.php | 119 ++
app/Models/Foundation/Summit/SummitType.php | 90 ++
app/Models/{oauth2 => OAuth2}/AccessToken.php | 0
.../IResourceServerContext.php | 0
.../ResourceServerContext.php | 0
app/Models/{oauth2 => OAuth2}/Token.php | 0
.../AccessTokenService.php | 10 +-
.../Api.php | 0
.../ApiEndpoint.php | 0
.../ApiScope.php | 0
.../IAccessTokenService.php | 0
.../IApi.php | 0
.../IApiEndpoint.php | 0
.../IApiEndpointRepository.php | 0
.../IApiScope.php | 0
app/Models/Utils/BaseModelEloquent.php | 206 ++-
app/Models/Utils/IEntity.php | 1 +
.../Utils/PreRemoveEventArgs.php} | 33 +-
app/Models/Utils/SilverstripeBaseModel.php | 121 +-
app/Models/main/Member.php | 38 -
app/Models/summit/Presentation.php | 199 ---
app/Models/summit/PresentationCategory.php | 57 -
app/Models/summit/PresentationMaterial.php | 41 -
app/Models/summit/PresentationSlide.php | 59 -
app/Models/summit/PresentationSpeaker.php | 122 --
app/Models/summit/Summit.php | 593 -------
app/Models/summit/SummitAbstractLocation.php | 152 --
app/Models/summit/SummitAttendee.php | 186 ---
app/Models/summit/SummitAttendeeTicket.php | 61 -
app/Models/summit/SummitEntityEvent.php | 36 -
app/Models/summit/SummitEvent.php | 518 -------
app/Models/summit/SummitEventFeedback.php | 89 --
.../summit/SummitGeoLocatedLocation.php | 87 --
app/Models/summit/SummitLocationImage.php | 61 -
app/Models/summit/SummitTicketType.php | 62 -
app/Models/summit/SummitVenue.php | 56 -
app/Policies/.gitkeep | 1 +
app/Providers/AppServiceProvider.php | 24 +-
app/Providers/AuthServiceProvider.php | 31 +
app/Providers/BusServiceProvider.php | 34 -
app/Providers/ConfigServiceProvider.php | 23 -
app/Providers/EventServiceProvider.php | 213 ++-
app/Providers/RouteServiceProvider.php | 45 +-
app/Repositories/DoctrineRepository.php | 71 +
.../EloquentCompanyServiceRepository.php | 0
.../EloquentConsultantRepository.php | 0
.../EloquentPrivateCloudServiceRepository.php | 0
.../EloquentPublicCloudServiceRepository.php | 0
app/Repositories/RepositoriesProvider.php | 49 +-
.../EloquentApiEndpointRepository.php | 0
.../SilverStripeDoctrineRepository.php | 23 +
.../DoctrineEventFeedbackRepository.php | 93 ++
.../Doctrine/DoctrineMemberRepository.php | 34 +
.../Doctrine/DoctrineSpeakerRepository.php} | 105 +-
.../DoctrineSummitAttendeeRepository.php | 26 +
...DoctrineSummitAttendeeTicketRepository.php | 44 +
.../DoctrineSummitEntityEventRepository.php | 138 ++
.../DoctrineSummitEventRepository.php | 154 ++
.../Doctrine/DoctrineSummitRepository.php | 47 +
.../summit/EloquentSummitEventRepository.php | 143 --
app/Services/{apis => Apis}/EventbriteAPI.php | 0
.../{apis => Apis}/IEventbriteAPI.php | 0
app/Services/Model/IPresentationService.php | 30 +
.../{model => Model}/ISummitService.php | 18 +-
app/Services/Model/PresentationService.php | 83 +
app/Services/Model/SummitService.php | 761 +++++++++
app/Services/ServicesProvider.php | 5 +-
.../Utils/DoctrineTransactionService.php | 61 +
.../EloquentTransactionService.php | 0
.../{utils => Utils}/RedisCacheService.php | 0
app/Services/model/SummitService.php | 1296 ----------------
artisan | 6 +-
bootstrap/app.php | 18 +-
bootstrap/autoload.php | 9 +-
bootstrap/cache/.gitignore | 2 +
clear_logs.sh | 2 +
composer.json | 111 +-
config/app.php | 363 ++---
config/auth.php | 150 +-
config/broadcasting.php | 52 +
config/cache.php | 109 +-
config/compile.php | 60 +-
config/database.php | 184 +--
config/doctrine.php | 231 +++
config/filesystems.php | 110 +-
config/mail.php | 196 ++-
config/queue.php | 145 +-
config/services.php | 57 +-
config/session.php | 265 ++--
config/view.php | 50 +-
database/factories/ModelFactory.php | 21 +
database/migrations/.gitkeep | 1 +
database/seeds/.gitkeep | 1 +
database/seeds/ApiEndpointsSeeder.php | 47 +
database/seeds/ApiScopesSeeder.php | 20 +
database/seeds/DatabaseSeeder.php | 9 +-
gulpfile.js | 4 +-
package.json | 9 +-
phpspec.yml | 5 -
public/.htaccess | 7 +-
public/index.php | 5 +-
public/web.config | 23 +
readme.md | 5 +
resources/assets/sass/app.scss | 2 +
resources/lang/en/auth.php | 19 +
resources/lang/en/pagination.php | 24 +-
resources/lang/en/passwords.php | 30 +-
resources/lang/en/validation.php | 199 +--
server.php | 8 +-
setup.cfg | 23 -
storage/.gitignore | 1 -
storage/app/.gitignore | 3 +-
storage/app/public/.gitignore | 2 +
storage/framework/.gitignore | 2 +
storage/framework/cache/.gitignore | 2 +-
storage/proxies/.gitignore | 2 +
tests/DoctrineTest.php | 158 ++
tests/OAuth2SummitApiTest.php | 448 ++++--
tests/ProtectedApiTest.php | 5 +
tests/TestCase.php | 1 -
update_project.sh | 3 +
317 files changed, 16158 insertions(+), 7504 deletions(-)
create mode 100644 Libs/ModelSerializers/AbstractSerializer.php
create mode 100644 Libs/ModelSerializers/IModelSerializer.php
rename {app/Libs/oauth2 => Libs/OAuth2}/BearerAccessTokenAuthorizationHeaderParser.php (100%)
rename {app/Libs/oauth2 => Libs/OAuth2}/HttpMessage.php (100%)
rename {app/Libs/oauth2 => Libs/OAuth2}/HttpResponse.php (100%)
rename {app/Libs/oauth2 => Libs/OAuth2}/InvalidGrantTypeException.php (100%)
rename {app/Libs/oauth2 => Libs/OAuth2}/OAuth2DirectResponse.php (100%)
rename {app/Libs/oauth2 => Libs/OAuth2}/OAuth2InvalidIntrospectionResponse.php (100%)
rename {app/Libs/oauth2 => Libs/OAuth2}/OAuth2MissingBearerAccessTokenException.php (100%)
rename {app/Libs/oauth2 => Libs/OAuth2}/OAuth2Protocol.php (100%)
rename {app/Libs/oauth2 => Libs/OAuth2}/OAuth2ResourceServerException.php (100%)
rename {app/Libs/oauth2 => Libs/OAuth2}/OAuth2Response.php (100%)
rename {app/Libs/oauth2 => Libs/OAuth2}/OAuth2WWWAuthenticateErrorResponse.php (100%)
rename {app/Libs/utils => Libs/Utils}/ConfigurationException.php (100%)
rename {app/Libs/utils => Libs/Utils}/DateTimeUtils.php (100%)
rename {app/Libs/utils => Libs/Utils}/HTMLCleaner.php (100%)
rename {app/Libs/utils => Libs/Utils}/ICacheService.php (100%)
rename {app/Libs/utils => Libs/Utils}/ITransactionService.php (100%)
rename {app/Libs/utils => Libs/Utils}/JsonUtils.php (94%)
rename {app/Libs/utils => Libs/Utils}/RequestUtils.php (100%)
delete mode 100644 app/Commands/Command.php
create mode 100644 app/Console/Commands/Inspire.php
create mode 100644 app/Events/PresentationMaterialCreated.php
rename app/{Models/main/Image.php => Events/SummitEventCreated.php} (72%)
rename app/{Models/summit/SummitExternalLocation.php => Events/SummitEventDeleted.php} (69%)
create mode 100644 app/Events/SummitEventEntityStateChanged.php
create mode 100644 app/Events/SummitEventUpdated.php
create mode 100644 app/Factories/FactoriesProvider.php
create mode 100644 app/Factories/PresentationVideoFactory.php
delete mode 100644 app/Handlers/Commands/.gitkeep
delete mode 100644 app/Handlers/Events/.gitkeep
create mode 100644 app/Http/Controllers/apis/protected/summit/OAuth2PresentationApiController.php
create mode 100644 app/Http/Controllers/apis/protected/summit/OAuth2SummitAttendeesApiController.php
create mode 100644 app/Http/Controllers/apis/protected/summit/OAuth2SummitEventsApiController.php
create mode 100644 app/Http/Controllers/apis/protected/summit/OAuth2SummitLocationsApiController.php
create mode 100644 app/Http/Controllers/apis/protected/summit/OAuth2SummitMembersApiController.php
create mode 100644 app/Http/Controllers/apis/protected/summit/OAuth2SummitSpeakersApiController.php
delete mode 100644 app/Http/Controllers/apis/protected/summit/strategies/RetrieveSummitEventsStrategy.php
rename app/Http/Controllers/apis/protected/summit/strategies/{ => events}/RetrieveAllPublishedSummitEventsStrategy.php (62%)
rename app/Http/Controllers/apis/protected/summit/strategies/{RetrieveSummitEventsBySummitStrategy.php => events/RetrieveAllSummitEventsBySummitStrategy.php} (50%)
rename app/Http/Controllers/apis/protected/summit/strategies/{ => events}/RetrieveAllSummitEventsStrategy.php (83%)
rename app/Http/Controllers/apis/protected/summit/strategies/{ => events}/RetrievePublishedSummitEventsBySummitStrategy.php (61%)
create mode 100644 app/Http/Controllers/apis/protected/summit/strategies/events/RetrieveSummitEventsStrategy.php
create mode 100644 app/Http/Middleware/EncryptCookies.php
create mode 100644 app/Http/Utils/DoctrineJoinFilterMapping.php
delete mode 100644 app/Http/Utils/ExistsFilterManyManyMapping.php
delete mode 100644 app/Http/Utils/ExistsFilterManyToOneMapping.php
create mode 100644 app/Jobs/Job.php
rename resources/assets/less/app.less => app/Listeners/.gitkeep (100%)
rename app/{Models/main/Company.php => ModelSerializers/CompanySerializer.php} (70%)
rename app/{Models/summit/SummitVenueRoom.php => ModelSerializers/Locations/SummitAbstractLocationSerializer.php} (58%)
create mode 100644 app/ModelSerializers/Locations/SummitAirportSerializer.php
create mode 100644 app/ModelSerializers/Locations/SummitExternalLocationSerializer.php
create mode 100644 app/ModelSerializers/Locations/SummitGeoLocatedLocationSerializer.php
create mode 100644 app/ModelSerializers/Locations/SummitHotelSerializer.php
rename app/{Models/summit/SummitLocationMap.php => ModelSerializers/Locations/SummitLocationImageSerializer.php} (51%)
create mode 100644 app/ModelSerializers/Locations/SummitVenueFloorSerializer.php
create mode 100644 app/ModelSerializers/Locations/SummitVenueRoomSerializer.php
create mode 100644 app/ModelSerializers/Locations/SummitVenueSerializer.php
create mode 100644 app/ModelSerializers/MemberSerializer.php
rename app/{Models/summit/PresentationCategoryGroup.php => ModelSerializers/PresentationCategoryGroupSerializer.php} (53%)
create mode 100644 app/ModelSerializers/PresentationCategorySerializer.php
create mode 100644 app/ModelSerializers/PresentationLinkSerializer.php
rename app/{Models/summit/PresentationVideo.php => ModelSerializers/PresentationMaterialSerializer.php} (63%)
create mode 100644 app/ModelSerializers/PresentationSerializer.php
create mode 100644 app/ModelSerializers/PresentationSlideSerializer.php
create mode 100644 app/ModelSerializers/PresentationSpeakerSerializer.php
create mode 100644 app/ModelSerializers/PresentationVideoSerializer.php
create mode 100644 app/ModelSerializers/SerializerRegistry.php
create mode 100644 app/ModelSerializers/SilverStripeSerializer.php
create mode 100644 app/ModelSerializers/SummitAttendeeScheduleSerializer.php
create mode 100644 app/ModelSerializers/SummitAttendeeSerializer.php
create mode 100644 app/ModelSerializers/SummitEntityEventSerializer.php
create mode 100644 app/ModelSerializers/SummitEventFeedbackSerializer.php
create mode 100644 app/ModelSerializers/SummitEventSerializer.php
rename app/{Models/summit/SummitEventType.php => ModelSerializers/SummitEventTypeSerializer.php} (62%)
create mode 100644 app/ModelSerializers/SummitSerializer.php
create mode 100644 app/ModelSerializers/SummitTicketTypeSerializer.php
rename app/{Models/summit/SummitType.php => ModelSerializers/SummitTypeSerializer.php} (62%)
rename app/{Models/main/Tag.php => ModelSerializers/TagSerializer.php} (67%)
rename app/Models/{exceptions => Exceptions}/EntityNotFoundException.php (100%)
rename app/Models/{exceptions => Exceptions}/ValidationException.php (97%)
create mode 100644 app/Models/Foundation/Main/Company.php
rename app/Models/{main => Foundation/Main}/File.php (54%)
create mode 100644 app/Models/Foundation/Main/Member.php
create mode 100644 app/Models/Foundation/Main/Repositories/IMemberRepository.php
create mode 100644 app/Models/Foundation/Main/Tag.php
rename app/Models/{marketplace => Foundation/Marketplace}/CompanyService.php (100%)
rename app/Models/{marketplace => Foundation/Marketplace}/Consultant.php (100%)
rename app/Models/{marketplace => Foundation/Marketplace}/DataCenterLocation.php (100%)
rename app/Models/{marketplace => Foundation/Marketplace}/DataCenterRegion.php (100%)
rename app/Models/{marketplace => Foundation/Marketplace}/ICloudService.php (100%)
rename app/Models/{marketplace => Foundation/Marketplace}/ICloudServiceRepository.php (100%)
rename app/Models/{marketplace => Foundation/Marketplace}/ICompanyServiceRepository.php (100%)
rename app/Models/{marketplace => Foundation/Marketplace}/IConsultant.php (100%)
rename app/Models/{marketplace => Foundation/Marketplace}/IConsultantRepository.php (100%)
rename app/Models/{marketplace => Foundation/Marketplace}/IPrivateCloudServiceRepository.php (100%)
rename app/Models/{marketplace => Foundation/Marketplace}/IPublicCloudServiceRepository.php (100%)
rename app/Models/{marketplace => Foundation/Marketplace}/Office.php (100%)
rename app/Models/{marketplace => Foundation/Marketplace}/PrivateCloudService.php (100%)
rename app/Models/{marketplace => Foundation/Marketplace}/PublicCloudService.php (100%)
create mode 100644 app/Models/Foundation/Summit/Attendees/ConfirmationExternalOrderRequest.php
create mode 100644 app/Models/Foundation/Summit/Attendees/SummitAttendee.php
create mode 100644 app/Models/Foundation/Summit/Attendees/SummitAttendeeSchedule.php
create mode 100644 app/Models/Foundation/Summit/Attendees/SummitAttendeeTicket.php
create mode 100644 app/Models/Foundation/Summit/EntityEvents/EntityEventList.php
create mode 100644 app/Models/Foundation/Summit/EntityEvents/SummitEntityEventProcessContext.php
create mode 100644 app/Models/Foundation/Summit/EntityEvents/Types/EntityEventType.php
create mode 100644 app/Models/Foundation/Summit/EntityEvents/Types/EntityEventTypeFactory.php
create mode 100644 app/Models/Foundation/Summit/EntityEvents/Types/GenericSummitEntityEventType.php
rename app/Models/{summit/SummitAirport.php => Foundation/Summit/EntityEvents/Types/IEntityEventType.php} (74%)
create mode 100644 app/Models/Foundation/Summit/EntityEvents/Types/MyScheduleEntityEventType.php
create mode 100644 app/Models/Foundation/Summit/EntityEvents/Types/PresentationCategoryEntityEventType.php
create mode 100644 app/Models/Foundation/Summit/EntityEvents/Types/PresentationCategoryGroupEntityEventType.php
create mode 100644 app/Models/Foundation/Summit/EntityEvents/Types/PresentationMaterialEntityEventType.php
create mode 100644 app/Models/Foundation/Summit/EntityEvents/Types/PresentationSpeakerEntityEventType.php
create mode 100644 app/Models/Foundation/Summit/EntityEvents/Types/SummitEntityEventType.php
create mode 100644 app/Models/Foundation/Summit/EntityEvents/Types/SummitEventEntityEventDeleteType.php
create mode 100644 app/Models/Foundation/Summit/EntityEvents/Types/SummitEventEntityEventInsertOrUpdateType.php
create mode 100644 app/Models/Foundation/Summit/EntityEvents/Types/SummitEventEntityEventType.php
create mode 100644 app/Models/Foundation/Summit/EntityEvents/Types/SummitEventRelationEntityEventType.php
create mode 100644 app/Models/Foundation/Summit/EntityEvents/Types/SummitEventTypeEntityEventType.php
create mode 100644 app/Models/Foundation/Summit/EntityEvents/Types/SummitLocationEntityEventType.php
create mode 100644 app/Models/Foundation/Summit/EntityEvents/Types/SummitLocationImageEventType.php
create mode 100644 app/Models/Foundation/Summit/EntityEvents/Types/SummitTicketTypeEntityEventType.php
create mode 100644 app/Models/Foundation/Summit/EntityEvents/Types/SummitTypeEntityEventType.php
create mode 100644 app/Models/Foundation/Summit/EntityEvents/Types/SummitVenueFloorEntityEventType.php
create mode 100644 app/Models/Foundation/Summit/EntityEvents/Types/TrackFromTrackGroupEventType.php
create mode 100644 app/Models/Foundation/Summit/EntityEvents/Types/WipeDataEntityEventType.php
create mode 100644 app/Models/Foundation/Summit/Events/Presentations/Materials/PresentationLink.php
create mode 100644 app/Models/Foundation/Summit/Events/Presentations/Materials/PresentationMaterial.php
create mode 100644 app/Models/Foundation/Summit/Events/Presentations/Materials/PresentationSlide.php
create mode 100644 app/Models/Foundation/Summit/Events/Presentations/Materials/PresentationVideo.php
create mode 100644 app/Models/Foundation/Summit/Events/Presentations/Presentation.php
create mode 100644 app/Models/Foundation/Summit/Events/Presentations/PresentationCategory.php
create mode 100644 app/Models/Foundation/Summit/Events/Presentations/PresentationCategoryGroup.php
create mode 100644 app/Models/Foundation/Summit/Events/Presentations/PresentationSpeaker.php
create mode 100644 app/Models/Foundation/Summit/Events/SummitEntityEvent.php
create mode 100644 app/Models/Foundation/Summit/Events/SummitEvent.php
create mode 100644 app/Models/Foundation/Summit/Events/SummitEventFeedback.php
create mode 100644 app/Models/Foundation/Summit/Events/SummitEventType.php
create mode 100644 app/Models/Foundation/Summit/Factories/IPresentationVideoFactory.php
rename app/Models/{summit => Foundation/Summit/Factories}/SummitEventFactory.php (87%)
create mode 100644 app/Models/Foundation/Summit/Locations/SummitAbstractLocation.php
rename app/{Repositories/summit/EloquentSummitRepository.php => Models/Foundation/Summit/Locations/SummitAirport.php} (50%)
create mode 100644 app/Models/Foundation/Summit/Locations/SummitExternalLocation.php
create mode 100644 app/Models/Foundation/Summit/Locations/SummitGeoLocatedLocation.php
create mode 100644 app/Models/Foundation/Summit/Locations/SummitHotel.php
create mode 100644 app/Models/Foundation/Summit/Locations/SummitLocationImage.php
create mode 100644 app/Models/Foundation/Summit/Locations/SummitVenue.php
create mode 100644 app/Models/Foundation/Summit/Locations/SummitVenueFloor.php
create mode 100644 app/Models/Foundation/Summit/Locations/SummitVenueRoom.php
rename app/{Http/Controllers/apis/protected/summit/strategies/RetrieveAllSummitEventsBySummitStrategy.php => Models/Foundation/Summit/Repositories/IEventFeedbackRepository.php} (53%)
rename app/Models/{summit => Foundation/Summit/Repositories}/ISpeakerRepository.php (92%)
rename app/Models/{summit/SummitHotel.php => Foundation/Summit/Repositories/ISummitAttendeeRepository.php} (74%)
create mode 100644 app/Models/Foundation/Summit/Repositories/ISummitAttendeeTicketRepository.php
create mode 100644 app/Models/Foundation/Summit/Repositories/ISummitEntityEventRepository.php
rename app/Models/{summit => Foundation/Summit/Repositories}/ISummitEventRepository.php (73%)
rename app/Models/{summit => Foundation/Summit/Repositories}/ISummitRepository.php (100%)
create mode 100644 app/Models/Foundation/Summit/Summit.php
create mode 100644 app/Models/Foundation/Summit/SummitOwned.php
create mode 100644 app/Models/Foundation/Summit/SummitTicketType.php
create mode 100644 app/Models/Foundation/Summit/SummitType.php
rename app/Models/{oauth2 => OAuth2}/AccessToken.php (100%)
rename app/Models/{oauth2 => OAuth2}/IResourceServerContext.php (100%)
rename app/Models/{oauth2 => OAuth2}/ResourceServerContext.php (100%)
rename app/Models/{oauth2 => OAuth2}/Token.php (100%)
rename app/Models/{resource_server => ResourceServer}/AccessTokenService.php (95%)
rename app/Models/{resource_server => ResourceServer}/Api.php (100%)
rename app/Models/{resource_server => ResourceServer}/ApiEndpoint.php (100%)
rename app/Models/{resource_server => ResourceServer}/ApiScope.php (100%)
rename app/Models/{resource_server => ResourceServer}/IAccessTokenService.php (100%)
rename app/Models/{resource_server => ResourceServer}/IApi.php (100%)
rename app/Models/{resource_server => ResourceServer}/IApiEndpoint.php (100%)
rename app/Models/{resource_server => ResourceServer}/IApiEndpointRepository.php (100%)
rename app/Models/{resource_server => ResourceServer}/IApiScope.php (100%)
rename app/{Http/Utils/JoinFilterMapping.php => Models/Utils/PreRemoveEventArgs.php} (57%)
delete mode 100644 app/Models/main/Member.php
delete mode 100644 app/Models/summit/Presentation.php
delete mode 100644 app/Models/summit/PresentationCategory.php
delete mode 100644 app/Models/summit/PresentationMaterial.php
delete mode 100644 app/Models/summit/PresentationSlide.php
delete mode 100644 app/Models/summit/PresentationSpeaker.php
delete mode 100644 app/Models/summit/Summit.php
delete mode 100644 app/Models/summit/SummitAbstractLocation.php
delete mode 100644 app/Models/summit/SummitAttendee.php
delete mode 100644 app/Models/summit/SummitAttendeeTicket.php
delete mode 100644 app/Models/summit/SummitEntityEvent.php
delete mode 100644 app/Models/summit/SummitEvent.php
delete mode 100644 app/Models/summit/SummitEventFeedback.php
delete mode 100644 app/Models/summit/SummitGeoLocatedLocation.php
delete mode 100644 app/Models/summit/SummitLocationImage.php
delete mode 100644 app/Models/summit/SummitTicketType.php
delete mode 100644 app/Models/summit/SummitVenue.php
create mode 100644 app/Policies/.gitkeep
create mode 100644 app/Providers/AuthServiceProvider.php
delete mode 100644 app/Providers/BusServiceProvider.php
delete mode 100644 app/Providers/ConfigServiceProvider.php
create mode 100644 app/Repositories/DoctrineRepository.php
rename app/Repositories/{marketplace => Marketplace}/EloquentCompanyServiceRepository.php (100%)
rename app/Repositories/{marketplace => Marketplace}/EloquentConsultantRepository.php (100%)
rename app/Repositories/{marketplace => Marketplace}/EloquentPrivateCloudServiceRepository.php (100%)
rename app/Repositories/{marketplace => Marketplace}/EloquentPublicCloudServiceRepository.php (100%)
rename app/Repositories/{resource_server => ResourceServer}/EloquentApiEndpointRepository.php (100%)
create mode 100644 app/Repositories/SilverStripeDoctrineRepository.php
create mode 100644 app/Repositories/Summit/Doctrine/DoctrineEventFeedbackRepository.php
create mode 100644 app/Repositories/Summit/Doctrine/DoctrineMemberRepository.php
rename app/Repositories/{summit/EloquentSpeakerRepository.php => Summit/Doctrine/DoctrineSpeakerRepository.php} (62%)
create mode 100644 app/Repositories/Summit/Doctrine/DoctrineSummitAttendeeRepository.php
create mode 100644 app/Repositories/Summit/Doctrine/DoctrineSummitAttendeeTicketRepository.php
create mode 100644 app/Repositories/Summit/Doctrine/DoctrineSummitEntityEventRepository.php
create mode 100644 app/Repositories/Summit/Doctrine/DoctrineSummitEventRepository.php
create mode 100644 app/Repositories/Summit/Doctrine/DoctrineSummitRepository.php
delete mode 100644 app/Repositories/summit/EloquentSummitEventRepository.php
rename app/Services/{apis => Apis}/EventbriteAPI.php (100%)
rename app/Services/{apis => Apis}/IEventbriteAPI.php (100%)
create mode 100644 app/Services/Model/IPresentationService.php
rename app/Services/{model => Model}/ISummitService.php (87%)
create mode 100644 app/Services/Model/PresentationService.php
create mode 100644 app/Services/Model/SummitService.php
create mode 100644 app/Services/Utils/DoctrineTransactionService.php
rename app/Services/{utils => Utils}/EloquentTransactionService.php (100%)
rename app/Services/{utils => Utils}/RedisCacheService.php (100%)
delete mode 100644 app/Services/model/SummitService.php
mode change 100755 => 100644 artisan
create mode 100644 bootstrap/cache/.gitignore
create mode 100755 clear_logs.sh
create mode 100644 config/broadcasting.php
create mode 100644 config/doctrine.php
create mode 100644 database/factories/ModelFactory.php
delete mode 100644 phpspec.yml
create mode 100644 public/web.config
create mode 100644 resources/assets/sass/app.scss
create mode 100644 resources/lang/en/auth.php
delete mode 100644 setup.cfg
delete mode 100755 storage/.gitignore
create mode 100755 storage/app/public/.gitignore
create mode 100755 storage/proxies/.gitignore
create mode 100644 tests/DoctrineTest.php
create mode 100755 update_project.sh
diff --git a/.gitignore b/.gitignore
index 56caf5ad..b214c01b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,7 +3,6 @@
composer.phar
composer.lock
.DS_Storeapp/storage
-/app/storage/*
.idea/*
app/config/dev/*
app/config/testing/*
@@ -23,4 +22,6 @@ doc/build
*.egg
*.egg-info
.env.testing
-.env
\ No newline at end of file
+.env
+storage/logs/*
+*.log
\ No newline at end of file
diff --git a/Libs/ModelSerializers/AbstractSerializer.php b/Libs/ModelSerializers/AbstractSerializer.php
new file mode 100644
index 00000000..2e65e844
--- /dev/null
+++ b/Libs/ModelSerializers/AbstractSerializer.php
@@ -0,0 +1,187 @@
+object = $object;
+
+ }
+
+ protected static $array_mappings = array();
+
+ protected static $allowed_fields = array();
+
+ protected static $allowed_relations = array();
+
+ /**
+ * @return array
+ */
+ protected function getAllowedFields()
+ {
+ $mappings = array();
+ $hierarchy = $this->getClassHierarchy();
+
+ foreach($hierarchy as $class_name){
+ if($class_name === 'Libs\ModelSerializers\AbstractSerializer') continue;
+ $class = new $class_name($this->object);
+ $mappings = array_merge($mappings, $class->getSelfAllowedFields());
+ }
+ $mappings = array_merge($mappings, $this->getSelfAllowedFields());
+ return $mappings;
+ }
+
+ private function getSelfAllowedFields(){
+ return static::$allowed_fields;
+ }
+
+ /**
+ * @return array
+ */
+ protected function getAllowedRelations()
+ {
+ $mappings = array();
+ $hierarchy = $this->getClassHierarchy();
+
+ foreach($hierarchy as $class_name){
+ if($class_name === 'Libs\ModelSerializers\AbstractSerializer') continue;
+ $class = new $class_name($this->object);
+ $mappings = array_merge($mappings, $class->getSelfAllowedRelations());
+ }
+ $mappings = array_merge($mappings, $this->getSelfAllowedRelations());
+ return $mappings;
+ }
+
+ private function getSelfAllowedRelations(){
+ return static::$allowed_relations;
+ }
+
+ /**
+ * @return array
+ */
+ private function getAttributeMappings()
+ {
+ $mappings = array();
+ $hierarchy = $this->getClassHierarchy();
+
+ foreach($hierarchy as $class_name){
+ if($class_name === 'Libs\ModelSerializers\AbstractSerializer') continue;
+ $class = new $class_name($this->object);
+ $mappings = array_merge($mappings, $class->getSelfMappings());
+ }
+ $mappings = array_merge($mappings, $this->getSelfMappings());
+ return $mappings;
+ }
+
+ private function getSelfMappings(){
+ return static::$array_mappings;
+ }
+
+ /**
+ * @return array
+ */
+ private function getClassHierarchy(){
+ return array_reverse($this->get_class_lineage($this));
+ }
+
+ private function get_class_lineage($object)
+ {
+ $class_name = get_class($object);
+ $parents = array_values(class_parents($class_name));
+ return array_merge(array($class_name), $parents);
+ }
+
+ /**
+ * @param null $expand
+ * @param array $fields
+ * @param array $relations
+ * @param array $params
+ * @return array
+ */
+ public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() )
+ {
+ $values = array();
+ if(!count($fields)) $fields = $this->getAllowedFields();
+ $mappings = $this->getAttributeMappings();
+
+ if (count($mappings)) {
+ $new_values = array();
+ foreach ($mappings as $attribute => $mapping) {
+ $mapping = preg_split('/:/',$mapping);
+ $value = call_user_func( array( $this->object, 'get'.$attribute ) );
+ if(count($mapping) > 1)
+ {
+ //we have a formatter ...
+ switch(strtolower($mapping[1]))
+ {
+ case 'datetime_epoch':
+ {
+ if(!is_null($value)) {
+ $value = $value->getTimestamp();
+ }
+ }
+ break;
+ case 'json_string':
+ {
+ $value = JsonUtils::toJsonString($value);
+ }
+ break;
+ case 'json_boolean':
+ {
+ $value = JsonUtils::toJsonBoolean($value);
+ }
+ break;
+ case 'json_int':
+ {
+ $value = JsonUtils::toJsonInt($value);
+ }
+ break;
+ case 'json_float':
+ {
+ $value = JsonUtils::toJsonFloat($value);
+ }
+ break;
+ }
+ }
+ $new_values[$mapping[0]] = $value;
+ }
+ $values = $new_values;
+ }
+ //check requested fields
+ if(count($fields) > 0) {
+ foreach ($values as $field => $value) {
+ if (in_array($field, $fields)) continue;
+ unset($values[$field]);
+ }
+ }
+ return $values;
+ }
+}
\ No newline at end of file
diff --git a/Libs/ModelSerializers/IModelSerializer.php b/Libs/ModelSerializers/IModelSerializer.php
new file mode 100644
index 00000000..dcc7f461
--- /dev/null
+++ b/Libs/ModelSerializers/IModelSerializer.php
@@ -0,0 +1,25 @@
+comment(PHP_EOL.Inspiring::quote().PHP_EOL);
+ }
+}
diff --git a/app/Console/Commands/SummitJsonGenerator.php b/app/Console/Commands/SummitJsonGenerator.php
index d89d95d7..9b094ec4 100644
--- a/app/Console/Commands/SummitJsonGenerator.php
+++ b/app/Console/Commands/SummitJsonGenerator.php
@@ -1,19 +1,31 @@
repository->getCurrent();
- if(is_null($this->repository)) return;
- $this->info(sprintf("processing summit id %s", $summit->ID));
+ $summit_id = $this->argument('summit_id');
+
+ if(is_null($summit_id))// if we dont provide a summit id, then get current
+ $summit = $this->repository->getCurrent();
+ else
+ $summit = $this->repository->getById(intval($summit_id));
+
+ if(is_null($summit)) return;
+
+ $this->info(sprintf("processing summit id %s", $summit->getIdentifier()));
$start = time();
- $data = $this->service->getSummitData($summit, $expand = 'locations,sponsors,summit_types,event_types,presentation_categories,schedule');
+ $expand = 'locations,sponsors,summit_types,event_types,presentation_categories,schedule';
+
+ $data = SerializerRegistry::getInstance()->getSerializer($summit)->serialize($expand);
if(is_null($data)) return;
$end = time();
$delta = $end - $start;
$this->info(sprintf("execution call %s seconds", $delta));
$current_time = time();
- $key = '/api/v1/summits/current.expand=locations%2Csponsors%2Csummit_types%2Cevent_types%2Cpresentation_categories%2Cschedule';
+ $key_current = sprintf('/api/v1/summits/%s.expand=%s','current', urlencode($expand));
+ $key_id = sprintf('/api/v1/summits/%s.expand=%s',$summit->getIdentifier(), urlencode($expand));
+
$cache_lifetime = intval(Config::get('server.response_cache_lifetime', 300));
- $this->cache_service->setSingleValue($key, json_encode($data), $cache_lifetime);
- $this->cache_service->setSingleValue($key.".generated", $current_time, $cache_lifetime);
- $this->info(sprintf("regenerated cache for summit id %s", $summit->ID));
+
+ if($summit->isActive())
+ {
+ $this->cache_service->setSingleValue($key_current, json_encode($data), $cache_lifetime);
+ $this->cache_service->setSingleValue($key_current . ".generated", $current_time, $cache_lifetime);
+ }
+
+ $this->cache_service->setSingleValue($key_id, json_encode($data), $cache_lifetime);
+ $this->cache_service->setSingleValue($key_id.".generated", $current_time, $cache_lifetime);
+
+ $this->info(sprintf("regenerated cache for summit id %s", $summit->getIdentifier()));
}
}
diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php
index a0e0d7f8..951ba586 100644
--- a/app/Console/Kernel.php
+++ b/app/Console/Kernel.php
@@ -1,29 +1,32 @@
-command('summit:json:generator')->everyTenMinutes();
- }
+ /**
+ * Define the application's command schedule.
+ *
+ * @param \Illuminate\Console\Scheduling\Schedule $schedule
+ * @return void
+ */
+ protected function schedule(Schedule $schedule)
+ {
+ // current
+ $schedule->command('summit:json-generator')->everyTenMinutes()->withoutOverlapping();
+ //austin
+ $schedule->command('summit:json-generator 6')->everyTenMinutes()->withoutOverlapping();
+ }
}
diff --git a/app/Events/Event.php b/app/Events/Event.php
index d59f7690..ba2f8883 100644
--- a/app/Events/Event.php
+++ b/app/Events/Event.php
@@ -1,7 +1,8 @@
-material = $material;
+ }
+
+ /**
+ * @return PresentationMaterial
+ */
+ public function getMaterial(){
+ return $this->material;
+ }
+}
\ No newline at end of file
diff --git a/app/Models/main/Image.php b/app/Events/SummitEventCreated.php
similarity index 72%
rename from app/Models/main/Image.php
rename to app/Events/SummitEventCreated.php
index b710fd15..0149d474 100644
--- a/app/Models/main/Image.php
+++ b/app/Events/SummitEventCreated.php
@@ -1,6 +1,6 @@
-summit_event = $summit_event;
+ $this->args = $args;
+ }
+
+ /**
+ * @return SummitEvent
+ */
+ public function getSummitEvent()
+ {
+ return $this->summit_event;
+ }
+
+ /**
+ * @return LifecycleEventArgs
+ */
+ public function getArgs()
+ {
+ return $this->args;
+ }
+
+}
\ No newline at end of file
diff --git a/app/Events/SummitEventUpdated.php b/app/Events/SummitEventUpdated.php
new file mode 100644
index 00000000..720306d8
--- /dev/null
+++ b/app/Events/SummitEventUpdated.php
@@ -0,0 +1,22 @@
+view('errors.404', [], 404);
}
-
}
diff --git a/app/Factories/FactoriesProvider.php b/app/Factories/FactoriesProvider.php
new file mode 100644
index 00000000..773d10d5
--- /dev/null
+++ b/app/Factories/FactoriesProvider.php
@@ -0,0 +1,32 @@
+setYoutubeId(trim($data['you_tube_id']));
+ $video->setDateUploaded($utc_now);
+
+ if(isset($data['name']))
+ $video->setName(trim($data['name']));
+
+ if(isset($data['description']))
+ $video->setDescription(trim($data['description']));
+
+ $video->setDisplayOnSite(isset($data['display_on_site']) ? (bool)$data['display_on_site'] : true);
+
+ return $video;
+ }
+}
\ No newline at end of file
diff --git a/app/Handlers/Commands/.gitkeep b/app/Handlers/Commands/.gitkeep
deleted file mode 100644
index e69de29b..00000000
diff --git a/app/Handlers/Events/.gitkeep b/app/Handlers/Events/.gitkeep
deleted file mode 100644
index e69de29b..00000000
diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php
index 27b3f452..c9fa9197 100644
--- a/app/Http/Controllers/Controller.php
+++ b/app/Http/Controllers/Controller.php
@@ -1,11 +1,16 @@
setCallback(Input::get('callback'));
}
-
return $res;
}
-
+ /**
+ * @param mixed $data
+ * @return mixed
+ */
protected function ok($data = 'ok')
{
$res = Response::json($data, 200);
diff --git a/app/Http/Controllers/apis/protected/summit/CheckAttendeeStrategyFactory.php b/app/Http/Controllers/apis/protected/summit/CheckAttendeeStrategyFactory.php
index 30f6e6ae..2b33c540 100644
--- a/app/Http/Controllers/apis/protected/summit/CheckAttendeeStrategyFactory.php
+++ b/app/Http/Controllers/apis/protected/summit/CheckAttendeeStrategyFactory.php
@@ -1,4 +1,4 @@
-presentation_service = $presentation_service;
+ $this->summit_repository = $summit_repository;
+ }
+
+ //presentations
+
+ //videos
+
+ public function getPresentationVideos($summit_id, $presentation_id){
+ try {
+ $summit = SummitFinderStrategyFactory::build($this->summit_repository)->find($summit_id);
+ if (is_null($summit)) return $this->error404();
+
+ } catch (Exception $ex) {
+ Log::error($ex);
+ return $this->error500($ex);
+ }
+ }
+
+
+ public function getPresentationVideo($summit_id, $presentation_id,$video_id){
+ try {
+ $summit = SummitFinderStrategyFactory::build($this->summit_repository)->find($summit_id);
+ if (is_null($summit)) return $this->error404();
+
+ } catch (Exception $ex) {
+ Log::error($ex);
+ return $this->error500($ex);
+ }
+ }
+
+ public function addVideo(LaravelRequest $request, $summit_id, $presentation_id){
+ try {
+ $summit = SummitFinderStrategyFactory::build($this->summit_repository)->find($summit_id);
+ if (is_null($summit)) return $this->error404();
+
+ if (!$request->isJson()) {
+ return $this->error412(array('invalid content type!'));
+ }
+ if(!Request::isJson()) return $this->error403();
+
+ $data = Input::json();
+
+ $rules = array
+ (
+ 'you_tube_id' => 'required|alpha_dash',
+ 'name' => 'sometimes|required|text:512',
+ 'description' => 'sometimes|required|text|max:512',
+ 'display_on_site' => 'sometimes|required|boolean',
+ );
+
+ $data = $data->all();
+ // Creates a Validator instance and validates the data.
+ $validation = Validator::make($data, $rules);
+
+ if ($validation->fails()) {
+ $ex = new ValidationException;
+ $ex->setMessages($validation->messages()->toArray());
+ throw $ex;
+ }
+
+ $video = $this->presentation_service->addVideoTo($presentation_id, $data);
+
+ return $this->created($video->getId());
+ }
+ catch (EntityNotFoundException $ex1)
+ {
+ Log::warning($ex1);
+ return $this->error404();
+ }
+ catch (ValidationException $ex2)
+ {
+ Log::warning($ex2);
+ return $this->error412($ex2->getMessages());
+ }
+ catch (Exception $ex)
+ {
+ Log::error($ex);
+ return $this->error500($ex);
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/Http/Controllers/apis/protected/summit/OAuth2SummitApiController.php b/app/Http/Controllers/apis/protected/summit/OAuth2SummitApiController.php
index 6e3ab639..f807afe4 100644
--- a/app/Http/Controllers/apis/protected/summit/OAuth2SummitApiController.php
+++ b/app/Http/Controllers/apis/protected/summit/OAuth2SummitApiController.php
@@ -1,27 +1,6 @@
repository = $summit_repository;
- $this->speaker_repository = $speaker_repository;
- $this->event_repository = $event_repository;
- $this->service = $service;
+ $this->repository = $summit_repository;
+ $this->speaker_repository = $speaker_repository;
+ $this->event_repository = $event_repository;
+ $this->event_feedback_repository = $event_feedback_repository;
+ $this->service = $service;
}
public function getSummits()
{
try {
- $summits = $this->repository->getAll();
+ $summits = array();
+ foreach($this->repository->getAll() as $summit){
+ $summits[] = SerializerRegistry::getInstance()->getSerializer($summit)->serialize();
+ }
return $this->ok($summits);
}
catch (Exception $ex) {
@@ -88,1114 +96,13 @@ class OAuth2SummitApiController extends OAuth2ProtectedController
try {
$summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
if (is_null($summit)) return $this->error404();
- $data = $this->service->getSummitData($summit, $expand);
- return $this->ok($data);
+ return $this->ok(SerializerRegistry::getInstance()->getSerializer($summit)->serialize($expand));
} catch (Exception $ex) {
Log::error($ex);
return $this->error500($ex);
}
}
- /**
- * Attendees endpoints
- */
-
- /**
- * @param $summit_id
- * @return mixed
- */
- public function getAttendees($summit_id)
- {
- try {
-
- $values = Input::all();
-
- $rules = array
- (
- 'page' => 'integer|min:1',
- 'per_page' => 'required_with:page|integer|min:5|max:100',
- );
-
- $validation = Validator::make($values, $rules);
-
- if ($validation->fails()) {
- $messages = $validation->messages()->toArray();
- return $this->error412($messages);
- }
-
- $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
- if (is_null($summit)) return $this->error404();
-
- // default values
- $page = 1;
- $per_page = 5;
-
- if (Input::has('page')) {
- $page = intval(Input::get('page'));
- $per_page = intval(Input::get('per_page'));
- }
-
- $filter = null;
- if (Input::has('filter')) {
- $filter = FilterParser::parse(Input::get('filter'), array
- (
- 'first_name' => array('=@', '=='),
- 'last_name' => array('=@', '=='),
- 'email' => array('=@', '=='),
- ));
- }
-
- $order = null;
- if (Input::has('order'))
- {
- $order = OrderParser::parse(Input::get('order'), array
- (
- 'first_name',
- 'last_name',
- ));
- }
-
- list($total, $per_page, $current_page, $last_page, $items) = $summit->attendees($page, $per_page, $filter, $order);
-
- return $this->ok
- (
- array
- (
- 'total' => $total,
- 'per_page' => $per_page,
- 'current_page' => $current_page,
- 'last_page' => $last_page,
- 'data' => $items,
- )
- );
-
- }
- catch (Exception $ex)
- {
- Log::error($ex);
- return $this->error500($ex);
- }
- }
-
- /**
- * @param $summit_id
- * @param $attendee_id
- * @return mixed
- */
- public function getAttendee($summit_id, $attendee_id)
- {
- $expand = Request::input('expand', '');
-
- try {
-
- $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
- if (is_null($summit)) return $this->error404();
-
- $attendee = CheckAttendeeStrategyFactory::build(CheckAttendeeStrategyFactory::Own, $this->resource_server_context)->check($attendee_id, $summit);
- if(is_null($attendee)) return $this->error404();
-
- $data = $attendee->toArray();
- $speaker = $summit->getSpeakerByMemberId(intval($data['member_id']));
-
- if (!is_null($speaker)) {
- $data['speaker_id'] = intval($speaker->ID);
- }
-
- if (!empty($expand)) {
- $expand = explode(',', $expand);
- foreach ($expand as $relation) {
- switch (trim($relation)) {
- case 'schedule': {
- unset($data['schedule']);
- $schedule = array();
- foreach ($attendee->schedule() as $event) {
- $event->setFromAttendee();
- array_push($schedule, $event->toArray());
- }
- $data['schedule'] = $schedule;
- }
- break;
- case 'ticket_type': {
- unset($data['tickets']);
- $tickets = array();
- foreach($attendee->tickets() as $t)
- {
- array_push($tickets, $t->ticket_type()->toArray());
- }
- $data['tickets'] = $tickets;
- }
- break;
- case 'speaker': {
- if (!is_null($speaker))
- {
- unset($data['speaker_id']);
- $data['speaker'] = $speaker->toArray();
- }
- }
- break;
- case 'feedback': {
- $feedback = array();
- foreach ($attendee->emitted_feedback() as $f) {
- array_push($feedback, $f->toArray());
- }
- $data['feedback'] = $feedback;
- }
- break;
- }
- }
- }
-
- return $this->ok($data);
- }
- catch (\HTTP401UnauthorizedException $ex1) {
- Log::warning($ex1);
- return $this->error401();
- }
- catch (Exception $ex) {
- Log::error($ex);
- return $this->error500($ex);
- }
- }
-
- /**
- * @param $summit_id
- * @param $attendee_id
- * @return mixed
- */
- public function getAttendeeSchedule($summit_id, $attendee_id)
- {
- try {
-
- $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
- if (is_null($summit)) return $this->error404();
-
- $attendee = CheckAttendeeStrategyFactory::build(CheckAttendeeStrategyFactory::Own, $this->resource_server_context)->check($attendee_id, $summit);
- if(is_null($attendee)) return $this->error404();
-
- $schedule = array();
- foreach ($attendee->schedule() as $event) {
- $event->setFromAttendee();
- array_push($schedule, $event->toArray());
- }
-
- return $this->ok($schedule);
- }
- catch (\HTTP401UnauthorizedException $ex1)
- {
- Log::warning($ex1);
- return $this->error401();
- }
- catch (Exception $ex) {
- Log::error($ex);
- return $this->error500($ex);
- }
- }
-
- /**
- * @param $summit_id
- * @param $attendee_id
- * @param $event_id
- * @return mixed
- */
- public function addEventToAttendeeSchedule($summit_id, $attendee_id, $event_id)
- {
- try {
-
- $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
- if (is_null($summit)) return $this->error404();
-
- $attendee = CheckAttendeeStrategyFactory::build(CheckAttendeeStrategyFactory::Own, $this->resource_server_context)->check($attendee_id, $summit);
- if (is_null($attendee)) return $this->error404();
-
- $res = $this->service->addEventToAttendeeSchedule($summit, $attendee, intval($event_id));
-
- return $res ? $this->created() : $this->error400();
- }
- catch (ValidationException $ex1)
- {
- Log::warning($ex1);
- return $this->error412(array( $ex1->getMessage()));
- }
- catch (EntityNotFoundException $ex2)
- {
- Log::warning($ex2);
- return $this->error404(array('message' => $ex2->getMessage()));
- }
- catch(\HTTP401UnauthorizedException $ex3)
- {
- Log::warning($ex3);
- return $this->error401();
- }
- catch (Exception $ex)
- {
- Log::error($ex);
- return $this->error500($ex);
- }
- }
-
- /**
- * @param $summit_id
- * @param $attendee_id
- * @param $event_id
- * @return mixed
- */
- public function removeEventFromAttendeeSchedule($summit_id, $attendee_id, $event_id)
- {
- try {
-
- $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
- if (is_null($summit)) return $this->error404();
-
- $attendee = CheckAttendeeStrategyFactory::build(CheckAttendeeStrategyFactory::Own, $this->resource_server_context)->check($attendee_id, $summit);
- if (is_null($attendee)) return $this->error404();
-
- $res = $this->service->removeEventFromAttendeeSchedule($summit, $attendee, intval($event_id));
-
- return $res ? $this->deleted() : $this->error400();
-
- }
- catch (ValidationException $ex1)
- {
- Log::warning($ex1);
- return $this->error412(array( $ex1->getMessage()));
- }
- catch (EntityNotFoundException $ex2)
- {
- Log::warning($ex2);
- return $this->error404(array('message' => $ex2->getMessage()));
- }
- catch(\HTTP401UnauthorizedException $ex3)
- {
- Log::warning($ex3);
- return $this->error401();
- }
- catch (Exception $ex)
- {
- Log::error($ex);
- return $this->error500($ex);
- }
- }
-
- /**
- * @param $summit_id
- * @param $attendee_id
- * @param $event_id
- * @return mixed
- */
- public function checkingAttendeeOnEvent($summit_id, $attendee_id, $event_id)
- {
- try {
-
- $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
- if (is_null($summit)) return $this->error404();
-
- $attendee = CheckAttendeeStrategyFactory::build(CheckAttendeeStrategyFactory::Own, $this->resource_server_context)->check($attendee_id, $summit);
- if (is_null($attendee)) return $this->error404();
-
- $res = $this->service->checkInAttendeeOnEvent($summit, $attendee, intval($event_id));
-
- return $res ? $this->updated() : $this->error400();
- }
- catch (ValidationException $ex1)
- {
- Log::warning($ex1);
- return $this->error412(array( $ex1->getMessage()));
- }
- catch (EntityNotFoundException $ex2)
- {
- Log::warning($ex2);
- return $this->error404(array('message' => $ex2->getMessage()));
- }
- catch(\HTTP401UnauthorizedException $ex3)
- {
- Log::warning($ex3);
- return $this->error401();
- }
- catch (Exception $ex) {
- Log::error($ex);
- return $this->error500($ex);
- }
- }
-
- /**
- * Speakers endpoints
- */
-
- /**
- * @param $summit_id
- * @return mixed
- */
- public function getSpeakers($summit_id)
- {
- try {
-
- $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
- if (is_null($summit)) return $this->error404();
-
- $values = Input::all();
-
- $rules = array
- (
- 'page' => 'integer|min:1',
- 'per_page' => 'required_with:page|integer|min:10|max:100',
- );
-
- $validation = Validator::make($values, $rules);
-
- if ($validation->fails())
- {
- $messages = $validation->messages()->toArray();
-
- return $this->error412($messages);
- }
-
- // default values
- $page = 1;
- $per_page = 10;
-
- if (Input::has('page'))
- {
- $page = intval(Input::get('page'));
- $per_page = intval(Input::get('per_page'));
- }
-
- $filter = null;
- if (Input::has('filter'))
- {
- $filter = FilterParser::parse(Input::get('filter'), array
- (
- 'first_name' => array('=@', '=='),
- 'last_name' => array('=@', '=='),
- 'email' => array('=@', '=='),
- ));
- }
-
-
- $order = null;
- if (Input::has('order'))
- {
- $order = OrderParser::parse(Input::get('order'), array
- (
- 'first_name',
- 'last_name',
- ));
- }
-
- $result = $this->speaker_repository->getSpeakersBySummit($summit, new PagingInfo($page, $per_page), $filter, $order);
-
- return $this->ok
- (
- $result->toArray()
- );
- }
- catch (Exception $ex)
- {
- Log::error($ex);
- return $this->error500($ex);
- }
- }
-
- /**
- * @param $summit_id
- * @param $speaker_id
- * @return mixed
- */
- public function getSpeaker($summit_id, $speaker_id)
- {
- $expand = Request::input('expand', '');
-
- try {
-
- $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
- if (is_null($summit)) return $this->error404();
-
- $speaker = CheckSpeakerStrategyFactory::build(CheckSpeakerStrategyFactory::Me, $this->resource_server_context)->check($speaker_id, $summit);
- if (is_null($speaker)) return $this->error404();
-
- $data = $speaker->toArray($summit->ID);
-
- if (!empty($expand)) {
- $expand = explode(',', $expand);
- foreach ($expand as $relation) {
- switch (trim($relation)) {
- case 'presentations': {
- $presentations = array();
- unset($data['presentations']);
- foreach ($speaker->presentations($summit->ID) as $event) {
- $event->setFromSpeaker();
- array_push($presentations, $event->toArray());
- }
- $data['presentations'] = $presentations;
- }
- break;
- }
- }
- }
-
- return $this->ok($data);
-
- } catch (Exception $ex) {
- Log::error($ex);
- return $this->error500($ex);
- }
- }
-
- /**
- * Events endpoints
- */
-
- /**
- * @param $summit_id
- * @return mixed
- */
- public function getEvents($summit_id)
- {
- try
- {
- $strategy = new RetrieveAllSummitEventsBySummitStrategy($this->repository);
- return $this->ok($strategy->getEvents(array('summit_id' => $summit_id))->toArray());
- }
- catch (EntityNotFoundException $ex1)
- {
- Log::warning($ex1);
- return $this->error404();
- }
- catch (ValidationException $ex2)
- {
- Log::warning($ex2);
- return $this->error412($ex2->getMessages());
- }
- catch (Exception $ex)
- {
- Log::error($ex);
- return $this->error500($ex);
- }
- }
-
- /**
- * @param $summit_id
- * @return mixed
- */
- public function getScheduledEvents($summit_id)
- {
- try
- {
- $strategy = new RetrievePublishedSummitEventsBySummitStrategy($this->repository);
- return $this->ok($strategy->getEvents(array('summit_id' => $summit_id))->toArray());
- }
- catch (EntityNotFoundException $ex1)
- {
- Log::warning($ex1);
- return $this->error404();
- }
- catch (ValidationException $ex2)
- {
- Log::warning($ex2);
- return $this->error412($ex2->getMessages());
- }
- catch (Exception $ex)
- {
- Log::error($ex);
- return $this->error500($ex);
- }
- }
-
- public function getAllEvents()
- {
- try
- {
- $strategy = new RetrieveAllSummitEventsStrategy($this->event_repository);
- return $this->ok($strategy->getEvents()->toArray());
- }
- catch (EntityNotFoundException $ex1)
- {
- Log::warning($ex1);
- return $this->error404();
- }
- catch (ValidationException $ex2)
- {
- Log::warning($ex2);
- return $this->error412($ex2->getMessages());
- }
- catch (Exception $ex)
- {
- Log::error($ex);
- return $this->error500($ex);
- }
- }
-
- public function getAllScheduledEvents()
- {
- try
- {
- $strategy = new RetrieveAllPublishedSummitEventsStrategy($this->event_repository);
- return $this->ok($strategy->getEvents()->toArray());
- }
- catch (EntityNotFoundException $ex1)
- {
- Log::warning($ex1);
- return $this->error404();
- }
- catch (ValidationException $ex2)
- {
- Log::warning($ex2);
- return $this->error412($ex2->getMessages());
- }
- catch (Exception $ex)
- {
- Log::error($ex);
- return $this->error500($ex);
- }
- }
-
- /**
- * @param $summit_id
- * @param $event_id
- * @param string $expand
- * @param string $fields
- * @param string $relations
- * @param bool $published
- * @return array
- * @throws EntityNotFoundException
- */
- private function _getSummitEvent($summit_id, $event_id, $expand = '', $fields = '', $relations = '', $published = true)
- {
- $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
- if (is_null($summit)) throw new EntityNotFoundException;
-
- $event = $published ? $summit->getScheduleEvent(intval($event_id)) : $summit->getEvent(intval($event_id));
-
- if (is_null($event)) throw new EntityNotFoundException;
- $relations = !empty($relations) ? explode(',', $relations) : array();
- $fields = !empty($fields) ? explode(',', $fields) : array();
- $data = $event->toArray($fields, $relations);
-
- if (!empty($expand)) {
- foreach (explode(',', $expand) as $relation) {
- switch (trim($relation)) {
- case 'feedback': {
- $feedback = array();
- list($total, $per_page, $current_page, $last_page, $items) = $event->feedback(1, PHP_INT_MAX);
- foreach ($items as $f) {
- array_push($feedback, $f->toArray());
- }
- $data['feedback'] = $feedback;
- }
- break;
- case 'speakers':{
- if($event instanceof Presentation){
- unset($data['speakers']);
- $speakers = array();
- foreach($event->speakers() as $speaker)
- {
- array_push($speakers, $speaker->toArray());
- }
- $data['speakers'] = $speakers;
- }
- }
- break;
- case 'location': {
- $location = $event->getLocation();
- $data['location'] = $location->toArray();
- unset($data['location_id']);
- }
- break;
- }
- }
- }
- return $data;
- }
- /**
- * @param $summit_id
- * @param $event_id
- * @return mixed
- */
- public function getEvent($summit_id, $event_id)
- {
- try {
-
- $expand = Request::input('expand', '');
- $fields = Request::input('fields', '');
- $relations = Request::input('relations', '');
-
- $data = $this->_getSummitEvent($summit_id, $event_id, $expand, $fields, $relations, false);
- return $this->ok($data);
- }
- catch (EntityNotFoundException $ex1) {
- Log::warning($ex1);
- return $this->error404();
- }
- catch (Exception $ex) {
- Log::error($ex);
- return $this->error500($ex);
- }
- }
-
- /**
- * @param $summit_id
- * @param $event_id
- * @return mixed
- */
- public function getScheduledEvent($summit_id, $event_id)
- {
- try {
-
- $expand = Request::input('expand', '');
- $fields = Request::input('fields', '');
- $relations = Request::input('relations', '');
-
- $data = $this->_getSummitEvent($summit_id, $event_id, $expand, $fields, $relations, true);
- return $this->ok($data);
- }
- catch (EntityNotFoundException $ex1) {
- Log::warning($ex1);
- return $this->error404();
- }
- catch (Exception $ex) {
- Log::error($ex);
- return $this->error500($ex);
- }
- }
-
- /**
- * @param $summit_id
- * @return mixed
- */
- public function addEvent($summit_id)
- {
- try {
- $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
- if (is_null($summit)) return $this->error404();
- if(!Request::isJson()) return $this->error403();
- $data = Input::json();
-
- $rules = array
- (
- 'title' => 'required|string|max:300',
- 'description' => 'required|string',
- 'location_id' => 'sometimes|required|integer',
- 'start_date' => 'sometimes|required|date_format:U',
- 'end_date' => 'sometimes|required_with:start_date|date_format:U|after:start_date',
- 'allow_feedback' => 'sometimes|required|boolean',
- 'type_id' => 'required|integer',
- 'summit_types_id' => 'required|int_array',
- 'tags' => 'sometimes|required|string_array',
- );
-
- // Creates a Validator instance and validates the data.
- $validation = Validator::make($data->all(), $rules);
-
- if ($validation->fails()) {
- $messages = $validation->messages()->toArray();
-
- return $this->error412
- (
- $messages
- );
- }
-
- $fields = array
- (
- 'title',
- 'description'
- );
-
- $event = $this->service->addEvent($summit, HTMLCleaner::cleanData($data->all(), $fields));
-
- return $this->created($event);
- }
- catch (ValidationException $ex1) {
- Log::warning($ex1);
- return $this->error412(array($ex1->getMessage()));
- }
- catch(EntityNotFoundException $ex2)
- {
- Log::warning($ex2);
- return $this->error404(array('message'=> $ex2->getMessage()));
- }
- catch (Exception $ex) {
- Log::error($ex);
- return $this->error500($ex);
- }
- }
-
- /**
- * @param $summit_id
- * @param $event_id
- * @return mixed
- */
- public function updateEvent($summit_id, $event_id)
- {
- try {
- $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
- if (is_null($summit)) return $this->error404();
-
- if(!Request::isJson()) return $this->error403();
- $data = Input::json();
-
- $rules = array
- (
- 'title' => 'sometimes|required|string|max:300',
- 'description' => 'sometimes|required|string',
- 'location_id' => 'sometimes|required|integer',
- 'start_date' => 'sometimes|required|date_format:U',
- 'end_date' => 'sometimes|required_with:start_date|date_format:U|after:start_date',
- 'allow_feedback' => 'sometimes|required|boolean',
- 'type_id' => 'sometimes|required|integer',
- 'summit_types_id' => 'sometimes|required|int_array',
- 'tags' => 'sometimes|required|string_array',
- );
-
- // Creates a Validator instance and validates the data.
- $validation = Validator::make($data->all(), $rules);
-
- if ($validation->fails()) {
- $messages = $validation->messages()->toArray();
-
- return $this->error412
- (
- $messages
- );
- }
-
- $fields = array
- (
- 'title',
- 'description'
- );
-
- $event = $this->service->updateEvent($summit, $event_id, HTMLCleaner::cleanData($data->all(), $fields));
-
- return $this->ok($event);
-
- }
- catch (ValidationException $ex1)
- {
- Log::warning($ex1);
- return $this->error412(array($ex1->getMessage()));
- }
- catch(EntityNotFoundException $ex2)
- {
- Log::warning($ex2);
- return $this->error404(array('message'=> $ex2->getMessage()));
- }
- catch (Exception $ex) {
- Log::error($ex);
- return $this->error500($ex);
- }
- }
-
- /**
- * @param $summit_id
- * @param $event_id
- * @return mixed
- */
- public function publishEvent($summit_id, $event_id)
- {
- try {
- $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
- if (is_null($summit)) return $this->error404();
-
- if(!Request::isJson()) return $this->error403();
- $data = Input::json();
-
- $rules = array
- (
- 'location_id' => 'sometimes|required|integer',
- 'start_date' => 'sometimes|required|date_format:U',
- 'end_date' => 'sometimes|required_with:start_date|date_format:U|after:start_date',
- );
-
- // Creates a Validator instance and validates the data.
- $validation = Validator::make($data->all(), $rules);
-
- if ($validation->fails()) {
- $messages = $validation->messages()->toArray();
-
- return $this->error412
- (
- $messages
- );
- }
-
- $this->service->publishEvent($summit, $event_id, $data->all());
-
- return $this->updated();
- }
- catch (ValidationException $ex1)
- {
- Log::warning($ex1);
- return $this->error412(array($ex1->getMessage()));
- }
- catch(EntityNotFoundException $ex2)
- {
- Log::warning($ex2);
- return $this->error404(array('message'=> $ex2->getMessage()));
- }
- catch (Exception $ex) {
- Log::error($ex);
- return $this->error500($ex);
- }
- }
-
- /**
- * @param $summit_id
- * @param $event_id
- * @return mixed
- */
- public function unPublishEvent($summit_id, $event_id)
- {
- try {
- $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
- if (is_null($summit)) return $this->error404();
-
- if(!Request::isJson()) return $this->error403();
-
-
- $this->service->unPublishEvent($summit, $event_id);
-
- return $this->deleted();
- }
- catch (ValidationException $ex1)
- {
- Log::warning($ex1);
- return $this->error412(array($ex1->getMessage()));
- }
- catch(EntityNotFoundException $ex2)
- {
- Log::warning($ex2);
- return $this->error404(array('message'=> $ex2->getMessage()));
- }
- catch (Exception $ex) {
- Log::error($ex);
- return $this->error500($ex);
- }
- }
-
- /**
- * @param $summit_id
- * @param $event_id
- * @return mixed
- */
- public function deleteEvent($summit_id, $event_id)
- {
- try {
- $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
- if (is_null($summit)) return $this->error404();
-
- $this->service->deleteEvent($summit, $event_id);
-
- return $this->deleted();
- }
- catch (ValidationException $ex1)
- {
- Log::warning($ex1);
- return $this->error412(array($ex1->getMessage()));
- }
- catch(EntityNotFoundException $ex2)
- {
- Log::warning($ex2);
- return $this->error404(array('message'=> $ex2->getMessage()));
- }
- catch (Exception $ex) {
- Log::error($ex);
- return $this->error500($ex);
- }
- }
- /**
- * @param $summit_id
- * @param $event_id
- * @param $attendee_id
- * @return mixed
- */
- public function getEventFeedback($summit_id, $event_id, $attendee_id = null)
- {
-
- try {
-
- $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
- if (is_null($summit)) return $this->error404();
-
- $expand = Request::input('expand', '');
-
- $values = Input::all();
-
- $rules = array
- (
- 'page' => 'integer|min:1',
- 'per_page' => 'required_with:page|integer|min:5|max:100',
- );
-
- $validation = Validator::make($values, $rules);
-
- if ($validation->fails()) {
- $messages = $validation->messages()->toArray();
-
- return $this->error412($messages);
- }
-
- $event = $summit->getScheduleEvent(intval($event_id));
-
- if (is_null($event)) {
- return $this->error404();
- }
-
- $filter = null;
- if (!is_null($attendee_id)) // add filter by attendee, this case me
- {
- if($attendee_id !== 'me') return $this->error403();
- $member_id = $this->resource_server_context->getCurrentUserExternalId();
- if (is_null($member_id)) return $this->error404();
-
- $filter = FilterParser::parse(array('owner_id' => $member_id), array
- (
- 'owner_id' => array('=='),
- ));
- }
-
- // default values
- $page = 1;
- $per_page = 5;
-
- if (Input::has('page'))
- {
- $page = intval(Input::get('page'));
- $per_page = intval(Input::get('per_page'));
- }
-
- $order = null;
- if (Input::has('order'))
- {
- $order = OrderParser::parse(Input::get('order'), array
- (
- 'created_date',
- 'owner_id',
- 'rate',
- 'id',
- ));
- }
-
- list($total, $per_page, $current_page, $last_page, $feedback) = $event->feedback($page, $per_page, $filter, $order);
-
- if (!empty($expand))
- {
- foreach (explode(',', $expand) as $relation)
- {
- switch (trim($relation)) {
- case 'owner':
- {
- $res = array();
- foreach($feedback as $f)
- {
- array_push($res, $f->toArray(true));
- }
- $feedback = $res;
- }
- break;
- }
- }
- }
-
- return $this->ok
- (
- array
- (
- 'total' => $total,
- 'per_page' => $per_page,
- 'current_page' => $current_page,
- 'last_page' => $last_page,
- 'data' => $feedback,
- )
- );
-
- } catch (Exception $ex) {
- Log::error($ex);
- return $this->error500($ex);
- }
- }
-
- /**
- * @param LaravelRequest $request
- * @param $summit_id
- * @param $event_id
- * @return mixed
- */
- public function addEventFeedback(LaravelRequest $request, $summit_id, $event_id)
- {
- try {
- if (!$request->isJson()) {
- return $this->error412(array('invalid content type!'));
- }
-
- $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
- if (is_null($summit)) return $this->error404();
- if(!Request::isJson()) return $this->error403();
-
- $data = Input::json();
-
- $rules = array
- (
- 'rate' => 'required|integer|digits_between:0,10',
- 'note' => 'required|max:500',
- 'attendee_id' => 'required'
- );
-
- // Creates a Validator instance and validates the data.
- $validation = Validator::make($data->all(), $rules);
-
- if ($validation->fails()) {
- $messages = $validation->messages()->toArray();
-
- return $this->error412
- (
- $messages
- );
- }
-
- $event = $summit->getScheduleEvent(intval($event_id));
-
- if (is_null($event)) {
- return $this->error404();
- }
-
- $data = $data->all();
- $attendee_id = $data['attendee_id'];
-
- $attendee = CheckAttendeeStrategyFactory::build(CheckAttendeeStrategyFactory::Own, $this->resource_server_context)->check($attendee_id, $summit);
- if (is_null($attendee)) return $this->error404();
-
- $data['attendee_id'] = intval($attendee->ID);
-
- $res = $this->service->addEventFeedback
- (
- $summit,
- $event,
- $data
- );
-
- return !is_null($res) ? $this->created($res->ID) : $this->error400();
- }
- catch (EntityNotFoundException $ex1) {
- Log::warning($ex1);
- return $this->error404();
- }
- catch(ValidationException $ex2)
- {
- Log::warning($ex2);
- return $this->error412(array($ex2->getMessage()));
- }
- catch(\HTTP401UnauthorizedException $ex3)
- {
- Log::warning($ex3);
- return $this->error401();
- }
- catch (Exception $ex) {
- Log::error($ex);
-
- return $this->error500($ex);
- }
- }
-
/**
* @param $summit_id
* @return mixed
@@ -1280,174 +187,6 @@ class OAuth2SummitApiController extends OAuth2ProtectedController
}
}
- //venues
-
- public function getLocations($summit_id)
- {
- try {
- $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
- if (is_null($summit)) return $this->error404();
-
- //locations
- $locations = array();
- foreach ($summit->locations() as $location) {
- array_push($locations, $location->toArray());
- }
-
- return $this->ok($locations);
- } catch (Exception $ex) {
- Log::error($ex);
- return $this->error500($ex);
- }
- }
-
- /**
- * @param $summit_id
- * @param $location_id
- * @return mixed
- */
- public function getLocation($summit_id, $location_id)
- {
- try {
-
- $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
- if (is_null($summit)) return $this->error404();
-
- $location = $summit->getLocation($location_id);
- if (is_null($location)) {
- return $this->error404();
- }
- return $this->ok($location);
- } catch (Exception $ex) {
- Log::error($ex);
- return $this->error500($ex);
- }
- }
-
- /**
- * @param string $summit_id
- * @param int $location_id
- * @param bool $published
- * @return PagingResponse
- * @throws EntityNotFoundException
- * @throws ValidationException
- */
- private function _getLocationEvents($summit_id, $location_id, $published = true)
- {
- $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
- if (is_null($summit))
- throw new EntityNotFoundException;
-
- $location = $summit->getLocation($location_id);
- if (is_null($location))
- throw new EntityNotFoundException;
-
- $values = Input::all();
-
- $rules = array
- (
- 'page' => 'integer|min:1',
- 'per_page' => 'required_with:page|integer|min:5|max:100',
- );
-
- $validation = Validator::make($values, $rules);
-
- if ($validation->fails()) {
- $ex = new ValidationException();
- throw $ex->setMessages($validation->messages()->toArray());
- }
-
- // default values
- $page = 1;
- $per_page = 5;
-
- if (Input::has('page')) {
- $page = intval(Input::get('page'));
- $per_page = intval(Input::get('per_page'));
- }
-
- $filter = null;
- if (Input::has('filter')) {
- $filter = FilterParser::parse(Input::get('filter'), array
- (
- 'title' => array('=@', '=='),
- 'speaker' => array('=@', '=='),
- 'tags' => array('=@', '=='),
- 'start_date' => array('>', '<', '<=', '>=', '=='),
- 'end_date' => array('>', '<', '<=', '>=', '=='),
- 'summit_type_id' => array('=='),
- 'event_type_id' => array('=='),
- 'track_id' => array('=='),
- ));
- }
-
-
-
- list($total, $per_page, $current_page, $last_page, $events) = $location->events
- (
- $page, $per_page, $filter , $published
- );
-
- return new PagingResponse
- (
- $total,
- $per_page,
- $current_page,
- $last_page,
- $events
- );
- }
-
- /**
- * @param $summit_id
- * @param $location_id
- * @return mixed
- */
- public function getLocationEvents($summit_id, $location_id)
- {
- try {
-
- return $this->ok($this->_getLocationEvents($summit_id, $location_id, false)->toArray());
- }
- catch (EntityNotFoundException $ex1) {
- Log::warning($ex1);
- return $this->error404();
- }
- catch (ValidationException $ex2) {
- Log::warning($ex2);
- return $this->error412($ex2->getMessages());
- }
- catch (Exception $ex) {
- Log::error($ex);
- return $this->error500($ex);
- }
- }
-
- /**
- * @param $summit_id
- * @param $location_id
- * @return mixed
- */
- public function getLocationPublishedEvents($summit_id, $location_id)
- {
- try {
-
- return $this->ok($this->_getLocationEvents($summit_id, $location_id, true)->toArray());
- }
- catch (EntityNotFoundException $ex1) {
- Log::warning($ex1);
- return $this->error404();
- }
- catch (ValidationException $ex2) {
- Log::warning($ex2);
- return $this->error412($ex2->getMessages());
- }
- catch (Exception $ex) {
- Log::error($ex);
- return $this->error500($ex);
- }
- }
-
/**
* @param $summit_id
* @return mixed
@@ -1459,12 +198,13 @@ class OAuth2SummitApiController extends OAuth2ProtectedController
if (is_null($summit)) return $this->error404();
//event types
- $list = array();
- foreach ($summit->event_types() as $et) {
- array_push($list, $et->toArray());
+ $event_types = array();
+ foreach ($summit->getEventTypes() as $event_type)
+ {
+ $event_types[] =SerializerRegistry::getInstance()->getSerializer($event_type)->serialize();
}
- return $this->ok($list);
+ return $this->ok($event_types);
} catch (Exception $ex) {
Log::error($ex);
return $this->error500($ex);
@@ -1482,11 +222,13 @@ class OAuth2SummitApiController extends OAuth2ProtectedController
if (is_null($summit)) return $this->error404();
//summit types
- $list = array();
- foreach ($summit->summit_types() as $st) {
- array_push($list, $st->toArray());
+ $summit_types = array();
+ foreach ($summit->getSummitTypes() as $summit_type)
+ {
+ $summit_types[] =SerializerRegistry::getInstance()->getSerializer($summit_type)->serialize();
}
- return $this->ok($list);
+ return $this->ok($summit_types);
+
} catch (Exception $ex) {
Log::error($ex);
return $this->error500($ex);
@@ -1523,8 +265,19 @@ class OAuth2SummitApiController extends OAuth2ProtectedController
if (is_null($member_id)) {
throw new \HTTP401UnauthorizedException;
}
- $attendee = $this->service->confirmExternalOrderAttendee($summit, $member_id, $external_order_id, $external_attendee_id);
- return $this->ok($attendee);
+
+ $attendee = $this->service->confirmExternalOrderAttendee
+ (
+ new ConfirmationExternalOrderRequest
+ (
+ $summit,
+ intval($member_id),
+ trim($external_order_id),
+ trim($external_attendee_id)
+ )
+ );
+
+ return $this->ok(SerializerRegistry::getInstance()->getSerializer($attendee)->serialize());
}
catch (EntityNotFoundException $ex1) {
Log::warning($ex1);
diff --git a/app/Http/Controllers/apis/protected/summit/OAuth2SummitAttendeesApiController.php b/app/Http/Controllers/apis/protected/summit/OAuth2SummitAttendeesApiController.php
new file mode 100644
index 00000000..bef257c1
--- /dev/null
+++ b/app/Http/Controllers/apis/protected/summit/OAuth2SummitAttendeesApiController.php
@@ -0,0 +1,343 @@
+repository = $summit_repository;
+ $this->speaker_repository = $speaker_repository;
+ $this->event_repository = $event_repository;
+ $this->event_feedback_repository = $event_feedback_repository;
+ $this->service = $service;
+ }
+
+ /**
+ * Attendees endpoints
+ */
+
+ /**
+ * @param $summit_id
+ * @return mixed
+ */
+ /*public function getAttendees($summit_id)
+ {
+ try {
+
+ $values = Input::all();
+
+ $rules = array
+ (
+ 'page' => 'integer|min:1',
+ 'per_page' => 'required_with:page|integer|min:5|max:100',
+ );
+
+ $validation = Validator::make($values, $rules);
+
+ if ($validation->fails()) {
+ $messages = $validation->messages()->toArray();
+ return $this->error412($messages);
+ }
+
+ $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
+ if (is_null($summit)) return $this->error404();
+
+ // default values
+ $page = 1;
+ $per_page = 5;
+
+ if (Input::has('page')) {
+ $page = intval(Input::get('page'));
+ $per_page = intval(Input::get('per_page'));
+ }
+
+ $filter = null;
+ if (Input::has('filter')) {
+ $filter = FilterParser::parse(Input::get('filter'), array
+ (
+ 'first_name' => array('=@', '=='),
+ 'last_name' => array('=@', '=='),
+ 'email' => array('=@', '=='),
+ ));
+ }
+
+ $order = null;
+ if (Input::has('order'))
+ {
+ $order = OrderParser::parse(Input::get('order'), array
+ (
+ 'first_name',
+ 'last_name',
+ ));
+ }
+
+ list($total, $per_page, $current_page, $last_page, $items) = $summit->attendees($page, $per_page, $filter, $order);
+
+ return $this->ok
+ (
+ array
+ (
+ 'total' => $total,
+ 'per_page' => $per_page,
+ 'current_page' => $current_page,
+ 'last_page' => $last_page,
+ 'data' => $items,
+ )
+ );
+
+ }
+ catch (Exception $ex)
+ {
+ Log::error($ex);
+ return $this->error500($ex);
+ }
+ }*/
+
+ /**
+ * @param $summit_id
+ * @param $attendee_id
+ * @return mixed
+ */
+ public function getAttendee($summit_id, $attendee_id)
+ {
+ $expand = Request::input('expand', '');
+
+ try {
+
+ $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
+ if (is_null($summit)) return $this->error404();
+
+ $attendee = CheckAttendeeStrategyFactory::build(CheckAttendeeStrategyFactory::Own, $this->resource_server_context)->check($attendee_id, $summit);
+ if(is_null($attendee)) return $this->error404();
+
+ return $this->ok(SerializerRegistry::getInstance()->getSerializer($attendee)->serialize($expand));
+ }
+ catch (\HTTP401UnauthorizedException $ex1) {
+ Log::warning($ex1);
+ return $this->error401();
+ }
+ catch (Exception $ex) {
+ Log::error($ex);
+ return $this->error500($ex);
+ }
+ }
+
+ /**
+ * @param $summit_id
+ * @param $attendee_id
+ * @return mixed
+ */
+ public function getAttendeeSchedule($summit_id, $attendee_id)
+ {
+ try {
+
+ $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
+ if (is_null($summit)) return $this->error404();
+
+ $attendee = CheckAttendeeStrategyFactory::build(CheckAttendeeStrategyFactory::Own, $this->resource_server_context)->check($attendee_id, $summit);
+ if(is_null($attendee)) return $this->error404();
+
+ $schedule = array();
+ foreach ($attendee->getSchedule() as $attendee_schedule)
+ {
+ if(!$summit->isEventOnSchedule($attendee_schedule->getEvent()->getId())) continue;
+ $schedule[] = SerializerRegistry::getInstance()->getSerializer($attendee_schedule)->serialize();
+ }
+
+ return $this->ok($schedule);
+ }
+ catch (\HTTP401UnauthorizedException $ex1)
+ {
+ Log::warning($ex1);
+ return $this->error401();
+ }
+ catch (Exception $ex) {
+ Log::error($ex);
+ return $this->error500($ex);
+ }
+ }
+
+ /**
+ * @param $summit_id
+ * @param $attendee_id
+ * @param $event_id
+ * @return mixed
+ */
+ public function addEventToAttendeeSchedule($summit_id, $attendee_id, $event_id)
+ {
+ try {
+
+ $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
+ if (is_null($summit)) return $this->error404();
+
+ $attendee = CheckAttendeeStrategyFactory::build(CheckAttendeeStrategyFactory::Own, $this->resource_server_context)->check($attendee_id, $summit);
+ if (is_null($attendee)) return $this->error404();
+
+ $this->service->addEventToAttendeeSchedule($summit, $attendee, intval($event_id));
+
+ return $this->created();
+ }
+ catch (ValidationException $ex1)
+ {
+ Log::warning($ex1);
+ return $this->error412(array( $ex1->getMessage()));
+ }
+ catch (EntityNotFoundException $ex2)
+ {
+ Log::warning($ex2);
+ return $this->error404(array('message' => $ex2->getMessage()));
+ }
+ catch(\HTTP401UnauthorizedException $ex3)
+ {
+ Log::warning($ex3);
+ return $this->error401();
+ }
+ catch (Exception $ex)
+ {
+ Log::error($ex);
+ return $this->error500($ex);
+ }
+ }
+
+ /**
+ * @param $summit_id
+ * @param $attendee_id
+ * @param $event_id
+ * @return mixed
+ */
+ public function removeEventFromAttendeeSchedule($summit_id, $attendee_id, $event_id)
+ {
+ try {
+
+ $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
+ if (is_null($summit)) return $this->error404();
+
+ $attendee = CheckAttendeeStrategyFactory::build(CheckAttendeeStrategyFactory::Own, $this->resource_server_context)->check($attendee_id, $summit);
+ if (is_null($attendee)) return $this->error404();
+
+ $this->service->removeEventFromAttendeeSchedule($summit, $attendee, intval($event_id));
+
+ return $this->deleted();
+
+ }
+ catch (ValidationException $ex1)
+ {
+ Log::warning($ex1);
+ return $this->error412(array( $ex1->getMessage()));
+ }
+ catch (EntityNotFoundException $ex2)
+ {
+ Log::warning($ex2);
+ return $this->error404(array('message' => $ex2->getMessage()));
+ }
+ catch(\HTTP401UnauthorizedException $ex3)
+ {
+ Log::warning($ex3);
+ return $this->error401();
+ }
+ catch (Exception $ex)
+ {
+ Log::error($ex);
+ return $this->error500($ex);
+ }
+ }
+
+ /**
+ * @param $summit_id
+ * @param $attendee_id
+ * @param $event_id
+ * @return mixed
+ */
+ public function checkingAttendeeOnEvent($summit_id, $attendee_id, $event_id)
+ {
+ try {
+
+ $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
+ if (is_null($summit)) return $this->error404();
+
+ $attendee = CheckAttendeeStrategyFactory::build(CheckAttendeeStrategyFactory::Own, $this->resource_server_context)->check($attendee_id, $summit);
+ if (is_null($attendee)) return $this->error404();
+
+ $this->service->checkInAttendeeOnEvent($summit, $attendee, intval($event_id));
+
+ return $this->updated();
+ }
+ catch (ValidationException $ex1)
+ {
+ Log::warning($ex1);
+ return $this->error412(array( $ex1->getMessage()));
+ }
+ catch (EntityNotFoundException $ex2)
+ {
+ Log::warning($ex2);
+ return $this->error404(array('message' => $ex2->getMessage()));
+ }
+ catch(\HTTP401UnauthorizedException $ex3)
+ {
+ Log::warning($ex3);
+ return $this->error401();
+ }
+ catch (Exception $ex) {
+ Log::error($ex);
+ return $this->error500($ex);
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/app/Http/Controllers/apis/protected/summit/OAuth2SummitEventsApiController.php b/app/Http/Controllers/apis/protected/summit/OAuth2SummitEventsApiController.php
new file mode 100644
index 00000000..c3d70aef
--- /dev/null
+++ b/app/Http/Controllers/apis/protected/summit/OAuth2SummitEventsApiController.php
@@ -0,0 +1,767 @@
+repository = $summit_repository;
+ $this->speaker_repository = $speaker_repository;
+ $this->event_repository = $event_repository;
+ $this->event_feedback_repository = $event_feedback_repository;
+ $this->service = $service;
+ }
+
+ /**
+ * Events endpoints
+ */
+
+ /**
+ * @param $summit_id
+ * @return mixed
+ */
+ public function getEvents($summit_id)
+ {
+ try
+ {
+ $strategy = new RetrieveAllSummitEventsBySummitStrategy($this->repository, $this->event_repository);
+ $response = $strategy->getEvents(['summit_id' => $summit_id]);
+ return $this->ok($response->toArray(Request::input('expand', '')));
+ }
+ catch (EntityNotFoundException $ex1)
+ {
+ Log::warning($ex1);
+ return $this->error404();
+ }
+ catch (ValidationException $ex2)
+ {
+ Log::warning($ex2);
+ return $this->error412($ex2->getMessages());
+ }
+ catch (Exception $ex)
+ {
+ Log::error($ex);
+ return $this->error500($ex);
+ }
+ }
+
+ /**
+ * @param $summit_id
+ * @return mixed
+ */
+ public function getScheduledEvents($summit_id)
+ {
+ try
+ {
+ $strategy = new RetrievePublishedSummitEventsBySummitStrategy($this->repository, $this->event_repository);
+ $response = $strategy->getEvents(['summit_id' => $summit_id]);
+ return $this->ok($response->toArray(Request::input('expand', '')));
+ }
+ catch (EntityNotFoundException $ex1)
+ {
+ Log::warning($ex1);
+ return $this->error404();
+ }
+ catch (ValidationException $ex2)
+ {
+ Log::warning($ex2);
+ return $this->error412($ex2->getMessages());
+ }
+ catch (Exception $ex)
+ {
+ Log::error($ex);
+ return $this->error500($ex);
+ }
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getAllEvents()
+ {
+ try
+ {
+ $strategy = new RetrieveAllSummitEventsStrategy($this->event_repository);
+ $response = $strategy->getEvents();
+ return $this->ok($response->toArray(Request::input('expand', '')));
+ }
+ catch (EntityNotFoundException $ex1)
+ {
+ Log::warning($ex1);
+ return $this->error404();
+ }
+ catch (ValidationException $ex2)
+ {
+ Log::warning($ex2);
+ return $this->error412($ex2->getMessages());
+ }
+ catch (Exception $ex)
+ {
+ Log::error($ex);
+ return $this->error500($ex);
+ }
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getAllScheduledEvents()
+ {
+ try
+ {
+ $strategy = new RetrieveAllPublishedSummitEventsStrategy($this->event_repository);
+ $response = $strategy->getEvents();
+ return $this->ok($response->toArray(Request::input('expand', '')));
+ }
+ catch (EntityNotFoundException $ex1)
+ {
+ Log::warning($ex1);
+ return $this->error404();
+ }
+ catch (ValidationException $ex2)
+ {
+ Log::warning($ex2);
+ return $this->error412($ex2->getMessages());
+ }
+ catch (Exception $ex)
+ {
+ Log::error($ex);
+ return $this->error500($ex);
+ }
+ }
+
+ /**
+ * @param $summit_id
+ * @param $event_id
+ * @param string $expand
+ * @param string $fields
+ * @param string $relations
+ * @param bool $published
+ * @return array
+ * @throws EntityNotFoundException
+ */
+ private function _getSummitEvent($summit_id, $event_id, $expand = '', $fields = '', $relations = '', $published = true)
+ {
+ $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
+ if (is_null($summit)) throw new EntityNotFoundException;
+
+ $event = $published ? $summit->getScheduleEvent(intval($event_id)) : $summit->getEvent(intval($event_id));
+
+ if (is_null($event)) throw new EntityNotFoundException;
+ $relations = !empty($relations) ? explode(',', $relations) : array();
+ $fields = !empty($fields) ? explode(',', $fields) : array();
+
+ return SerializerRegistry::getInstance()->getSerializer($event)->serialize($expand, $fields, $relations);
+ }
+ /**
+ * @param $summit_id
+ * @param $event_id
+ * @return mixed
+ */
+ public function getEvent($summit_id, $event_id)
+ {
+ try {
+
+ $expand = Request::input('expand', '');
+ $fields = Request::input('fields', '');
+ $relations = Request::input('relations', '');
+
+ return $this->ok($this->_getSummitEvent($summit_id, $event_id, $expand, $fields, $relations, false));
+ }
+ catch (EntityNotFoundException $ex1) {
+ Log::warning($ex1);
+ return $this->error404();
+ }
+ catch (Exception $ex) {
+ Log::error($ex);
+ return $this->error500($ex);
+ }
+ }
+
+ /**
+ * @param $summit_id
+ * @param $event_id
+ * @return mixed
+ */
+ public function getScheduledEvent($summit_id, $event_id)
+ {
+ try {
+
+ $expand = Request::input('expand', '');
+ $fields = Request::input('fields', '');
+ $relations = Request::input('relations', '');
+
+ return $this->ok($this->_getSummitEvent($summit_id, $event_id, $expand, $fields, $relations, true));
+ }
+ catch (EntityNotFoundException $ex1) {
+ Log::warning($ex1);
+ return $this->error404();
+ }
+ catch (Exception $ex) {
+ Log::error($ex);
+ return $this->error500($ex);
+ }
+ }
+
+ /**
+ * @param $summit_id
+ * @return mixed
+ */
+ public function addEvent($summit_id)
+ {
+ try {
+ $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
+ if (is_null($summit)) return $this->error404();
+ if(!Request::isJson()) return $this->error403();
+ $data = Input::json();
+
+ $rules = array
+ (
+ 'title' => 'required|string|max:300',
+ 'description' => 'required|string',
+ 'location_id' => 'sometimes|required|integer',
+ 'start_date' => 'sometimes|required|date_format:U',
+ 'end_date' => 'sometimes|required_with:start_date|date_format:U|after:start_date',
+ 'allow_feedback' => 'sometimes|required|boolean',
+ 'type_id' => 'required|integer',
+ 'summit_types_id' => 'required|int_array',
+ 'tags' => 'sometimes|required|string_array',
+ );
+
+ // Creates a Validator instance and validates the data.
+ $validation = Validator::make($data->all(), $rules);
+
+ if ($validation->fails()) {
+ $messages = $validation->messages()->toArray();
+
+ return $this->error412
+ (
+ $messages
+ );
+ }
+
+ $fields = array
+ (
+ 'title',
+ 'description'
+ );
+
+ $event = $this->service->addEvent($summit, HTMLCleaner::cleanData($data->all(), $fields));
+
+ return $this->created(SerializerRegistry::getInstance()->getSerializer($event)->serialize());
+ }
+ catch (ValidationException $ex1) {
+ Log::warning($ex1);
+ return $this->error412(array($ex1->getMessage()));
+ }
+ catch(EntityNotFoundException $ex2)
+ {
+ Log::warning($ex2);
+ return $this->error404(array('message'=> $ex2->getMessage()));
+ }
+ catch (Exception $ex) {
+ Log::error($ex);
+ return $this->error500($ex);
+ }
+ }
+
+ /**
+ * @param $summit_id
+ * @param $event_id
+ * @return mixed
+ */
+ public function updateEvent($summit_id, $event_id)
+ {
+ try {
+ $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
+ if (is_null($summit)) return $this->error404();
+
+ if(!Request::isJson()) return $this->error403();
+ $data = Input::json();
+
+ $rules = array
+ (
+ 'title' => 'sometimes|required|string|max:300',
+ 'description' => 'sometimes|required|string',
+ 'location_id' => 'sometimes|required|integer',
+ 'start_date' => 'sometimes|required|date_format:U',
+ 'end_date' => 'sometimes|required_with:start_date|date_format:U|after:start_date',
+ 'allow_feedback' => 'sometimes|required|boolean',
+ 'type_id' => 'sometimes|required|integer',
+ 'summit_types_id' => 'sometimes|required|int_array',
+ 'tags' => 'sometimes|required|string_array',
+ );
+
+ // Creates a Validator instance and validates the data.
+ $validation = Validator::make($data->all(), $rules);
+
+ if ($validation->fails()) {
+ $messages = $validation->messages()->toArray();
+
+ return $this->error412
+ (
+ $messages
+ );
+ }
+
+ $fields = array
+ (
+ 'title',
+ 'description'
+ );
+
+ $event = $this->service->updateEvent($summit, $event_id, HTMLCleaner::cleanData($data->all(), $fields));
+
+ return $this->ok(SerializerRegistry::getInstance()->getSerializer($event)->serialize());
+
+ }
+ catch (ValidationException $ex1)
+ {
+ Log::warning($ex1);
+ return $this->error412(array($ex1->getMessage()));
+ }
+ catch(EntityNotFoundException $ex2)
+ {
+ Log::warning($ex2);
+ return $this->error404(array('message'=> $ex2->getMessage()));
+ }
+ catch (Exception $ex) {
+ Log::error($ex);
+ return $this->error500($ex);
+ }
+ }
+
+ /**
+ * @param $summit_id
+ * @param $event_id
+ * @return mixed
+ */
+ public function publishEvent($summit_id, $event_id)
+ {
+ try {
+ $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
+ if (is_null($summit)) return $this->error404();
+
+ if(!Request::isJson()) return $this->error403();
+ $data = Input::json();
+
+ $rules = array
+ (
+ 'location_id' => 'sometimes|required|integer',
+ 'start_date' => 'sometimes|required|date_format:U',
+ 'end_date' => 'sometimes|required_with:start_date|date_format:U|after:start_date',
+ );
+
+ // Creates a Validator instance and validates the data.
+ $validation = Validator::make($data->all(), $rules);
+
+ if ($validation->fails()) {
+ $messages = $validation->messages()->toArray();
+
+ return $this->error412
+ (
+ $messages
+ );
+ }
+
+ $this->service->publishEvent($summit, $event_id, $data->all());
+
+ return $this->updated();
+ }
+ catch (ValidationException $ex1)
+ {
+ Log::warning($ex1);
+ return $this->error412(array($ex1->getMessage()));
+ }
+ catch(EntityNotFoundException $ex2)
+ {
+ Log::warning($ex2);
+ return $this->error404(array('message'=> $ex2->getMessage()));
+ }
+ catch (Exception $ex) {
+ Log::error($ex);
+ return $this->error500($ex);
+ }
+ }
+
+ /**
+ * @param $summit_id
+ * @param $event_id
+ * @return mixed
+ */
+ public function unPublishEvent($summit_id, $event_id)
+ {
+ try {
+ $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
+ if (is_null($summit)) return $this->error404();
+
+ if(!Request::isJson()) return $this->error403();
+
+
+ $this->service->unPublishEvent($summit, $event_id);
+
+ return $this->deleted();
+ }
+ catch (ValidationException $ex1)
+ {
+ Log::warning($ex1);
+ return $this->error412(array($ex1->getMessage()));
+ }
+ catch(EntityNotFoundException $ex2)
+ {
+ Log::warning($ex2);
+ return $this->error404(array('message'=> $ex2->getMessage()));
+ }
+ catch (Exception $ex) {
+ Log::error($ex);
+ return $this->error500($ex);
+ }
+ }
+
+ /**
+ * @param $summit_id
+ * @param $event_id
+ * @return mixed
+ */
+ public function deleteEvent($summit_id, $event_id)
+ {
+ try {
+ $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
+ if (is_null($summit)) return $this->error404();
+
+ $this->service->deleteEvent($summit, $event_id);
+
+ return $this->deleted();
+ }
+ catch (ValidationException $ex1)
+ {
+ Log::warning($ex1);
+ return $this->error412(array($ex1->getMessage()));
+ }
+ catch(EntityNotFoundException $ex2)
+ {
+ Log::warning($ex2);
+ return $this->error404(array('message'=> $ex2->getMessage()));
+ }
+ catch (Exception $ex) {
+ Log::error($ex);
+ return $this->error500($ex);
+ }
+ }
+
+ /** Feedback endpoints */
+
+ /**
+ * @param $summit_id
+ * @param $event_id
+ * @param $attendee_id
+ * @return mixed
+ */
+ public function getEventFeedback($summit_id, $event_id, $attendee_id = null)
+ {
+
+ try {
+
+ $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
+ if (is_null($summit)) return $this->error404();
+
+ $values = Input::all();
+
+ $rules = array
+ (
+ 'page' => 'integer|min:1',
+ 'per_page' => 'required_with:page|integer|min:5|max:100',
+ );
+
+ $validation = Validator::make($values, $rules);
+
+ if ($validation->fails()) {
+ $messages = $validation->messages()->toArray();
+
+ return $this->error412($messages);
+ }
+
+ $event = $summit->getScheduleEvent(intval($event_id));
+
+ if (is_null($event)) {
+ return $this->error404();
+ }
+
+ $filter = null;
+ if (!is_null($attendee_id)) // add filter by attendee, this case me
+ {
+ if($attendee_id !== 'me') return $this->error403();
+ $member_id = $this->resource_server_context->getCurrentUserExternalId();
+ if (is_null($member_id)) return $this->error404();
+
+ $filter = FilterParser::parse('owner_id=='.$member_id, array
+ (
+ 'owner_id' => array('=='),
+ ));
+ }
+
+ // default values
+ $page = 1;
+ $per_page = 5;
+
+ if (Input::has('page'))
+ {
+ $page = intval(Input::get('page'));
+ $per_page = intval(Input::get('per_page'));
+ }
+
+ $order = null;
+ if (Input::has('order'))
+ {
+ $order = OrderParser::parse(Input::get('order'), array
+ (
+ 'created_date',
+ 'owner_id',
+ 'rate',
+ 'id',
+ ));
+ }
+
+ $response = $this->event_feedback_repository->getByEvent($event, new PagingInfo($page, $per_page), $filter, $order);
+
+ return $this->ok($response->toArray(Request::input('expand', '')));
+
+ } catch (Exception $ex) {
+ Log::error($ex);
+ return $this->error500($ex);
+ }
+ }
+
+ /**
+ * @param LaravelRequest $request
+ * @param $summit_id
+ * @param $event_id
+ * @return mixed
+ */
+ public function addEventFeedback(LaravelRequest $request, $summit_id, $event_id)
+ {
+ try {
+ if (!$request->isJson()) {
+ return $this->error412(array('invalid content type!'));
+ }
+
+ $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
+ if (is_null($summit)) return $this->error404();
+ if(!Request::isJson()) return $this->error403();
+
+ $data = Input::json();
+
+ $rules = array
+ (
+ 'rate' => 'required|integer|digits_between:0,10',
+ 'note' => 'required|max:500',
+ 'attendee_id' => 'required'
+ );
+
+ // Creates a Validator instance and validates the data.
+ $validation = Validator::make($data->all(), $rules);
+
+ if ($validation->fails()) {
+ $messages = $validation->messages()->toArray();
+
+ return $this->error412
+ (
+ $messages
+ );
+ }
+
+ $event = $summit->getScheduleEvent(intval($event_id));
+
+ if (is_null($event)) {
+ return $this->error404();
+ }
+
+ $data = $data->all();
+ $attendee_id = $data['attendee_id'];
+
+ $attendee = CheckAttendeeStrategyFactory::build
+ (
+ CheckAttendeeStrategyFactory::Own,
+ $this->resource_server_context
+ )->check($attendee_id, $summit);
+
+ if (is_null($attendee)) return $this->error404();
+
+ $data['attendee_id'] = intval($attendee->getId());
+
+ $res = $this->service->addEventFeedback
+ (
+ $summit,
+ $event,
+ $data
+ );
+
+ return !is_null($res) ? $this->created($res->getId()) : $this->error400();
+ }
+ catch (EntityNotFoundException $ex1) {
+ Log::warning($ex1);
+ return $this->error404();
+ }
+ catch(ValidationException $ex2)
+ {
+ Log::warning($ex2);
+ return $this->error412(array($ex2->getMessage()));
+ }
+ catch(\HTTP401UnauthorizedException $ex3)
+ {
+ Log::warning($ex3);
+ return $this->error401();
+ }
+ catch (Exception $ex) {
+ Log::error($ex);
+
+ return $this->error500($ex);
+ }
+ }
+
+ /**
+ * @param LaravelRequest $request
+ * @param $summit_id
+ * @param $event_id
+ * @return mixed
+ */
+ public function addEventFeedbackByMember(LaravelRequest $request, $summit_id, $event_id)
+ {
+ try {
+
+ if (!$request->isJson()) {
+ return $this->error412(array('invalid content type!'));
+ }
+
+ $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
+ if (is_null($summit)) return $this->error404();
+ if(!Request::isJson()) return $this->error403();
+
+ $data = Input::json();
+
+ $rules = array
+ (
+ 'rate' => 'required|integer|digits_between:0,10',
+ 'note' => 'required|max:500',
+ );
+
+ // Creates a Validator instance and validates the data.
+ $validation = Validator::make($data->all(), $rules);
+
+ if ($validation->fails()) {
+ $messages = $validation->messages()->toArray();
+
+ return $this->error412
+ (
+ $messages
+ );
+ }
+
+ $event = $summit->getScheduleEvent(intval($event_id));
+
+ if (is_null($event)) {
+ return $this->error404();
+ }
+
+ $data = $data->all();
+
+ $member_id = $this->resource_server_context->getCurrentUserExternalId();
+
+ if (is_null($member_id)) return $this->error403();
+
+ $data['member_id'] = intval($member_id);
+
+ $res = $this->service->addEventFeedback
+ (
+ $summit,
+ $event,
+ $data
+ );
+
+ return !is_null($res) ? $this->created($res->getId()) : $this->error400();
+ }
+ catch (EntityNotFoundException $ex1) {
+ Log::warning($ex1);
+ return $this->error404();
+ }
+ catch(ValidationException $ex2)
+ {
+ Log::warning($ex2);
+ return $this->error412(array($ex2->getMessage()));
+ }
+ catch(\HTTP401UnauthorizedException $ex3)
+ {
+ Log::warning($ex3);
+ return $this->error401();
+ }
+ catch (Exception $ex) {
+ Log::error($ex);
+
+ return $this->error500($ex);
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/Http/Controllers/apis/protected/summit/OAuth2SummitLocationsApiController.php b/app/Http/Controllers/apis/protected/summit/OAuth2SummitLocationsApiController.php
new file mode 100644
index 00000000..2b77771f
--- /dev/null
+++ b/app/Http/Controllers/apis/protected/summit/OAuth2SummitLocationsApiController.php
@@ -0,0 +1,240 @@
+repository = $summit_repository;
+ $this->speaker_repository = $speaker_repository;
+ $this->event_repository = $event_repository;
+ $this->event_feedback_repository = $event_feedback_repository;
+ $this->service = $service;
+ }
+
+ public function getLocations($summit_id)
+ {
+ try {
+ $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
+ if (is_null($summit)) return $this->error404();
+
+ //locations
+ $locations = array();
+ foreach ($summit->getLocations() as $location)
+ {
+ $locations[] = SerializerRegistry::getInstance()->getSerializer($location)->serialize();
+ }
+
+ return $this->ok($locations);
+ } catch (Exception $ex) {
+ Log::error($ex);
+ return $this->error500($ex);
+ }
+ }
+
+ /**
+ * @param $summit_id
+ * @param $location_id
+ * @return mixed
+ */
+ public function getLocation($summit_id, $location_id)
+ {
+ try {
+
+ $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
+ if (is_null($summit)) return $this->error404();
+
+ $location = $summit->getLocation($location_id);
+ if (is_null($location)) {
+ return $this->error404();
+ }
+ return $this->ok(SerializerRegistry::getInstance()->getSerializer($location)->serialize());
+ } catch (Exception $ex) {
+ Log::error($ex);
+ return $this->error500($ex);
+ }
+ }
+
+ /**
+ * @param string $summit_id
+ * @param int $location_id
+ * @param bool $published
+ * @return PagingResponse
+ * @throws EntityNotFoundException
+ * @throws ValidationException
+ */
+ private function _getLocationEvents($summit_id, $location_id, $published = true)
+ {
+ $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
+ if (is_null($summit))
+ throw new EntityNotFoundException;
+
+ $location = $summit->getLocation($location_id);
+ if (is_null($location))
+ throw new EntityNotFoundException;
+
+ $values = Input::all();
+
+ $rules = array
+ (
+ 'page' => 'integer|min:1',
+ 'per_page' => 'required_with:page|integer|min:5|max:100',
+ );
+
+ $validation = Validator::make($values, $rules);
+
+ if ($validation->fails()) {
+ $ex = new ValidationException();
+ throw $ex->setMessages($validation->messages()->toArray());
+ }
+
+ // default values
+ $page = 1;
+ $per_page = 5;
+
+ if (Input::has('page')) {
+ $page = intval(Input::get('page'));
+ $per_page = intval(Input::get('per_page'));
+ }
+
+ $filter = null;
+ if (Input::has('filter')) {
+ $filter = FilterParser::parse(Input::get('filter'), array
+ (
+ 'title' => array('=@', '=='),
+ 'start_date' => array('>', '<', '<=', '>=', '=='),
+ 'end_date' => array('>', '<', '<=', '>=', '=='),
+ 'speaker' => array('=@', '=='),
+ 'tags' => array('=@', '=='),
+ 'summit_type_id' => array('=='),
+ 'event_type_id' => array('=='),
+ 'track_id' => array('=='),
+ ));
+ }
+
+ if(is_null($filter)) $filter = new Filter();
+
+ $filter->addFilterCondition(FilterParser::buildFilter('location_id','==', $location_id));
+
+ if($published)
+ {
+ $filter->addFilterCondition(FilterParser::buildFilter('published','==', 1));
+ }
+
+ return $this->event_repository->getAllByPage(new PagingInfo($page, $per_page), $filter);
+ }
+
+ /**
+ * @param $summit_id
+ * @param $location_id
+ * @return mixed
+ */
+ public function getLocationEvents($summit_id, $location_id)
+ {
+ try {
+
+ return $this->ok($this->_getLocationEvents($summit_id, $location_id, false)->toArray(Request::input('expand', '')));
+ }
+ catch (EntityNotFoundException $ex1) {
+ Log::warning($ex1);
+ return $this->error404();
+ }
+ catch (ValidationException $ex2) {
+ Log::warning($ex2);
+ return $this->error412($ex2->getMessages());
+ }
+ catch (Exception $ex) {
+ Log::error($ex);
+ return $this->error500($ex);
+ }
+ }
+
+ /**
+ * @param $summit_id
+ * @param $location_id
+ * @return mixed
+ */
+ public function getLocationPublishedEvents($summit_id, $location_id)
+ {
+ try {
+
+ return $this->ok($this->_getLocationEvents($summit_id, $location_id, true)->toArray(Request::input('expand', '')));
+ }
+ catch (EntityNotFoundException $ex1) {
+ Log::warning($ex1);
+ return $this->error404();
+ }
+ catch (ValidationException $ex2) {
+ Log::warning($ex2);
+ return $this->error412($ex2->getMessages());
+ }
+ catch (Exception $ex) {
+ Log::error($ex);
+ return $this->error500($ex);
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/app/Http/Controllers/apis/protected/summit/OAuth2SummitMembersApiController.php b/app/Http/Controllers/apis/protected/summit/OAuth2SummitMembersApiController.php
new file mode 100644
index 00000000..55420a4f
--- /dev/null
+++ b/app/Http/Controllers/apis/protected/summit/OAuth2SummitMembersApiController.php
@@ -0,0 +1,86 @@
+summit_repository = $summit_repository;
+ $this->repository = $member_repository;
+ }
+
+
+ public function getMyMember($summit_id){
+
+ $summit = SummitFinderStrategyFactory::build($this->summit_repository)->find($summit_id);
+ if (is_null($summit)) return $this->error404();
+
+ $current_member_id = $this->resource_server_context->getCurrentUserExternalId();
+ if (is_null($current_member_id)) return $this->error403();
+
+ $current_member = $this->repository->getById($current_member_id);
+ if (is_null($current_member)) return $this->error404();
+
+ return $this->ok
+ (
+ SerializerRegistry::getInstance()->getSerializer($current_member)->serialize
+ (
+ Request::input('expand', ''),
+ [],
+ [],
+ ['summit' => $summit]
+ )
+ );
+ }
+}
\ No newline at end of file
diff --git a/app/Http/Controllers/apis/protected/summit/OAuth2SummitSpeakersApiController.php b/app/Http/Controllers/apis/protected/summit/OAuth2SummitSpeakersApiController.php
new file mode 100644
index 00000000..7c28d5a3
--- /dev/null
+++ b/app/Http/Controllers/apis/protected/summit/OAuth2SummitSpeakersApiController.php
@@ -0,0 +1,178 @@
+repository = $summit_repository;
+ $this->speaker_repository = $speaker_repository;
+ $this->event_repository = $event_repository;
+ $this->event_feedback_repository = $event_feedback_repository;
+ $this->service = $service;
+ }
+
+ /**
+ * Speakers endpoints
+ */
+
+ /**
+ * @param $summit_id
+ * @return mixed
+ */
+ public function getSpeakers($summit_id)
+ {
+ try {
+
+ $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
+ if (is_null($summit)) return $this->error404();
+
+ $values = Input::all();
+
+ $rules = array
+ (
+ 'page' => 'integer|min:1',
+ 'per_page' => 'required_with:page|integer|min:10|max:100',
+ );
+
+ $validation = Validator::make($values, $rules);
+
+ if ($validation->fails())
+ {
+ $messages = $validation->messages()->toArray();
+
+ return $this->error412($messages);
+ }
+
+ // default values
+ $page = 1;
+ $per_page = 10;
+
+ if (Input::has('page'))
+ {
+ $page = intval(Input::get('page'));
+ $per_page = intval(Input::get('per_page'));
+ }
+
+ $filter = null;
+
+ if (Input::has('filter'))
+ {
+ $filter = FilterParser::parse(Input::get('filter'), array
+ (
+ 'first_name' => array('=@', '=='),
+ 'last_name' => array('=@', '=='),
+ 'email' => array('=@', '=='),
+ ));
+ }
+
+ $order = null;
+ if (Input::has('order'))
+ {
+ $order = OrderParser::parse(Input::get('order'), array
+ (
+ 'first_name',
+ 'last_name',
+ ));
+ }
+
+ $result = $this->speaker_repository->getSpeakersBySummit($summit, new PagingInfo($page, $per_page), $filter, $order);
+
+ return $this->ok
+ (
+ $result->toArray(Request::input('expand', ''),[],[],['summit_id' => $summit_id, 'published' => true])
+ );
+ }
+ catch (Exception $ex)
+ {
+ Log::error($ex);
+ return $this->error500($ex);
+ }
+ }
+
+ /**
+ * @param $summit_id
+ * @param $speaker_id
+ * @return mixed
+ */
+ public function getSpeaker($summit_id, $speaker_id)
+ {
+ try
+ {
+
+ $summit = SummitFinderStrategyFactory::build($this->repository)->find($summit_id);
+ if (is_null($summit)) return $this->error404();
+
+ $speaker = CheckSpeakerStrategyFactory::build(CheckSpeakerStrategyFactory::Me, $this->resource_server_context)->check($speaker_id, $summit);
+ if (is_null($speaker)) return $this->error404();
+
+ return $this->ok(SerializerRegistry::getInstance()->getSerializer($speaker)->serialize(Request::input('expand', '')));
+
+ } catch (Exception $ex) {
+ Log::error($ex);
+ return $this->error500($ex);
+ }
+ }
+
+
+}
\ No newline at end of file
diff --git a/app/Http/Controllers/apis/protected/summit/SummitFinderStrategyFactory.php b/app/Http/Controllers/apis/protected/summit/SummitFinderStrategyFactory.php
index d2ec19a1..ed36f80c 100644
--- a/app/Http/Controllers/apis/protected/summit/SummitFinderStrategyFactory.php
+++ b/app/Http/Controllers/apis/protected/summit/SummitFinderStrategyFactory.php
@@ -1,4 +1,4 @@
-resource_server_context->getCurrentUserExternalId();
if (is_null($member_id)) {
- return $this->error404();
+ return null;
}
$speaker = $summit->getSpeakerByMemberId($member_id);
} else {
- $speaker = $summit->getSpeakerById(intval($speaker_id));
+ $speaker = $summit->getSpeaker(intval($speaker_id));
}
return $speaker;
}
diff --git a/app/Http/Controllers/apis/protected/summit/strategies/CheckMyOwnAttendeeStrategy.php b/app/Http/Controllers/apis/protected/summit/strategies/CheckMyOwnAttendeeStrategy.php
index 1daf66fd..843e365c 100644
--- a/app/Http/Controllers/apis/protected/summit/strategies/CheckMyOwnAttendeeStrategy.php
+++ b/app/Http/Controllers/apis/protected/summit/strategies/CheckMyOwnAttendeeStrategy.php
@@ -35,7 +35,7 @@ final class CheckMyOwnAttendeeStrategy extends CheckMeAttendeeStrategy implement
{
$attendee = parent::check($attendee_id, $summit);
if(!$attendee) return null;
- $attendee_member_id = intval($attendee->member()->ID);
+ $attendee_member_id = intval($attendee->getMember()->getId());
$member_id = $this->resource_server_context->getCurrentUserExternalId();
if(is_null($member_id) || ($attendee_member_id !== $member_id)) throw new \HTTP401UnauthorizedException;
return $attendee;
diff --git a/app/Http/Controllers/apis/protected/summit/strategies/CurrentSummitFinderStrategy.php b/app/Http/Controllers/apis/protected/summit/strategies/CurrentSummitFinderStrategy.php
index 2481b3d1..667b36b5 100644
--- a/app/Http/Controllers/apis/protected/summit/strategies/CurrentSummitFinderStrategy.php
+++ b/app/Http/Controllers/apis/protected/summit/strategies/CurrentSummitFinderStrategy.php
@@ -14,8 +14,8 @@
namespace App\Http\Controllers;
+use models\summit\ISummitRepository;
use models\summit\Summit;
-use repositories\summit\EloquentSummitRepository;
/**
* Class CurrentSummitFinderStrategy
@@ -25,11 +25,11 @@ class CurrentSummitFinderStrategy implements ISummitFinderStrategy
{
/**
- * @var EloquentSummitRepository
+ * @var ISummitRepository
*/
private $repository;
- public function __construct(EloquentSummitRepository $repository)
+ public function __construct(ISummitRepository $repository)
{
$this->repository = $repository;
}
diff --git a/app/Http/Controllers/apis/protected/summit/strategies/RetrieveSummitEventsStrategy.php b/app/Http/Controllers/apis/protected/summit/strategies/RetrieveSummitEventsStrategy.php
deleted file mode 100644
index 53848428..00000000
--- a/app/Http/Controllers/apis/protected/summit/strategies/RetrieveSummitEventsStrategy.php
+++ /dev/null
@@ -1,138 +0,0 @@
- 'integer|min:1',
- 'per_page' => 'required_with:page|integer|min:5|max:100',
- );
-
- $validation = Validator::make($values, $rules);
-
- if ($validation->fails()) {
- $ex = new ValidationException();
- throw $ex->setMessages($validation->messages()->toArray());
- }
-
- $expand = Request::input('expand', '');
-
- // default values
- $page = 1;
- $per_page = 5;
-
- if (Input::has('page')) {
- $page = intval(Input::get('page'));
- $per_page = intval(Input::get('per_page'));
- }
-
- $filter = null;
- if (Input::has('filter')) {
- $filter = FilterParser::parse(Input::get('filter'), $this->getValidFilters());
- }
-
- $events = array();
-
- list($total, $per_page, $current_page, $last_page, $items) = $this->retrieveEventsFromSource
- (
- $page, $per_page, $filter
- );
-
- foreach ($items as $event) {
- $data = $event->toArray();
- if (!empty($expand)) {
- foreach (explode(',', $expand) as $relation) {
- switch (trim($relation)) {
- case 'feedback': {
- $feedback = array();
- list($total2, $per_page2, $current_page2, $last_page2, $items2) = $event->feedback(1,
- PHP_INT_MAX);
- foreach ($items2 as $f) {
- array_push($feedback, $f->toArray());
- }
- $data['feedback'] = $feedback;
- }
- break;
- case 'location': {
- $location = $event->getLocation();
- if(is_null($location)) continue;
- $data['location'] = $location->toArray();
- unset($data['location_id']);
- }
- break;
- }
- }
- }
- array_push($events, $data);
- }
-
- return new PagingResponse
- (
- $total,
- $per_page,
- $current_page,
- $last_page,
- $events
- );
- }
-
- /**
- * @param $page
- * @param $per_page
- * @param Filter|null $filter
- * @return array
- */
- abstract public function retrieveEventsFromSource($page, $per_page, Filter $filter = null);
-
- /**
- * @return array
- */
- protected function getValidFilters()
- {
- return array
- (
- 'title' => array('=@', '=='),
- 'tags' => array('=@', '=='),
- 'start_date' => array('>', '<', '<=', '>=', '=='),
- 'end_date' => array('>', '<', '<=', '>=', '=='),
- 'summit_type_id' => array('=='),
- 'event_type_id' => array('=='),
- );
- }
-}
\ No newline at end of file
diff --git a/app/Http/Controllers/apis/protected/summit/strategies/RetrieveAllPublishedSummitEventsStrategy.php b/app/Http/Controllers/apis/protected/summit/strategies/events/RetrieveAllPublishedSummitEventsStrategy.php
similarity index 62%
rename from app/Http/Controllers/apis/protected/summit/strategies/RetrieveAllPublishedSummitEventsStrategy.php
rename to app/Http/Controllers/apis/protected/summit/strategies/events/RetrieveAllPublishedSummitEventsStrategy.php
index 2cd3277d..16bfec6f 100644
--- a/app/Http/Controllers/apis/protected/summit/strategies/RetrieveAllPublishedSummitEventsStrategy.php
+++ b/app/Http/Controllers/apis/protected/summit/strategies/events/RetrieveAllPublishedSummitEventsStrategy.php
@@ -1,4 +1,4 @@
-event_repository->getAllPublishedByPage($page, $per_page, $filter);
+ $valid_filters = parent::getValidFilters();
+ $valid_filters['published'] = array('==');
+ return $valid_filters;
+ }
+
+ /**
+ * @return null|Filter
+ */
+ protected function buildFilter()
+ {
+ $filter = parent::buildFilter();
+ $filter->addFilterCondition(FilterParser::buildFilter('published','==','1'));
+ return $filter;
}
}
\ No newline at end of file
diff --git a/app/Http/Controllers/apis/protected/summit/strategies/RetrieveSummitEventsBySummitStrategy.php b/app/Http/Controllers/apis/protected/summit/strategies/events/RetrieveAllSummitEventsBySummitStrategy.php
similarity index 50%
rename from app/Http/Controllers/apis/protected/summit/strategies/RetrieveSummitEventsBySummitStrategy.php
rename to app/Http/Controllers/apis/protected/summit/strategies/events/RetrieveAllSummitEventsBySummitStrategy.php
index 760ccf5d..15958c07 100644
--- a/app/Http/Controllers/apis/protected/summit/strategies/RetrieveSummitEventsBySummitStrategy.php
+++ b/app/Http/Controllers/apis/protected/summit/strategies/events/RetrieveAllSummitEventsBySummitStrategy.php
@@ -1,4 +1,5 @@
-events_repository = $events_repository;
$this->summit_repository = $summit_repository;
}
@@ -53,10 +62,46 @@ abstract class RetrieveSummitEventsBySummitStrategy extends RetrieveSummitEvents
*/
public function getEvents(array $params = array())
{
- $summit_id = isset($params['summit_id'])? $params['summit_id']:0;
+ $summit_id = isset($params['summit_id'])? $params['summit_id']:0;
$this->summit = SummitFinderStrategyFactory::build($this->summit_repository)->find($summit_id);
- if (is_null($this->summit)) throw new EntityNotFoundException;
+ if (is_null($this->summit)) throw new EntityNotFoundException('summit not found!');
+
return parent::getEvents($params);
}
+ /**
+ * @return array
+ */
+ protected function getValidFilters()
+ {
+ $valid_filters = parent::getValidFilters();
+ $valid_filters['summit_id'] = array('==');
+ return $valid_filters;
+ }
+
+ /**
+ * @return null|Filter
+ */
+ protected function buildFilter(){
+ $filter = parent::buildFilter();
+
+ if(is_null($filter))
+ {
+ $filter = new Filter([]);
+ }
+ $filter->addFilterCondition(FilterParser::buildFilter('summit_id','==',$this->summit->getId()));
+ return $filter;
+ }
+
+
+ /**
+ * @param PagingInfo $paging_info
+ * @param Filter|null $filter
+ * @return PagingResponse
+ */
+ public function retrieveEventsFromSource(PagingInfo $paging_info, Filter $filter = null)
+ {
+ return $this->events_repository->getAllByPage($paging_info, $filter);
+ }
+
}
\ No newline at end of file
diff --git a/app/Http/Controllers/apis/protected/summit/strategies/RetrieveAllSummitEventsStrategy.php b/app/Http/Controllers/apis/protected/summit/strategies/events/RetrieveAllSummitEventsStrategy.php
similarity index 83%
rename from app/Http/Controllers/apis/protected/summit/strategies/RetrieveAllSummitEventsStrategy.php
rename to app/Http/Controllers/apis/protected/summit/strategies/events/RetrieveAllSummitEventsStrategy.php
index 3fa63f2d..1f0604a5 100644
--- a/app/Http/Controllers/apis/protected/summit/strategies/RetrieveAllSummitEventsStrategy.php
+++ b/app/Http/Controllers/apis/protected/summit/strategies/events/RetrieveAllSummitEventsStrategy.php
@@ -16,6 +16,8 @@ namespace App\Http\Controllers;
use models\summit\ISummitEventRepository;
use utils\Filter;
+use utils\PagingInfo;
+use utils\PagingResponse;
/**
* Class RetrieveAllSummitEventsStrategy
@@ -38,14 +40,13 @@ class RetrieveAllSummitEventsStrategy extends RetrieveSummitEventsStrategy
}
/**
- * @param $page
- * @param $per_page
+ * @param PagingInfo $paging_info
* @param Filter|null $filter
- * @return array
+ * @return PagingResponse
*/
- public function retrieveEventsFromSource($page, $per_page, Filter $filter = null)
+ public function retrieveEventsFromSource(PagingInfo $paging_info, Filter $filter = null)
{
- return $this->event_repository->getAllByPage($page, $per_page, $filter);
+ return $this->event_repository->getAllByPage($paging_info, $filter);
}
/**
diff --git a/app/Http/Controllers/apis/protected/summit/strategies/RetrievePublishedSummitEventsBySummitStrategy.php b/app/Http/Controllers/apis/protected/summit/strategies/events/RetrievePublishedSummitEventsBySummitStrategy.php
similarity index 61%
rename from app/Http/Controllers/apis/protected/summit/strategies/RetrievePublishedSummitEventsBySummitStrategy.php
rename to app/Http/Controllers/apis/protected/summit/strategies/events/RetrievePublishedSummitEventsBySummitStrategy.php
index 64f91a64..5387156f 100644
--- a/app/Http/Controllers/apis/protected/summit/strategies/RetrievePublishedSummitEventsBySummitStrategy.php
+++ b/app/Http/Controllers/apis/protected/summit/strategies/events/RetrievePublishedSummitEventsBySummitStrategy.php
@@ -1,4 +1,4 @@
-summit->schedule($page, $per_page, $filter);
+ $valid_filters = parent::getValidFilters();
+ $valid_filters['published'] = array('==');
+ return $valid_filters;
}
+
+ /**
+ * @return null|Filter
+ */
+ protected function buildFilter()
+ {
+ $filter = parent::buildFilter();
+ $filter->addFilterCondition(FilterParser::buildFilter('published','==','1'));
+ return $filter;
+ }
+
+
}
\ No newline at end of file
diff --git a/app/Http/Controllers/apis/protected/summit/strategies/events/RetrieveSummitEventsStrategy.php b/app/Http/Controllers/apis/protected/summit/strategies/events/RetrieveSummitEventsStrategy.php
new file mode 100644
index 00000000..27d0eff3
--- /dev/null
+++ b/app/Http/Controllers/apis/protected/summit/strategies/events/RetrieveSummitEventsStrategy.php
@@ -0,0 +1,98 @@
+ 'integer|min:1',
+ 'per_page' => 'required_with:page|integer|min:5|max:100',
+ );
+
+ $validation = Validator::make($values, $rules);
+
+ if ($validation->fails()) {
+ $ex = new ValidationException();
+ throw $ex->setMessages($validation->messages()->toArray());
+ }
+
+ // default values
+ $page = 1;
+ $per_page = 5;
+
+ if (Input::has('page')) {
+ $page = intval(Input::get('page'));
+ $per_page = intval(Input::get('per_page'));
+ }
+
+
+ return $this->retrieveEventsFromSource
+ (
+ new PagingInfo($page, $per_page), $this->buildFilter()
+ );
+ }
+
+ /**
+ * @return null|Filter
+ */
+ protected function buildFilter(){
+ $filter = null;
+ if (Input::has('filter')) {
+ $filter = FilterParser::parse(Input::get('filter'), $this->getValidFilters());
+ }
+ return $filter;
+ }
+ /**
+ * @param PagingInfo $paging_info
+ * @param Filter|null $filter
+ * @return PagingResponse
+ */
+ abstract public function retrieveEventsFromSource(PagingInfo $paging_info, Filter $filter = null);
+
+ /**
+ * @return array
+ */
+ protected function getValidFilters()
+ {
+ return array
+ (
+ 'title' => array('=@', '=='),
+ 'tags' => array('=@', '=='),
+ 'start_date' => array('>', '<', '<=', '>=', '=='),
+ 'end_date' => array('>', '<', '<=', '>=', '=='),
+ 'summit_type_id' => array('=='),
+ 'event_type_id' => array('=='),
+ );
+ }
+}
\ No newline at end of file
diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php
index 5b280474..0481abf9 100644
--- a/app/Http/Kernel.php
+++ b/app/Http/Kernel.php
@@ -1,37 +1,57 @@
- [
+ ],
+ 'api' => [
+ ],
];
/**
* The application's route middleware.
+ *
+ * These middleware may be assigned to groups or used individually.
+ *
* @var array
*/
protected $routeMiddleware = [
- 'auth' => 'App\Http\Middleware\Authenticate',
- 'auth.basic' => 'Illuminate\Auth\Middleware\AuthenticateWithBasicAuth',
- 'guest' => 'App\Http\Middleware\RedirectIfAuthenticated',
- 'oauth2.protected' => 'App\Http\Middleware\OAuth2BearerAccessTokenRequestValidator',
- 'rate.limit' => 'App\Http\Middleware\RateLimitMiddleware',
- 'etags' => 'App\Http\Middleware\ETagsMiddleware',
- 'cache' => 'App\Http\Middleware\CacheMiddleware',
- 'ssl' => 'App\Http\Middleware\SSLMiddleware',
+ 'auth' => \App\Http\Middleware\Authenticate::class,
+ 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
+ 'can' => \Illuminate\Foundation\Http\Middleware\Authorize::class,
+ 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
+ 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
+ 'oauth2.protected' => \App\Http\Middleware\OAuth2BearerAccessTokenRequestValidator::class,
+ 'rate.limit' => \App\Http\Middleware\RateLimitMiddleware::class,
+ 'etags' => \App\Http\Middleware\ETagsMiddleware::class,
+ 'cache' => \App\Http\Middleware\CacheMiddleware::class,
+ 'ssl' => \App\Http\Middleware\SSLMiddleware::class,
];
-
-}
\ No newline at end of file
+}
diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php
index 72a7613a..67abcaea 100644
--- a/app/Http/Middleware/Authenticate.php
+++ b/app/Http/Middleware/Authenticate.php
@@ -1,50 +1,30 @@
-auth = $auth;
- }
-
- /**
- * Handle an incoming request.
- *
- * @param \Illuminate\Http\Request $request
- * @param \Closure $next
- * @return mixed
- */
- public function handle($request, Closure $next)
- {
- if ($this->auth->guest())
- {
- if ($request->ajax())
- {
- return response('Unauthorized.', 401);
- }
- else
- {
- return redirect()->guest('auth/login');
- }
- }
-
- return $next($request);
- }
+class Authenticate
+{
+ /**
+ * Handle an incoming request.
+ *
+ * @param \Illuminate\Http\Request $request
+ * @param \Closure $next
+ * @param string|null $guard
+ * @return mixed
+ */
+ public function handle($request, Closure $next, $guard = null)
+ {
+ if (Auth::guard($guard)->guest()) {
+ if ($request->ajax() || $request->wantsJson()) {
+ return response('Unauthorized.', 401);
+ } else {
+ return redirect()->guest('login');
+ }
+ }
+ return $next($request);
+ }
}
diff --git a/app/Http/Middleware/CORSMiddleware.php b/app/Http/Middleware/CORSMiddleware.php
index d4dda0b5..41c4beaf 100644
--- a/app/Http/Middleware/CORSMiddleware.php
+++ b/app/Http/Middleware/CORSMiddleware.php
@@ -16,7 +16,6 @@ use Closure;
use libs\utils\ICacheService;
use models\resource_server\IApiEndpoint;
use models\resource_server\IApiEndpointRepository;
-use Illuminate\Contracts\Routing\Middleware;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Illuminate\Support\Facades\Cache;
@@ -30,7 +29,7 @@ use libs\utils\RequestUtils;
* @package App\Http\Middleware\
* Implementation of http://www.w3.org/TR/cors/
*/
-class CORSMiddleware implements Middleware
+class CORSMiddleware
{
const CORS_IP_BLACKLIST_PREFIX = 'CORS_IP_BLACKLIST_PREFIX:';
diff --git a/app/Http/Middleware/CacheMiddleware.php b/app/Http/Middleware/CacheMiddleware.php
index 3eae6bff..0442f82e 100644
--- a/app/Http/Middleware/CacheMiddleware.php
+++ b/app/Http/Middleware/CacheMiddleware.php
@@ -1,4 +1,4 @@
-getMethod() !== 'GET')
{
- // shortcircuit
+ // short circuit
return $next($request);
}
diff --git a/app/Http/Middleware/ETagsMiddleware.php b/app/Http/Middleware/ETagsMiddleware.php
index 49be902e..35382f34 100644
--- a/app/Http/Middleware/ETagsMiddleware.php
+++ b/app/Http/Middleware/ETagsMiddleware.php
@@ -14,17 +14,15 @@
**/
use Closure;
-use Illuminate\Contracts\Routing\Middleware;
-use Log;
+use Illuminate\Support\Facades\Log;
/**
* Class ETagsMiddleware
* @package App\Http\Middleware
*/
-final class ETagsMiddleware implements Middleware
+final class ETagsMiddleware
{
-
/**
* Handle an incoming request.
* @param \Illuminate\Http\Request $request
diff --git a/app/Http/Middleware/EncryptCookies.php b/app/Http/Middleware/EncryptCookies.php
new file mode 100644
index 00000000..3aa15f8d
--- /dev/null
+++ b/app/Http/Middleware/EncryptCookies.php
@@ -0,0 +1,17 @@
+auth = $auth;
- }
-
- /**
- * Handle an incoming request.
- *
- * @param \Illuminate\Http\Request $request
- * @param \Closure $next
- * @return mixed
- */
- public function handle($request, Closure $next)
- {
- if ($this->auth->check())
- {
- return new RedirectResponse(url('/home'));
- }
-
- return $next($request);
- }
+class RedirectIfAuthenticated
+{
+ /**
+ * Handle an incoming request.
+ *
+ * @param \Illuminate\Http\Request $request
+ * @param \Closure $next
+ * @param string|null $guard
+ * @return mixed
+ */
+ public function handle($request, Closure $next, $guard = null)
+ {
+ if (Auth::guard($guard)->check()) {
+ return redirect('/');
+ }
+ return $next($request);
+ }
}
diff --git a/app/Http/Middleware/SSLMiddleware.php b/app/Http/Middleware/SSLMiddleware.php
index ea46dc14..d8513aa8 100644
--- a/app/Http/Middleware/SSLMiddleware.php
+++ b/app/Http/Middleware/SSLMiddleware.php
@@ -1,4 +1,4 @@
-alias = $alias;
+ }
+
+ /**
+ * @param FilterElement $filter
+ * @throws \Exception
+ */
+ public function toRawSQL(FilterElement $filter)
+ {
+ throw new \Exception;
+ }
+
+ /**
+ * @param QueryBuilder $query
+ * @param FilterElement $filter
+ * @return QueryBuilder
+ */
+ public function apply(QueryBuilder $query, FilterElement $filter){
+ $where = str_replace(":value", $filter->getValue(), $this->where);
+ $where = str_replace(":operator", $filter->getOperator(), $where);
+ return $query->innerJoin($this->table, $this->alias, Join::WITH, $where);
+ }
+
+ /**
+ * @param QueryBuilder $query
+ * @param FilterElement $filter
+ * @return QueryBuilder
+ */
+ public function applyOr(QueryBuilder $query, FilterElement $filter){
+ $where = str_replace(":value", $filter->getValue(), $this->where);
+ $where = str_replace(":operator", $filter->getOperator(), $where);
+ return $query->innerJoin($this->table, $this->alias, Join::WITH)->orWhere($where);
+ }
+}
\ No newline at end of file
diff --git a/app/Http/Utils/ExistsFilterManyManyMapping.php b/app/Http/Utils/ExistsFilterManyManyMapping.php
deleted file mode 100644
index 8855ed20..00000000
--- a/app/Http/Utils/ExistsFilterManyManyMapping.php
+++ /dev/null
@@ -1,55 +0,0 @@
-pivot_table = $pivot_table;
- }
-
- /**
- * @param FilterElement $filter
- * @return string
- */
- public function toRawSQL(FilterElement $filter)
- {
- $where = str_replace(":value", $filter->getValue(), $this->where);
- $where = str_replace(":operator", $filter->getOperator(), $where);
-
- $sql = <<table} INNER JOIN {$this->pivot_table} ON {$this->join} WHERE {$where} )
-SQL;
- return $sql;
- }
-}
\ No newline at end of file
diff --git a/app/Http/Utils/ExistsFilterManyToOneMapping.php b/app/Http/Utils/ExistsFilterManyToOneMapping.php
deleted file mode 100644
index 6f088bce..00000000
--- a/app/Http/Utils/ExistsFilterManyToOneMapping.php
+++ /dev/null
@@ -1,47 +0,0 @@
-getValue(), $this->where);
- $where = str_replace(":operator", $filter->getOperator(), $where);
-
- $sql = <<table} WHERE {$where} )
-SQL;
- return $sql;
- }
-}
\ No newline at end of file
diff --git a/app/Http/Utils/Filter.php b/app/Http/Utils/Filter.php
index 2f2d3464..b11d6cdf 100644
--- a/app/Http/Utils/Filter.php
+++ b/app/Http/Utils/Filter.php
@@ -1,8 +1,5 @@
filters = $filters;
}
+ /**
+ * @param FilterElement $filter
+ * @return $this
+ */
+ public function addFilterCondition(FilterElement $filter)
+ {
+ $this->filters[] = $filter;
+ return $this;
+ }
+
/**
* @param string $field
* @return null|FilterElement[]
@@ -39,83 +54,111 @@ final class Filter
public function getFilter($field)
{
$res = array();
- foreach($this->filters as $filter)
- {
- if($filter instanceof FilterElement && $filter->getField() === $field) {
- array_push($res, $filter);
- }
- else if(is_array($filter))
- {
+ foreach ($this->filters as $filter) {
+ if ($filter instanceof FilterElement && $filter->getField() === $field) {
+ $res[] = $filter;
+ } else if (is_array($filter)) {
// OR
$or_res = array();
- foreach($filter as $e)
- {
- if($e instanceof FilterElement && $e->getField() === $field)
- {
+ foreach ($filter as $e) {
+ if ($e instanceof FilterElement && $e->getField() === $field) {
array_push($or_res, $e);
}
}
- if(count($or_res)) array_push($res, $or_res);
+ if (count($or_res)) array_push($res, $or_res);
}
}
return $res;
}
/**
- * @param $relation
+ * @param Criteria $criteria
* @param array $mappings
- * @return $this
+ * @return Criteria
*/
- public function apply2Relation($relation, array $mappings)
+ public function apply2Criteria(Criteria $criteria, array $mappings)
{
- $builder = $relation instanceof Relation ? $relation->getQuery(): $relation;
- if(!$builder instanceof Builder) throw new \InvalidArgumentException;
- foreach($this->filters as $filter)
- {
- if($filter instanceof FilterElement)
- {
- if(isset($mappings[$filter->getField()]))
- {
+ foreach ($this->filters as $filter) {
+ if ($filter instanceof FilterElement) {
+ if (isset($mappings[$filter->getField()])) {
$mapping = $mappings[$filter->getField()];
- if($mapping instanceof FilterMapping)
- {
- $builder->whereRaw($mapping->toRawSQL($filter));
+ if ($mapping instanceof FilterMapping) {
+ continue;
}
- else {
+
+ $mapping = explode(':', $mapping);
+ $value = $filter->getValue();
+ if (count($mapping) > 1) {
+ $value = $this->convertValue($value, $mapping[1]);
+ }
+ $criteria->andWhere(Criteria::expr()->eq($mapping[0], $value));
+ }
+ } else if (is_array($filter)) {
+ // OR
+
+ foreach ($filter as $e) {
+ if ($e instanceof FilterElement && isset($mappings[$e->getField()])) {
+ $mapping = $mappings[$e->getField()];
+ if ($mapping instanceof FilterMapping) {
+ continue;
+ }
$mapping = explode(':', $mapping);
$value = $filter->getValue();
if (count($mapping) > 1) {
$value = $this->convertValue($value, $mapping[1]);
}
- $builder->where($mapping[0], $filter->getOperator(), $value);
+ $criteria->orWhere(Criteria::expr()->eq($mapping[0], $value));
+
}
}
+
}
- else if(is_array($filter))
- {
+ }
+ return $criteria;
+ }
+
+ /**
+ * @param QueryBuilder $query
+ * @param array $mappings
+ * @return $this
+ */
+ public function apply2Query(QueryBuilder $query, array $mappings)
+ {
+ foreach ($this->filters as $filter) {
+ if ($filter instanceof FilterElement && isset($mappings[$filter->getField()])) {
+ $mapping = $mappings[$filter->getField()];
+ if ($mapping instanceof DoctrineJoinFilterMapping) {
+ $query = $mapping->apply($query, $filter);
+ continue;
+ }
+
+ $mapping = explode(':', $mapping);
+ $value = $filter->getValue();
+ if (count($mapping) > 1) {
+ $value = $this->convertValue($value, $mapping[1]);
+ }
+ $query = $query->where($mapping[0] . ' ' . $filter->getOperator() . ' ' . $value);
+ }
+ else if (is_array($filter)) {
// OR
- $builder->where(function ($query) use($filter, $mappings){
- foreach($filter as $e) {
- if($e instanceof FilterElement && isset($mappings[$e->getField()]))
- {
- $mapping = $mappings[$e->getField()];
- if($mapping instanceof FilterMapping)
- {
- $query->orWhereRaw($mapping->toRawSQL($e));
- }
- else
- {
- $mapping = explode(':', $mapping);
- $value = $filter->getValue();
- if (count($mapping) > 1) {
- $value = $this->convertValue($value, $mapping[1]);
- }
- $query->orWhere($mapping[0], $e->getOperator(), $value);
- }
+ foreach ($filter as $e) {
+ if ($e instanceof FilterElement && isset($mappings[$e->getField()])) {
+ $mapping = $mappings[$e->getField()];
+
+ if ($mapping instanceof DoctrineJoinFilterMapping) {
+ $query = $mapping->applyOr($query, $e);
+ continue;
}
+
+ $mapping = explode(':', $mapping);
+ $value = $filter->getValue();
+ if (count($mapping) > 1) {
+ $value = $this->convertValue($value, $mapping[1]);
+ }
+ $query->orWhere($mapping[0], $e->getOperator(), $value);
}
- });
+ }
}
}
return $this;
@@ -128,11 +171,10 @@ final class Filter
*/
private function convertValue($value, $original_format)
{
- switch($original_format)
- {
+ switch ($original_format) {
case 'datetime_epoch':
$datetime = new \DateTime("@$value");
- return $datetime->format("Y-m-d H:i:s");
+ return sprintf("'%s'", $datetime->format("Y-m-d H:i:s"));
break;
case 'json_int':
return intval($value);
@@ -150,59 +192,51 @@ final class Filter
{
return $this->bindings;
}
+
/**
* @param array $mappings
* @return string
*/
public function toRawSQL(array $mappings)
{
- $sql = '';
+ $sql = '';
$this->bindings = array();
- foreach($this->filters as $filter)
- {
- if($filter instanceof FilterElement)
- {
- if(isset($mappings[$filter->getField()]))
- {
+ foreach ($this->filters as $filter) {
+ if ($filter instanceof FilterElement) {
+ if (isset($mappings[$filter->getField()])) {
$mapping = $mappings[$filter->getField()];
$mapping = explode(':', $mapping);
- $value = $filter->getValue();
- $op = $filter->getOperator();
- if(count($mapping) > 1)
- {
- $filter->setValue( $this->convertValue($value, $mapping[1]));
+ $value = $filter->getValue();
+ $op = $filter->getOperator();
+ if (count($mapping) > 1) {
+ $filter->setValue($this->convertValue($value, $mapping[1]));
}
- $cond = sprintf(' %s %s :%s', $mapping[0], $op, $filter->getField());
- $this->bindings[$filter->getField()] = $filter->getValue();
- if(!empty($sql)) $sql .= " AND ";
+ $cond = sprintf(' %s %s :%s', $mapping[0], $op, $filter->getField());
+ $this->bindings[$filter->getField()] = $filter->getValue();
+ if (!empty($sql)) $sql .= " AND ";
$sql .= $cond;
}
- }
- else if(is_array($filter))
- {
+ } else if (is_array($filter)) {
// OR
$sql .= " ( ";
$sql_or = '';
- foreach($filter as $e)
- {
- if($e instanceof FilterElement && isset($mappings[$e->getField()]))
- {
+ foreach ($filter as $e) {
+ if ($e instanceof FilterElement && isset($mappings[$e->getField()])) {
$mapping = $mappings[$e->getField()];
$mapping = explode(':', $mapping);
- $value = $e->getValue();
- $op = $e->getOperator();
- if(count($mapping) > 1)
- {
- $e->setValue( $this->convertValue($value, $mapping[1]));
+ $value = $e->getValue();
+ $op = $e->getOperator();
+ if (count($mapping) > 1) {
+ $e->setValue($this->convertValue($value, $mapping[1]));
}
- $cond = sprintf(' %s %s :%s', $mapping[0], $op, $e->getField());
- $this->bindings[$e->getField()] = $e->getValue();
- if(!empty($sql_or)) $sql_or .= " OR ";
+ $cond = sprintf(" %s %s :%s", $mapping[0], $op, $e->getField());
+ $this->bindings[$e->getField()] = $e->getValue();
+ if (!empty($sql_or)) $sql_or .= " OR ";
$sql_or .= $cond;
}
}
- $sql .= $sql_or. " ) ";
+ $sql .= $sql_or . " ) ";
}
}
return $sql;
diff --git a/app/Http/Utils/FilterParser.php b/app/Http/Utils/FilterParser.php
index 87b72fda..2bd541eb 100644
--- a/app/Http/Utils/FilterParser.php
+++ b/app/Http/Utils/FilterParser.php
@@ -84,7 +84,7 @@ final class FilterParser
* @param string $value
* @return FilterElement|null
*/
- private static function buildFilter($field, $op, $value)
+ public static function buildFilter($field, $op, $value)
{
switch($op)
{
diff --git a/app/Http/Utils/Order.php b/app/Http/Utils/Order.php
index d0020468..4e148d6d 100644
--- a/app/Http/Utils/Order.php
+++ b/app/Http/Utils/Order.php
@@ -1,4 +1,4 @@
-ordering = $ordering;
}
- public function apply2Relation(Relation $relation, array $mappings)
+ /**
+ * @param QueryBuilder $query
+ * @param array $mappings
+ * @return $this
+ */
+ public function apply2Query(QueryBuilder $query, array $mappings)
{
foreach ($this->ordering as $order) {
if ($order instanceof OrderElement) {
if (isset($mappings[$order->getField()])) {
$mapping = $mappings[$order->getField()];
- $relation->getQuery()->orderBy($mapping, $order->getDirection());
+ $orders[$mapping] = $order->getDirection();
+ $query->addOrderBy($mapping, $order->getDirection());
}
}
}
-
return $this;
}
+ /**
+ * @param Criteria $criteria
+ * @param array $mappings
+ * @return $this
+ */
+ public function apply2Criteria(Criteria $criteria, array $mappings)
+ {
+ $orders = [];
+ foreach ($this->ordering as $order) {
+ if ($order instanceof OrderElement) {
+ if (isset($mappings[$order->getField()])) {
+ $mapping = $mappings[$order->getField()];
+ $orders[$mapping] = $order->getDirection();
+ }
+ }
+ }
+ if(count($orders) > 0)
+ $criteria->orderBy($orders);
+ return $this;
+ }
+
+
/**
* @param array $mappings
* @return string
diff --git a/app/Http/Utils/PagingInfo.php b/app/Http/Utils/PagingInfo.php
index c497092b..dedddd3c 100644
--- a/app/Http/Utils/PagingInfo.php
+++ b/app/Http/Utils/PagingInfo.php
@@ -56,4 +56,12 @@ class PagingInfo
{
return ($this->page - 1) * $this->per_page;
}
+
+ /**
+ * @param int $count
+ * @return int
+ */
+ public function getLastPage($count){
+ return intval(ceil($count/$this->per_page));
+ }
}
\ No newline at end of file
diff --git a/app/Http/Utils/PagingResponse.php b/app/Http/Utils/PagingResponse.php
index 457a6657..747032a0 100644
--- a/app/Http/Utils/PagingResponse.php
+++ b/app/Http/Utils/PagingResponse.php
@@ -12,6 +12,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
+use models\utils\IEntity;
+use ModelSerializers\SerializerRegistry;
+use Request;
+
+/**
+ * Class PagingResponse
+ * @package utils
+ */
final class PagingResponse
{
/**
@@ -89,17 +97,31 @@ final class PagingResponse
}
/**
+ * @param null $expand
+ * @param array $fields
+ * @param array $relations
+ * @param array $params
* @return array
*/
- public function toArray()
+ public function toArray($expand = null, array $fields = array(), array $relations = array(), array $params = array() )
{
+ $items = [];
+ foreach($this->items as $i)
+ {
+ if($i instanceof IEntity)
+ {
+ $i = SerializerRegistry::getInstance()->getSerializer($i)->serialize($expand, $fields, $relations, $params);
+ }
+ $items[] = $i;
+ }
+
return array
(
'total' => $this->total,
'per_page' => $this->per_page,
'current_page' => $this->page,
'last_page' => $this->last_page,
- 'data' => $this->items,
+ 'data' => $items,
);
}
}
\ No newline at end of file
diff --git a/app/Http/routes.php b/app/Http/routes.php
index 797e22f4..8f67ed0a 100644
--- a/app/Http/routes.php
+++ b/app/Http/routes.php
@@ -10,15 +10,17 @@
| and give it the controller to call when that URI is requested.
|
*/
+
//OAuth2 Protected API
Route::group(array(
+ 'namespace' => 'App\Http\Controllers',
'prefix' => 'api/v1',
'before' => [],
'after' => [],
'middleware' => ['ssl', 'oauth2.protected', 'rate.limit','etags']
), function () {
- Route::group(array('prefix' => 'marketplace'), function () {
+ Route::group(array('prefix' => 'marketplace'), function () {
Route::group(array('prefix' => 'public-clouds'), function () {
Route::get('', 'OAuth2PublicCloudApiController@getClouds');
@@ -42,6 +44,7 @@ Route::group(array(
// summits
Route::group(array('prefix' => 'summits'), function () {
+
Route::get('', 'OAuth2SummitApiController@getSummits');
Route::group(array('prefix' => 'events'), function () {
Route::get('', 'OAuth2SummitApiController@getAllEvents');
@@ -49,26 +52,28 @@ Route::group(array(
});
Route::group(array('prefix' => '{id}'), function () {
+
Route::get('', [ 'middleware' => 'cache', 'uses' => 'OAuth2SummitApiController@getSummit'])->where('id', 'current|[0-9]+');
Route::get('entity-events', 'OAuth2SummitApiController@getSummitEntityEvents');
+
// attendees
Route::group(array('prefix' => 'attendees'), function () {
- //Route::get('', 'OAuth2SummitApiController@getAttendees');
+ //Route::get('', 'OAuth2SummitAttendeesApiController@getAttendees');
Route::group(array('prefix' => '{attendee_id}'), function () {
- Route::get('', 'OAuth2SummitApiController@getAttendee')->where('attendee_id', 'me|[0-9]+');
+ Route::get('', 'OAuth2SummitAttendeesApiController@getAttendee')->where('attendee_id', 'me|[0-9]+');
Route::group(array('prefix' => 'schedule'), function ()
{
- Route::get('', 'OAuth2SummitApiController@getAttendeeSchedule')->where('attendee_id', 'me|[0-9]+');
+ Route::get('', 'OAuth2SummitAttendeesApiController@getAttendeeSchedule')->where('attendee_id', 'me|[0-9]+');
Route::group(array('prefix' => '{event_id}'), function (){
- Route::post('', 'OAuth2SummitApiController@addEventToAttendeeSchedule')->where('attendee_id', 'me|[0-9]+');
- Route::delete('', 'OAuth2SummitApiController@removeEventFromAttendeeSchedule')->where('attendee_id', 'me|[0-9]+');
- Route::put('/check-in', 'OAuth2SummitApiController@checkingAttendeeOnEvent')->where('attendee_id', 'me|[0-9]+');
+ Route::post('', 'OAuth2SummitAttendeesApiController@addEventToAttendeeSchedule')->where('attendee_id', 'me|[0-9]+');
+ Route::delete('', 'OAuth2SummitAttendeesApiController@removeEventFromAttendeeSchedule')->where('attendee_id', 'me|[0-9]+');
+ Route::put('/check-in', 'OAuth2SummitAttendeesApiController@checkingAttendeeOnEvent')->where('attendee_id', 'me|[0-9]+');
});
});
});
@@ -77,41 +82,53 @@ Route::group(array(
// speakers
Route::group(array('prefix' => 'speakers'), function () {
- Route::get('', 'OAuth2SummitApiController@getSpeakers');
+ Route::get('', 'OAuth2SummitSpeakersApiController@getSpeakers');
Route::group(array('prefix' => '{speaker_id}'), function () {
- Route::get('', 'OAuth2SummitApiController@getSpeaker')->where('speaker_id', 'me|[0-9]+');
+ Route::get('', 'OAuth2SummitSpeakersApiController@getSpeaker')->where('speaker_id', 'me|[0-9]+');
});
});
// events
Route::group(array('prefix' => 'events'), function () {
- Route::get('', 'OAuth2SummitApiController@getEvents');
- Route::get('/published', 'OAuth2SummitApiController@getScheduledEvents');
- Route::post('', 'OAuth2SummitApiController@addEvent');
+ Route::get('', 'OAuth2SummitEventsApiController@getEvents');
+ Route::get('/published', 'OAuth2SummitEventsApiController@getScheduledEvents');
+ Route::post('', 'OAuth2SummitEventsApiController@addEvent');
Route::group(array('prefix' => '{event_id}'), function () {
- Route::get('', 'OAuth2SummitApiController@getEvent');
- Route::get('/published', 'OAuth2SummitApiController@getScheduledEvent');
- Route::put('', 'OAuth2SummitApiController@updateEvent');
- Route::delete('', 'OAuth2SummitApiController@deleteEvent');
- Route::put('/publish', 'OAuth2SummitApiController@publishEvent');
- Route::delete('/publish', 'OAuth2SummitApiController@unPublishEvent');
- Route::post('/feedback', 'OAuth2SummitApiController@addEventFeedback');
- Route::get('/feedback/{attendee_id?}', 'OAuth2SummitApiController@getEventFeedback')->where('attendee_id', 'me|[0-9]+');
+ Route::get('', 'OAuth2SummitEventsApiController@getEvent');
+ Route::get('/published', 'OAuth2SummitEventsApiController@getScheduledEvent');
+ Route::put('', 'OAuth2SummitEventsApiController@updateEvent');
+ Route::delete('', 'OAuth2SummitEventsApiController@deleteEvent');
+ Route::put('/publish', 'OAuth2SummitEventsApiController@publishEvent');
+ Route::delete('/publish', 'OAuth2SummitEventsApiController@unPublishEvent');
+ Route::post('/feedback', 'OAuth2SummitEventsApiController@addEventFeedback');
+ Route::get('/feedback/{attendee_id?}', 'OAuth2SummitEventsApiController@getEventFeedback')->where('attendee_id', 'me|[0-9]+');
+ });
+ });
+
+ // presentations
+ Route::group(array('prefix' => 'presentations'), function () {
+ Route::group(array('prefix' => '{presentation_id}'), function () {
+
+ Route::group(array('prefix' => 'videos'), function () {
+ Route::get('', 'OAuth2PresentationApiController@getPresentationVideos');
+ Route::get('{video_id}', 'OAuth2PresentationApiController@getPresentationVideo');
+ Route::post('', 'OAuth2PresentationApiController@addVideo');
+ });
});
});
// locations
Route::group(array('prefix' => 'locations'), function () {
- Route::get('', 'OAuth2SummitApiController@getLocations');
+ Route::get('', 'OAuth2SummitLocationsApiController@getLocations');
Route::group(array('prefix' => '{location_id}'), function () {
- Route::get('', 'OAuth2SummitApiController@getLocation');
- Route::get('/events/published','OAuth2SummitApiController@getLocationEvents');
- Route::get('/events','OAuth2SummitApiController@getLocationPublishedEvents');
+ Route::get('', 'OAuth2SummitLocationsApiController@getLocation');
+ Route::get('/events/published','OAuth2SummitLocationsApiController@getLocationEvents');
+ Route::get('/events','OAuth2SummitLocationsApiController@getLocationPublishedEvents');
});
});
@@ -131,6 +148,40 @@ Route::group(array(
Route::post('{external_order_id}/external-attendees/{external_attendee_id}/confirm', 'OAuth2SummitApiController@confirmExternalOrderAttendee');
});
+ // member
+ Route::group(array('prefix' => 'members'), function () {
+ Route::group(array('prefix' => 'me'), function () {
+ Route::get('', 'OAuth2SummitMembersApiController@getMyMember');
+ });
+
+ });
+
+ });
+ });
+});
+
+//OAuth2 Protected API V2
+Route::group(array(
+ 'namespace' => 'App\Http\Controllers',
+ 'prefix' => 'api/v2',
+ 'before' => [],
+ 'after' => [],
+ 'middleware' => ['ssl', 'oauth2.protected', 'rate.limit','etags']
+), function () {
+
+ // summits
+ Route::group(array('prefix' => 'summits'), function () {
+
+ Route::group(array('prefix' => '{id}'), function () {
+
+ // events
+ Route::group(array('prefix' => 'events'), function () {
+
+ Route::group(array('prefix' => '{event_id}'), function () {
+ Route::post('/feedback', 'OAuth2SummitEventsApiController@addEventFeedbackByMember');
+ });
+ });
+
});
});
});
\ No newline at end of file
diff --git a/app/Jobs/Job.php b/app/Jobs/Job.php
new file mode 100644
index 00000000..55ece29a
--- /dev/null
+++ b/app/Jobs/Job.php
@@ -0,0 +1,21 @@
+ 'id:json_int',
'Name' => 'name:json_string',
);
-
}
\ No newline at end of file
diff --git a/app/Models/summit/SummitVenueRoom.php b/app/ModelSerializers/Locations/SummitAbstractLocationSerializer.php
similarity index 58%
rename from app/Models/summit/SummitVenueRoom.php
rename to app/ModelSerializers/Locations/SummitAbstractLocationSerializer.php
index 0a8784d5..d817ddcf 100644
--- a/app/Models/summit/SummitVenueRoom.php
+++ b/app/ModelSerializers/Locations/SummitAbstractLocationSerializer.php
@@ -1,6 +1,6 @@
- 'id:json_int',
- 'VenueID' => 'venue_id:json_int',
- 'ClassName' => 'class_name',
'Name' => 'name:json_string',
'Description' => 'description:json_string',
- 'Capacity' => 'Capacity:json_int',
- );
+ 'LocationType' => 'location_type',
+ 'Order' => 'order:json_int',
+ 'ClassName' => 'class_name:json_string',
+ );
}
\ No newline at end of file
diff --git a/app/ModelSerializers/Locations/SummitAirportSerializer.php b/app/ModelSerializers/Locations/SummitAirportSerializer.php
new file mode 100644
index 00000000..cc60ea47
--- /dev/null
+++ b/app/ModelSerializers/Locations/SummitAirportSerializer.php
@@ -0,0 +1,24 @@
+ 'airport_type:json_string',
+ );
+}
\ No newline at end of file
diff --git a/app/ModelSerializers/Locations/SummitExternalLocationSerializer.php b/app/ModelSerializers/Locations/SummitExternalLocationSerializer.php
new file mode 100644
index 00000000..97072156
--- /dev/null
+++ b/app/ModelSerializers/Locations/SummitExternalLocationSerializer.php
@@ -0,0 +1,25 @@
+ 'capacity:json_int',
+ );
+}
\ No newline at end of file
diff --git a/app/ModelSerializers/Locations/SummitGeoLocatedLocationSerializer.php b/app/ModelSerializers/Locations/SummitGeoLocatedLocationSerializer.php
new file mode 100644
index 00000000..abaed3c5
--- /dev/null
+++ b/app/ModelSerializers/Locations/SummitGeoLocatedLocationSerializer.php
@@ -0,0 +1,62 @@
+ 'address_1:json_string',
+ 'Address2' => 'address_2:json_string',
+ 'ZipCode' => 'zip_code',
+ 'City' => 'city:json_string',
+ 'State' => 'state:json_string',
+ 'Country' => 'country:json_string',
+ 'Lng' => 'lng',
+ 'Lat' => 'lat',
+ );
+
+ /**
+ * @param null $expand
+ * @param array $fields
+ * @param array $relations
+ * @param array $params
+ * @return array
+ */
+ public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() )
+ {
+ $values = parent::serialize($expand, $fields, $relations);
+ $location = $this->object;
+
+ $maps = array();
+ foreach($location->getMaps() as $m)
+ {
+ $maps[] = SerializerRegistry::getInstance()->getSerializer($m)->serialize();
+ }
+ $values['maps'] = $maps;
+
+ $images = array();
+ foreach($location->getImages() as $i)
+ {
+ $images[] = SerializerRegistry::getInstance()->getSerializer($i)->serialize();
+ }
+ $values['images'] = $images;
+
+ return $values;
+ }
+}
\ No newline at end of file
diff --git a/app/ModelSerializers/Locations/SummitHotelSerializer.php b/app/ModelSerializers/Locations/SummitHotelSerializer.php
new file mode 100644
index 00000000..ea22e946
--- /dev/null
+++ b/app/ModelSerializers/Locations/SummitHotelSerializer.php
@@ -0,0 +1,28 @@
+ 'booking_link:json_string',
+ 'HotelType' => 'hotel_type:json_string',
+ 'SoldOut' => 'sold_out:json_boolean',
+ );
+
+}
\ No newline at end of file
diff --git a/app/Models/summit/SummitLocationMap.php b/app/ModelSerializers/Locations/SummitLocationImageSerializer.php
similarity index 51%
rename from app/Models/summit/SummitLocationMap.php
rename to app/ModelSerializers/Locations/SummitLocationImageSerializer.php
index be314a25..5fffae6c 100644
--- a/app/Models/summit/SummitLocationMap.php
+++ b/app/ModelSerializers/Locations/SummitLocationImageSerializer.php
@@ -1,6 +1,6 @@
- 'id:json_int',
- 'LocationID' => 'location_id:json_int',
'Name' => 'name:json_text',
'Description' => 'description:json_text',
'ClassName' => 'class_name:json_text',
@@ -41,20 +29,20 @@ class SummitLocationMap extends SummitLocationImage
);
/**
- * @return Image
+ * @param null $expand
+ * @param array $fields
+ * @param array $relations
+ * @param array $params
+ * @return array
*/
- public function map()
+ public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() )
{
- return $this->hasOne('models\main\Image', 'ID', 'PictureID')->first();
- }
+ $values = parent::serialize($expand, $fields, $relations, $params);
- public function toArray()
- {
- $values = parent::toArray();
- $map = $this->map();
- if(!is_null($map))
+ if($this->object->hasPicture())
{
- $values['image_url'] = Config::get("server.assets_base_url", 'https://www.openstack.org/'). $map->Filename;
+ $picture = $this->object->getPicture();
+ $values['image_url'] = Config::get("server.assets_base_url", 'https://www.openstack.org/'). $picture->getFilename();
}
return $values;
}
diff --git a/app/ModelSerializers/Locations/SummitVenueFloorSerializer.php b/app/ModelSerializers/Locations/SummitVenueFloorSerializer.php
new file mode 100644
index 00000000..6e7c4033
--- /dev/null
+++ b/app/ModelSerializers/Locations/SummitVenueFloorSerializer.php
@@ -0,0 +1,64 @@
+ 'name:json_string',
+ 'Description' => 'description:json_string',
+ 'Number' => 'number:json_int',
+ 'VenueId' => 'venue_id:json_int',
+ );
+
+ /**
+ * @param null $expand
+ * @param array $fields
+ * @param array $relations
+ * @param array $params
+ * @return array
+ */
+ public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() )
+ {
+ $values = parent::serialize($expand, $fields, $relations, $params);
+ $floor = $this->object;
+ // floor image
+ $values['image'] = ($floor->getImage() !== null) ?
+ Config::get("server.assets_base_url", 'https://www.openstack.org/').$floor->getImage()->getFilename()
+ : null;
+ // rooms
+ $rooms = array();
+
+ foreach($floor->getRooms() as $room)
+ {
+
+ $rooms[] = strstr('rooms',$expand) === false ? intval($room->getId()) :
+ SerializerRegistry::getInstance()->getSerializer($room)->serialize($expand, $fields, $relations, $params);
+ }
+
+ if(count($rooms) > 0)
+ $values['rooms'] = $rooms;
+
+ return $values;
+ }
+}
\ No newline at end of file
diff --git a/app/ModelSerializers/Locations/SummitVenueRoomSerializer.php b/app/ModelSerializers/Locations/SummitVenueRoomSerializer.php
new file mode 100644
index 00000000..e562ac11
--- /dev/null
+++ b/app/ModelSerializers/Locations/SummitVenueRoomSerializer.php
@@ -0,0 +1,58 @@
+ 'venue_id:json_int',
+ 'FloorId' => 'floor_id:json_int',
+ 'Capacity' => 'capacity:json_int',
+ );
+
+ public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() )
+ {
+ $room = $this->object;
+ $values = parent::serialize($expand, $fields, $relations, $params);
+
+ if (!empty($expand)) {
+ $exp_expand = explode(',', $expand);
+ foreach ($exp_expand as $relation) {
+ switch (trim($relation)) {
+ case 'floor': {
+ if($room->hasFloor()) {
+ unset($values['floor_id']);
+ $values['floor'] = SerializerRegistry::getInstance()->getSerializer($room->getFloor())->serialize();
+ }
+ }
+ break;
+ case 'venue': {
+ if($room->hasVenue()) {
+ unset($values['venue_id']);
+ $values['venue'] = SerializerRegistry::getInstance()->getSerializer($room->getVenue())->serialize();
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ return $values;
+ }
+}
\ No newline at end of file
diff --git a/app/ModelSerializers/Locations/SummitVenueSerializer.php b/app/ModelSerializers/Locations/SummitVenueSerializer.php
new file mode 100644
index 00000000..635dd5ce
--- /dev/null
+++ b/app/ModelSerializers/Locations/SummitVenueSerializer.php
@@ -0,0 +1,60 @@
+ 'is_main::json_boolean',
+ );
+
+ /**
+ * @param null $expand
+ * @param array $fields
+ * @param array $relations
+ * @param array $params
+ * @return array
+ */
+ public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() )
+ {
+ $values = parent::serialize($expand, $fields, $relations, $params);
+ $venue = $this->object;
+ // rooms
+ $rooms = array();
+ foreach($venue->getRooms() as $room)
+ {
+ $rooms[] = SerializerRegistry::getInstance()->getSerializer($room)->serialize($expand, $fields, $relations, $params);
+ }
+ if(count($rooms) > 0)
+ $values['rooms'] = $rooms;
+
+ // floors
+ $floors = array();
+ foreach($venue->getFloors() as $floor)
+ {
+ $floors[] = SerializerRegistry::getInstance()->getSerializer($floor)->serialize($expand, $fields, $relations, $params);
+ }
+ if(count($floors) > 0)
+ $values['floors'] = $floors;
+
+ return $values;
+ }
+
+}
\ No newline at end of file
diff --git a/app/ModelSerializers/MemberSerializer.php b/app/ModelSerializers/MemberSerializer.php
new file mode 100644
index 00000000..22e42430
--- /dev/null
+++ b/app/ModelSerializers/MemberSerializer.php
@@ -0,0 +1,92 @@
+ 'first_name:json_string',
+ 'LastName' => 'last_name:json_string',
+ 'Gender' => 'gender:json_string',
+ 'Bio' => 'bio:json_string',
+ 'LinkedInProfile' => 'linked_in:json_string',
+ 'IrcHandle' => 'irc:json_string',
+ 'TwitterHandle' => 'twitter:json_string',
+ );
+
+
+ /**
+ * @param null $expand
+ * @param array $fields
+ * @param array $relations
+ * @param array $params
+ * @return array
+ */
+ public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array())
+ {
+ $member = $this->object;
+ $values = parent::serialize($expand, $fields, $relations, $params);
+ $values['pic'] = Config::get("server.assets_base_url", 'https://www.openstack.org/'). 'profile_images/members/'. $member->getId();
+ $summit = isset($params['summit'])? $params['summit'] :null;
+ $speaker = !is_null($summit)? $summit->getSpeakerByMember($member): null;
+ $attendee = !is_null($summit)? $summit->getAttendeeByMember($member): null;
+
+ if(!is_null($speaker))
+ $values['speaker_id'] = $speaker->getId();
+
+ if(!is_null($attendee))
+ $values['attendee_id'] = $attendee->getId();
+
+ if (!empty($expand)) {
+ $exp_expand = explode(',', $expand);
+ foreach ($exp_expand as $relation) {
+ switch (trim($relation)) {
+
+ case 'attendee': {
+ if (!is_null($attendee))
+ {
+ unset($values['attendee_id']);
+ $values['attendee'] = SerializerRegistry::getInstance()->getSerializer($attendee)->serialize(null,[],['none']);
+ }
+ }
+ break;
+ case 'speaker': {
+ if (!is_null($speaker))
+ {
+ unset($values['speaker_id']);
+ $values['speaker'] = SerializerRegistry::getInstance()->getSerializer($speaker)->serialize(null,[],['none']);
+ }
+ }
+ break;
+ case 'feedback': {
+ $feedback = array();
+ foreach ($member->getFeedbackBySummit($summit) as $f) {
+ array_push($feedback, SerializerRegistry::getInstance()->getSerializer($f)->serialize());
+ }
+ $values['feedback'] = $feedback;
+ }
+ break;
+ }
+ }
+ }
+
+ return $values;
+ }
+}
\ No newline at end of file
diff --git a/app/Models/summit/PresentationCategoryGroup.php b/app/ModelSerializers/PresentationCategoryGroupSerializer.php
similarity index 53%
rename from app/Models/summit/PresentationCategoryGroup.php
rename to app/ModelSerializers/PresentationCategoryGroupSerializer.php
index 25e94ee1..ff20bea7 100644
--- a/app/Models/summit/PresentationCategoryGroup.php
+++ b/app/ModelSerializers/PresentationCategoryGroupSerializer.php
@@ -1,6 +1,6 @@
- 'id:json_int',
'Name' => 'name:json_string',
'Color' => 'color:json_string',
'Description' => 'description:json_string',
);
-
- /**
- * @return PresentationCategory[]
- */
- public function categories()
- {
- return $this->belongsToMany('models\summit\PresentationCategory','PresentationCategoryGroup_Categories','PresentationCategoryGroupID','PresentationCategoryID')->get();
- }
-
/**
+ * @param null $expand
+ * @param array $fields
+ * @param array $relations
+ * @param array $params
* @return array
*/
- public function toArray()
+ public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() )
{
- $values = parent::toArray();
+ $values = parent::serialize($expand, $fields, $relations, $params);
+ $group = $this->object;
$color = isset($values['color']) ? $values['color']:'';
if(empty($color))
$color = 'f0f0ee';
@@ -56,11 +44,18 @@ class PresentationCategoryGroup extends SilverstripeBaseModel
$color = '#'.$color;
}
$values['color'] = $color;
- $categories = array();
- foreach($this->categories() as $c)
+
+ $categories = array();
+
+ foreach($group->getCategories() as $c)
{
- array_push($categories, intval($c->ID));
+ if(!is_null($expand) && in_array('tracks', explode(',',$expand))){
+ $categories[] = SerializerRegistry::getInstance()->getSerializer($c)->serialize();
+ }
+ else
+ $categories[] = intval($c->getId());
}
+
$values['tracks'] = $categories;
return $values;
}
diff --git a/app/ModelSerializers/PresentationCategorySerializer.php b/app/ModelSerializers/PresentationCategorySerializer.php
new file mode 100644
index 00000000..e1cf5190
--- /dev/null
+++ b/app/ModelSerializers/PresentationCategorySerializer.php
@@ -0,0 +1,47 @@
+ 'name:json_string',
+ 'Description' => 'description:json_string',
+ 'Code' => 'code:json_string',
+ );
+
+ /**
+ * @param null $expand
+ * @param array $fields
+ * @param array $relations
+ * @param array $params
+ * @return array
+ */
+ public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() )
+ {
+ $category = $this->object;
+ $values = parent::serialize($expand, $fields, $relations, $params);
+ $groups = array();
+
+ foreach($category->getGroups() as $group){
+ $groups[] = intval($group->getId());
+ }
+ $values['track_groups'] = $groups;
+ return $values;
+ }
+}
\ No newline at end of file
diff --git a/app/ModelSerializers/PresentationLinkSerializer.php b/app/ModelSerializers/PresentationLinkSerializer.php
new file mode 100644
index 00000000..5c684157
--- /dev/null
+++ b/app/ModelSerializers/PresentationLinkSerializer.php
@@ -0,0 +1,26 @@
+ 'link:json_text',
+ );
+
+}
\ No newline at end of file
diff --git a/app/Models/summit/PresentationVideo.php b/app/ModelSerializers/PresentationMaterialSerializer.php
similarity index 63%
rename from app/Models/summit/PresentationVideo.php
rename to app/ModelSerializers/PresentationMaterialSerializer.php
index b74d468b..92fd3e00 100644
--- a/app/Models/summit/PresentationVideo.php
+++ b/app/ModelSerializers/PresentationMaterialSerializer.php
@@ -1,6 +1,6 @@
- 'id:json_int',
'Name' => 'name:json_text',
'Description' => 'description:json_text',
'DisplayOnSite' => 'display_on_site:json_boolean',
'Featured' => 'featured:json_boolean',
- 'PresentationID' => 'presentation_id:json_int',
- 'YouTubeID' => 'youtube_id:json_text',
+ 'Order' => 'order:json_int',
+ 'PresentationId' => 'presentation_id:json_int',
);
-
}
\ No newline at end of file
diff --git a/app/ModelSerializers/PresentationSerializer.php b/app/ModelSerializers/PresentationSerializer.php
new file mode 100644
index 00000000..d99d888f
--- /dev/null
+++ b/app/ModelSerializers/PresentationSerializer.php
@@ -0,0 +1,114 @@
+ 'level',
+ 'CategoryId' => 'track_id:json_int',
+ 'ModeratorId' => 'moderator_speaker_id:json_int',
+ 'ProblemAddressed' => 'problem_addressed:json_string',
+ 'AttendeesExpectedLearnt' => 'attendees_expected_learnt:json_string',
+ );
+
+ protected static $allowed_fields = array
+ (
+ 'track_id',
+ 'moderator_speaker_id',
+ 'level',
+ 'problem_addressed',
+ 'attendees_expected_learnt',
+ );
+
+ protected static $allowed_relations = array
+ (
+ 'slides',
+ 'videos',
+ 'speakers',
+ 'links',
+ );
+
+ /**
+ * @param null $expand
+ * @param array $fields
+ * @param array $relations
+ * @param array $params
+ * @return array
+ */
+ public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() )
+ {
+ if(!count($relations)) $relations = $this->getAllowedRelations();
+
+ $values = parent::serialize($expand, $fields, $relations, $params);
+
+ $presentation = $this->object;
+
+ if(in_array('speakers', $relations)) {
+ $values['speakers'] = $presentation->getSpeakerIds();
+ }
+
+ if(in_array('slides', $relations))
+ {
+ $slides = array();
+ foreach ($presentation->getSlides() as $slide) {
+ $slide_values = SerializerRegistry::getInstance()->getSerializer($slide)->serialize();
+ if(empty($slide_values['link'])) continue;
+ $slides[] = $slide_values;
+ }
+ $values['slides'] = $slides;
+ }
+
+ if(in_array('links', $relations))
+ {
+ $links = array();
+ foreach ($presentation->getLinks() as $link) {
+ $link_values = SerializerRegistry::getInstance()->getSerializer($link)->serialize();
+ if(empty($link_values['link'])) continue;
+ $links[] = $link_values;
+ }
+ $values['links'] = $links;
+ }
+
+ if(in_array('videos', $relations))
+ {
+ $videos = array();
+ foreach ($presentation->getVideos() as $video) {
+ $video_values = SerializerRegistry::getInstance()->getSerializer($video)->serialize();
+ if(empty($video_values['youtube_id'])) continue;
+ $videos[] = $video_values;
+ }
+ $values['videos'] = $videos;
+ }
+
+ if (!empty($expand)) {
+ foreach (explode(',', $expand) as $relation) {
+ switch (trim($relation)) {
+ case 'speakers': {
+ $speakers = array();
+ foreach ($presentation->getSpeakers() as $s) {
+ $speakers[] = SerializerRegistry::getInstance()->getSerializer($s)->serialize();
+ }
+ $values['speakers'] = $speakers;
+ }
+ break;
+ }
+ }
+ }
+ return $values;
+ }
+}
diff --git a/app/ModelSerializers/PresentationSlideSerializer.php b/app/ModelSerializers/PresentationSlideSerializer.php
new file mode 100644
index 00000000..0b5519e5
--- /dev/null
+++ b/app/ModelSerializers/PresentationSlideSerializer.php
@@ -0,0 +1,43 @@
+ 'link:json_text',
+ );
+
+ /**
+ * @param null $expand
+ * @param array $fields
+ * @param array $relations
+ * @param array $params
+ * @return array
+ */
+ public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() )
+ {
+ $values = parent::serialize($expand, $fields, $relations, $params);
+ $slide = $this->object;
+ if(empty($values['link'])){
+ $values['link'] = $slide->hasSlide() ? Config::get("server.assets_base_url", 'https://www.openstack.org/') . $slide->getSlide()->getFilename(): null;
+ }
+ return $values;
+ }
+}
\ No newline at end of file
diff --git a/app/ModelSerializers/PresentationSpeakerSerializer.php b/app/ModelSerializers/PresentationSpeakerSerializer.php
new file mode 100644
index 00000000..25538f4e
--- /dev/null
+++ b/app/ModelSerializers/PresentationSpeakerSerializer.php
@@ -0,0 +1,93 @@
+ 'first_name:json_string',
+ 'LastName' => 'last_name:json_string',
+ 'Title' => 'title:json_string',
+ 'Bio' => 'bio:json_string',
+ 'IRCHandle' => 'irc:json_string',
+ 'TwitterName' => 'twitter:json_string',
+ );
+
+ protected static $allowed_relations = array
+ (
+ 'member',
+ );
+
+ /**
+ * @param null $expand
+ * @param array $fields
+ * @param array $relations
+ * @param array $params
+ * @return array
+ */
+ public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() )
+ {
+ if(!count($relations)) $relations = $this->getAllowedRelations();
+ $values = parent::serialize($expand, $fields, $relations, $params);
+ $speaker = $this->object;
+ $summit_id = isset($params['summit_id'])? intval($params['summit_id']):null;
+ $published = isset($params['published'])? intval($params['published']):true;
+ $values['presentations'] = $speaker->getPresentationIds($summit_id, $published);
+ $values['pic'] = Config::get("server.assets_base_url", 'https://www.openstack.org/') . 'profile_images/speakers/' . $speaker->getId();
+
+ if (in_array('member', $relations) && $speaker->hasMember())
+ {
+ $member = $speaker->getMember();
+ $values['gender'] = $member->getGender();
+ $values['member_id'] = intval($member->getId());
+ }
+
+ if(empty($values['first_name']) || empty($values['last_name'])){
+
+ $first_name = '';
+ $last_name = '';
+ if ($speaker->hasMember())
+ {
+ $member = $speaker->getMember();
+ $first_name = $member->getFirstName();
+ $last_name = $member->getLastName();
+ }
+ $values['first_name'] = $first_name;
+ $values['last_name'] = $last_name;
+ }
+
+ if (!empty($expand)) {
+ foreach (explode(',', $expand) as $relation) {
+ switch (trim($relation)) {
+ case 'presentations': {
+ $presentations = array();
+ foreach ($speaker->getPresentations() as $p) {
+ $presentations[] = SerializerRegistry::getInstance()->getSerializer($p)->serialize();
+ }
+ $values['presentations'] = $presentations;
+ }
+
+ }
+ }
+ }
+
+ return $values;
+ }
+}
\ No newline at end of file
diff --git a/app/ModelSerializers/PresentationVideoSerializer.php b/app/ModelSerializers/PresentationVideoSerializer.php
new file mode 100644
index 00000000..de98c0d9
--- /dev/null
+++ b/app/ModelSerializers/PresentationVideoSerializer.php
@@ -0,0 +1,28 @@
+ 'youtube_id:json_text',
+ 'DateUploaded' => 'data_uploaded:datetime_epoch',
+ 'Highlighted' => 'highlighted:json_boolean',
+ 'Views' => 'views:json_int',
+ );
+
+}
\ No newline at end of file
diff --git a/app/ModelSerializers/SerializerRegistry.php b/app/ModelSerializers/SerializerRegistry.php
new file mode 100644
index 00000000..67a795c1
--- /dev/null
+++ b/app/ModelSerializers/SerializerRegistry.php
@@ -0,0 +1,97 @@
+registry['Summit'] = SummitSerializer::class;
+ $this->registry['SummitType'] = SummitTypeSerializer::class;
+ $this->registry['SummitEventType'] = SummitEventTypeSerializer::class;
+ $this->registry['SummitTicketType'] = SummitTicketTypeSerializer::class;
+ $this->registry['PresentationCategory'] = PresentationCategorySerializer::class;
+ $this->registry['PresentationCategoryGroup'] = PresentationCategoryGroupSerializer::class;
+ $this->registry['Tag'] = TagSerializer::class;
+ $this->registry['SummitEvent'] = SummitEventSerializer::class;
+ $this->registry['Presentation'] = PresentationSerializer::class;
+ $this->registry['PresentationVideo'] = PresentationVideoSerializer::class;
+ $this->registry['PresentationSlide'] = PresentationSlideSerializer::class;
+ $this->registry['PresentationLink'] = PresentationLinkSerializer::class;
+ $this->registry['Company'] = CompanySerializer::class;
+ $this->registry['PresentationSpeaker'] = PresentationSpeakerSerializer::class;
+ $this->registry['SummitEventFeedback'] = SummitEventFeedbackSerializer::class;
+ $this->registry['SummitAttendee'] = SummitAttendeeSerializer::class;
+ $this->registry['SummitAttendeeSchedule'] = SummitAttendeeScheduleSerializer::class;
+ $this->registry['SummitEntityEvent'] = SummitEntityEventSerializer::class;
+
+ // locations
+ $this->registry['SummitVenue'] = SummitVenueSerializer::class;
+ $this->registry['SummitVenueRoom'] = SummitVenueRoomSerializer::class;
+ $this->registry['SummitVenueFloor'] = SummitVenueFloorSerializer::class;
+ $this->registry['SummitExternalLocation'] = SummitExternalLocationSerializer::class;
+ $this->registry['SummitHotel'] = SummitHotelSerializer::class;
+ $this->registry['SummitAirport'] = SummitAirportSerializer::class;
+ $this->registry['SummitLocationImage'] = SummitLocationImageSerializer::class;
+
+ // member
+ $this->registry['Member'] = MemberSerializer::class;
+
+ }
+
+ /**
+ * @param object $object
+ * @return IModelSerializer
+ */
+ public function getSerializer($object){
+ $reflect = new \ReflectionClass($object);
+ $class = $reflect->getShortName();
+ if(!isset($this->registry[$class]))
+ throw new \InvalidArgumentException('Serializer not found for '.$class);
+
+ $serializer_class = $this->registry[$class];
+ return new $serializer_class($object);
+ }
+}
\ No newline at end of file
diff --git a/app/ModelSerializers/SilverStripeSerializer.php b/app/ModelSerializers/SilverStripeSerializer.php
new file mode 100644
index 00000000..b1fa3581
--- /dev/null
+++ b/app/ModelSerializers/SilverStripeSerializer.php
@@ -0,0 +1,27 @@
+ 'id:json_int',
+ );
+}
\ No newline at end of file
diff --git a/app/ModelSerializers/SummitAttendeeScheduleSerializer.php b/app/ModelSerializers/SummitAttendeeScheduleSerializer.php
new file mode 100644
index 00000000..d0e272d3
--- /dev/null
+++ b/app/ModelSerializers/SummitAttendeeScheduleSerializer.php
@@ -0,0 +1,43 @@
+object;
+
+ $values = SerializerRegistry::getInstance()->getSerializer($schedule->getEvent())->serialize
+ (
+ $expand,
+ $fields,
+ $relations,
+ $params
+ );
+
+ $values['is_checked_in'] = JsonUtils::toJsonBoolean($schedule->isIsCheckedIn());
+ return $values;
+ }
+}
\ No newline at end of file
diff --git a/app/ModelSerializers/SummitAttendeeSerializer.php b/app/ModelSerializers/SummitAttendeeSerializer.php
new file mode 100644
index 00000000..f8394e8a
--- /dev/null
+++ b/app/ModelSerializers/SummitAttendeeSerializer.php
@@ -0,0 +1,128 @@
+ 'summit_hall_checked_in:json_boolean',
+ 'SummitHallCheckedInDate' => 'summit_hall_checked_in_date:datetime_epoch',
+ 'SharedContactInfo' => 'shared_contact_info:json_boolean',
+ 'MemberId' => 'member_id:json_int',
+ );
+
+ protected static $allowed_relations = array
+ (
+ 'member',
+ );
+
+ /**
+ * @param null $expand
+ * @param array $fields
+ * @param array $relations
+ * @param array $params
+ * @return array
+ */
+ public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array())
+ {
+ if(!count($relations)) $relations = $this->getAllowedRelations();
+ $attendee = $this->object;
+ $summit = $attendee->getSummit();
+ $values = parent::serialize($expand, $fields, $relations, $params);
+
+ $values['schedule'] = $attendee->getScheduledEventsIds();
+
+ $tickets = array();
+ foreach($attendee->getTickets() as $t)
+ {
+ if(!$t->hasTicketType()) continue;
+ array_push($tickets, intval($t->getTicketType()->getId()));
+ }
+ $values['tickets'] = $tickets;
+
+ if(in_array('member', $relations) && $attendee->hasMember())
+ {
+ $member = $attendee->getMember();
+ $values['first_name'] = JsonUtils::toJsonString($member->getFirstName());
+ $values['last_name'] = JsonUtils::toJsonString($member->getLastName());
+ $values['gender'] = $member->getGender();
+ $values['bio'] = JsonUtils::toJsonString($member->getBio());
+ $values['pic'] = Config::get("server.assets_base_url", 'https://www.openstack.org/'). 'profile_images/members/'. $member->getId();
+ $values['linked_in'] = $member->getLinkedInProfile();
+ $values['irc'] = $member->getIRCHandle();
+ $values['twitter'] = $member->getTwitterHandle();
+
+
+ $speaker = $summit->getSpeakerByMember($member);
+
+ if (!is_null($speaker)) {
+ $values['speaker_id'] = intval($speaker->getId());
+ }
+ }
+
+ if (!empty($expand)) {
+ $exp_expand = explode(',', $expand);
+ foreach ($exp_expand as $relation) {
+ switch (trim($relation)) {
+ case 'schedule': {
+ unset($values['schedule']);
+ $schedule = array();
+ foreach ($attendee->getSchedule() as $s) {
+ if(!$summit->isEventOnSchedule($s->getEvent()->getId())) continue;
+ array_push($schedule, SerializerRegistry::getInstance()->getSerializer($s)->serialize());
+ }
+ $values['schedule'] = $schedule;
+ }
+ break;
+ case 'tickets': {
+ unset($values['tickets']);
+ $tickets = array();
+ foreach($attendee->getTickets() as $t)
+ {
+ array_push($tickets, SerializerRegistry::getInstance()->getSerializer($t->getTicketType())->serialize());
+ }
+ $values['tickets'] = $tickets;
+ }
+ break;
+ case 'speaker': {
+ if (!is_null($speaker))
+ {
+ unset($values['speaker_id']);
+ $values['speaker'] = SerializerRegistry::getInstance()->getSerializer($speaker)->serialize();
+ }
+ }
+ break;
+ case 'feedback': {
+ $feedback = array();
+ foreach ($attendee->getEmittedFeedback() as $f) {
+ if(!$summit->isEventOnSchedule($f->getEvent()->getId())) continue;
+ array_push($feedback, SerializerRegistry::getInstance()->getSerializer($f)->serialize());
+ }
+ $values['feedback'] = $feedback;
+ }
+ break;
+ }
+ }
+ }
+
+ return $values;
+ }
+}
\ No newline at end of file
diff --git a/app/ModelSerializers/SummitEntityEventSerializer.php b/app/ModelSerializers/SummitEntityEventSerializer.php
new file mode 100644
index 00000000..f97800b6
--- /dev/null
+++ b/app/ModelSerializers/SummitEntityEventSerializer.php
@@ -0,0 +1,53 @@
+ 'entity_id:json_int',
+ 'EntityClassName' => 'class_name:json_string',
+ 'Created' => 'created:datetime_epoch',
+ 'Type' => 'type',
+ );
+
+ /**
+ * @param null $expand
+ * @param array $fields
+ * @param array $relations
+ * @param array $params
+ * @return array
+ */
+ public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array())
+ {
+ $entity_event = $this->object;
+ $values = parent::serialize($expand, $fields, $relations, $params);
+ $entity = $entity_event->getEntity();
+
+ if(!is_null($entity))
+ {
+ $values['entity'] = SerializerRegistry::getInstance()->getSerializer($entity)->serialize
+ (
+ $expand,
+ $fields,
+ $relations,
+ $params
+ );
+ }
+ return $values;
+ }
+}
\ No newline at end of file
diff --git a/app/ModelSerializers/SummitEventFeedbackSerializer.php b/app/ModelSerializers/SummitEventFeedbackSerializer.php
new file mode 100644
index 00000000..5e271b9a
--- /dev/null
+++ b/app/ModelSerializers/SummitEventFeedbackSerializer.php
@@ -0,0 +1,80 @@
+ 'rate:json_int',
+ 'Note' => 'note:json_string',
+ 'Created' => 'created_date:datetime_epoch',
+ 'EventId' => 'event_id:json_int',
+ );
+
+ /**
+ * @param null $expand
+ * @param array $fields
+ * @param array $relations
+ * @param array $params
+ * @return array
+ */
+ public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array())
+ {
+ $feedback = $this->object;
+ $values = parent::serialize($expand, $fields, $relations, $params);
+ $event = $feedback->getEvent();
+ $member = $feedback->hasOwner() ? $feedback->getOwner() : null;
+
+ if (is_null($member)) return $values;
+
+ $summit = $event->getSummit();
+ $attendee = $summit->getAttendeeByMemberId($member->getId());
+
+ if (!empty($expand)) {
+ foreach (explode(',', $expand) as $relation) {
+ switch (trim($relation)) {
+ case 'owner': {
+
+ $owner = array
+ (
+ 'id' => intval($member->getId()),
+ 'first_name' => JsonUtils::toJsonString($member->getFirstName()),
+ 'last_name' => JsonUtils::toJsonString($member->getLastName())
+ );
+
+ if (!is_null($attendee))
+ $owner['attendee_id'] = intval($attendee->getId());
+
+ $values['owner'] = $owner;
+ }
+ break;
+ }
+ }
+ }
+
+ if(!isset($values['owner'])) {
+ $values['member_id'] = intval($member->getId());
+ if (!is_null($attendee)) $values['attendee_id'] = intval($attendee->getId());
+ }
+
+ return $values;
+ }
+}
\ No newline at end of file
diff --git a/app/ModelSerializers/SummitEventSerializer.php b/app/ModelSerializers/SummitEventSerializer.php
new file mode 100644
index 00000000..912cc7de
--- /dev/null
+++ b/app/ModelSerializers/SummitEventSerializer.php
@@ -0,0 +1,130 @@
+ 'title:json_string',
+ 'Description' => 'description:json_string',
+ 'StartDate' => 'start_date:datetime_epoch',
+ 'EndDate' => 'end_date:datetime_epoch',
+ 'LocationId' => 'location_id:json_int',
+ 'SummitId' => 'summit_id:json_int',
+ 'TypeId' => 'type_id:json_int',
+ 'ClassName' => 'class_name',
+ 'AllowFeedBack' => 'allow_feedback:json_boolean',
+ 'AvgFeedbackRate' => 'avg_feedback_rate:json_float',
+ 'Published' => 'is_published:json_boolean',
+ 'HeadCount' => 'head_count:json_int',
+ 'RSVPLink' => 'rsvp_link:json_string',
+ );
+
+ protected static $allowed_fields = array
+ (
+ 'id',
+ 'title',
+ 'description',
+ 'start_date',
+ 'end_date',
+ 'location_id',
+ 'summit_id',
+ 'type_id',
+ 'class_name',
+ 'allow_feedback',
+ 'avg_feedback_rate',
+ 'is_published',
+ 'head_count',
+ 'rsvp_link',
+ );
+
+ protected static $allowed_relations = array
+ (
+ 'summit_types',
+ 'sponsors',
+ 'tags',
+ );
+
+ /**
+ * @param null $expand
+ * @param array $fields
+ * @param array $relations
+ * @param array $params
+ * @return array
+ */
+ public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() )
+ {
+ if(!count($relations)) $relations = $this->getAllowedRelations();
+ $event = $this->object;
+ $values = parent::serialize($expand, $fields, $relations, $params);
+
+ //check if description is empty, if so, set short description
+ if(array_key_exists('description', $values) && empty($values['description']))
+ {
+ $values['description'] = JsonUtils::toJsonString($event->getShortDescription());
+ }
+
+ if(in_array('summit_types', $relations))
+ $values['summit_types'] = $event->getSummitTypesIds();
+
+ if(in_array('sponsors', $relations))
+ $values['sponsors'] = $event->getSponsorsIds();
+
+ if(in_array('tags', $relations))
+ {
+ $tags = array();
+ foreach ($event->getTags() as $tag) {
+ $tags[] = SerializerRegistry::getInstance()->getSerializer($tag)->serialize();
+ }
+ $values['tags'] = $tags;
+ }
+
+ if (!empty($expand)) {
+ foreach (explode(',', $expand) as $relation) {
+ switch (trim($relation)) {
+ case 'feedback': {
+ $feedback = array();
+ foreach ($event->getFeedback() as $f) {
+ $feedback[] = SerializerRegistry::getInstance()->getSerializer($f)->serialize();
+ }
+ $values['feedback'] = $feedback;
+ }
+ break;
+ case 'location': {
+ if($event->hasLocation()){
+ unset($values['location_id']);
+ $values['location'] = SerializerRegistry::getInstance()->getSerializer($event->getLocation())->serialize();
+ }
+ }
+ break;
+ case 'sponsors': {
+ $sponsors = array();
+ foreach ($event->getSponsors() as $s) {
+ $sponsors[] = SerializerRegistry::getInstance()->getSerializer($s)->serialize();
+ }
+ $values['sponsors'] = $sponsors;
+ }
+ break;
+ }
+ }
+ }
+
+ return $values;
+ }
+}
\ No newline at end of file
diff --git a/app/Models/summit/SummitEventType.php b/app/ModelSerializers/SummitEventTypeSerializer.php
similarity index 62%
rename from app/Models/summit/SummitEventType.php
rename to app/ModelSerializers/SummitEventTypeSerializer.php
index 4a870750..9072fe93 100644
--- a/app/Models/summit/SummitEventType.php
+++ b/app/ModelSerializers/SummitEventTypeSerializer.php
@@ -1,6 +1,6 @@
- 'id:json_int',
'Type' => 'name:json_string',
'Color' => 'color:json_string',
'BlackoutTimes' => 'black_out_times:json_boolean',
);
- public function toArray()
+ /**
+ * @param null $expand
+ * @param array $fields
+ * @param array $relations
+ * @param array $params
+ * @return array
+ */
+ public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() )
{
- $values = parent::toArray();
+ $values = parent::serialize($expand, $fields, $relations, $params);
$color = isset($values['color']) ? $values['color']:'';
if(empty($color))
$color = 'f0f0ee';
diff --git a/app/ModelSerializers/SummitSerializer.php b/app/ModelSerializers/SummitSerializer.php
new file mode 100644
index 00000000..90779343
--- /dev/null
+++ b/app/ModelSerializers/SummitSerializer.php
@@ -0,0 +1,150 @@
+ 'name:json_string',
+ 'BeginDate' => 'start_date:datetime_epoch',
+ 'EndDate' => 'end_date:datetime_epoch',
+ 'StartShowingVenuesDate' => 'start_showing_venues_date:datetime_epoch',
+ 'Active' => 'active:json_boolean',
+ 'ScheduleDefaultStartDate' => 'schedule_start_date:datetime_epoch',
+ );
+
+ /**
+ * @param null $expand
+ * @param array $fields
+ * @param array $relations
+ * @param array $params
+ * @return array
+ */
+ public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array())
+ {
+ $summit = $this->object;
+ $values = parent::serialize($expand, $fields, $relations, $params);
+ $time_zone_list = timezone_identifiers_list();
+ $time_zone_id = $summit->getTimeZoneId();
+ $values['time_zone'] = null;
+
+ if (!empty($time_zone_id) && isset($time_zone_list[$time_zone_id])) {
+
+ $time_zone_name = $time_zone_list[$time_zone_id];
+ $time_zone = new \DateTimeZone($time_zone_name);
+ $time_zone_info = $time_zone->getLocation();
+ $time_zone_info['name'] = $time_zone->getName();
+ $now = new \DateTime("now", $time_zone);
+ $time_zone_info['offset'] = $time_zone->getOffset($now);
+ $values['time_zone'] = $time_zone_info;
+ }
+
+ $values['logo'] = ($summit->hasLogo()) ?
+ Config::get("server.assets_base_url", 'https://www.openstack.org/') . $summit->getLogo()->getFilename()
+ : null;
+
+ // pages info
+ $main_page = $summit->getMainPage();
+ $schedule_page = $summit->getSchedulePage();
+ $values['page_url'] = sprintf("%ssummit/%s", Config::get("server.assets_base_url", 'https://www.openstack.org/'), $main_page);
+ $values['schedule_page_url'] = sprintf("%ssummit/%s/%s", Config::get("server.assets_base_url", 'https://www.openstack.org/'), $main_page, $schedule_page);
+ $values['schedule_event_detail_url'] = sprintf("%ssummit/%s/%s/%s", Config::get("server.assets_base_url", 'https://www.openstack.org/'), $main_page, $schedule_page, 'events/:event_id/:event_title');
+
+ // summit types
+ $summit_types = array();
+ foreach ($summit->getSummitTypes() as $type) {
+ $summit_types[] = SerializerRegistry::getInstance()->getSerializer($type)->serialize();
+ }
+ $values['summit_types'] = $summit_types;
+ // tickets
+ $ticket_types = array();
+ foreach ($summit->getTicketTypes() as $ticket) {
+ $ticket_types[] = SerializerRegistry::getInstance()->getSerializer($ticket)->serialize();
+ }
+ $values['ticket_types'] = $ticket_types;
+ //locations
+ $locations = array();
+ foreach ($summit->getLocations() as $location) {
+ $locations[] = SerializerRegistry::getInstance()->getSerializer($location)->serialize();
+ }
+ $values['locations'] = $locations;
+
+ if (!empty($expand)) {
+ $expand = explode(',', $expand);
+ foreach ($expand as $relation) {
+ switch (trim($relation)) {
+ case 'schedule': {
+ $event_types = array();
+ foreach ($summit->getEventTypes() as $event_type) {
+ $event_types[] = SerializerRegistry::getInstance()->getSerializer($event_type)->serialize();
+ }
+ $values['event_types'] = $event_types;
+
+ $presentation_categories = array();
+ foreach ($summit->getPresentationCategories() as $cat) {
+ $presentation_categories[] = SerializerRegistry::getInstance()->getSerializer($cat)->serialize();
+ }
+ $values['tracks'] = $presentation_categories;
+
+ // track_groups
+ $track_groups = array();
+ foreach ($summit->getCategoryGroups() as $group) {
+ $track_groups[] = SerializerRegistry::getInstance()->getSerializer($group)->serialize();
+ }
+ $values['track_groups'] = $track_groups;
+
+ $schedule = array();
+ foreach ($summit->getScheduleEvents() as $event) {
+ $schedule[] = SerializerRegistry::getInstance()->getSerializer($event)->serialize();
+ }
+ $values['schedule'] = $schedule;
+
+ $sponsors = array();
+ foreach ($summit->getSponsors() as $company) {
+ $sponsors[] = SerializerRegistry::getInstance()->getSerializer($company)->serialize();
+ }
+ $values['sponsors'] = $sponsors;
+
+ $speakers = array();
+ foreach ($summit->getSpeakers() as $speaker) {
+ $speakers[] =
+ SerializerRegistry::getInstance()->getSerializer($speaker)->serialize
+ (
+ null, [], [],
+ [
+ 'summit_id' => $summit->getId(),
+ 'published' => true
+ ]
+ );
+
+ }
+ $values['speakers'] = $speakers;
+ }
+ break;
+ }
+ }
+ }
+ $values['timestamp'] = time();
+ return $values;
+ }
+
+
+}
\ No newline at end of file
diff --git a/app/ModelSerializers/SummitTicketTypeSerializer.php b/app/ModelSerializers/SummitTicketTypeSerializer.php
new file mode 100644
index 00000000..b009ba80
--- /dev/null
+++ b/app/ModelSerializers/SummitTicketTypeSerializer.php
@@ -0,0 +1,41 @@
+ 'name:json_string',
+ 'Description' => 'description:json_string',
+ );
+
+ /**
+ * @param null $expand
+ * @param array $fields
+ * @param array $relations
+ * @param array $params
+ * @return array
+ */
+ public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() )
+ {
+ $values = parent::serialize($expand, $fields, $relations, $params);
+ $ticket_type = $this->object;
+ $values['allowed_summit_types'] = $ticket_type->getAllowedSummitTypeIds();
+ return $values;
+ }
+}
\ No newline at end of file
diff --git a/app/Models/summit/SummitType.php b/app/ModelSerializers/SummitTypeSerializer.php
similarity index 62%
rename from app/Models/summit/SummitType.php
rename to app/ModelSerializers/SummitTypeSerializer.php
index ebf6751e..cc362e8c 100644
--- a/app/Models/summit/SummitType.php
+++ b/app/ModelSerializers/SummitTypeSerializer.php
@@ -1,6 +1,6 @@
- 'id:json_int',
'Title' => 'name:json_string',
'Color' => 'color:json_string',
'Type' => 'type:json_string',
);
- public function toArray()
+ /**
+ * @param null $expand
+ * @param array $fields
+ * @param array $relations
+ * @param array $params
+ * @return array
+ */
+ public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() )
{
- $values = parent::toArray();
+ $values = parent::serialize($expand, $fields, $relations, $params);
$color = isset($values['color']) ? $values['color']:'';
if(empty($color))
$color = 'f0f0ee';
diff --git a/app/Models/main/Tag.php b/app/ModelSerializers/TagSerializer.php
similarity index 67%
rename from app/Models/main/Tag.php
rename to app/ModelSerializers/TagSerializer.php
index fb1f5bef..55376c33 100644
--- a/app/Models/main/Tag.php
+++ b/app/ModelSerializers/TagSerializer.php
@@ -1,6 +1,6 @@
- 'id:json_int',
'Tag' => 'tag:json_string',
);
-
}
\ No newline at end of file
diff --git a/app/Models/exceptions/EntityNotFoundException.php b/app/Models/Exceptions/EntityNotFoundException.php
similarity index 100%
rename from app/Models/exceptions/EntityNotFoundException.php
rename to app/Models/Exceptions/EntityNotFoundException.php
diff --git a/app/Models/exceptions/ValidationException.php b/app/Models/Exceptions/ValidationException.php
similarity index 97%
rename from app/Models/exceptions/ValidationException.php
rename to app/Models/Exceptions/ValidationException.php
index b33d2e9c..0f5ea1e7 100644
--- a/app/Models/exceptions/ValidationException.php
+++ b/app/Models/Exceptions/ValidationException.php
@@ -1,4 +1,4 @@
-sponsorships = new ArrayCollection();
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * @param mixed $name
+ */
+ public function setName($name)
+ {
+ $this->name = $name;
+ }
+
+ /**
+ * @ORM\Column(name="Name", type="string")
+ */
+ private $name;
+
+ /**
+ * @ORM\ManyToMany(targetEntity="models\summit\SummitEvent", mappedBy="sponsors")
+ */
+ private $sponsorships;
+
+}
\ No newline at end of file
diff --git a/app/Models/main/File.php b/app/Models/Foundation/Main/File.php
similarity index 54%
rename from app/Models/main/File.php
rename to app/Models/Foundation/Main/File.php
index 740af437..95c08b29 100644
--- a/app/Models/main/File.php
+++ b/app/Models/Foundation/Main/File.php
@@ -1,4 +1,4 @@
- 'id:json_int',
- 'Name' => 'name:json_string',
- 'Title' => 'description:json_string',
- 'Filename' => 'file_name:json_string',
- 'Content' => 'content:json_string',
- 'ClassName' => 'class_name',
- );
+ /**
+ * @ORM\Column(name="Name", type="string")
+ */
+ private $name;
/**
- * @return int
+ * @return string
*/
- public function getIdentifier()
- {
- return (int)$this->ID;
- }
+ public function getName(){ return $this->name;}
+
+ /**
+ * @ORM\Column(name="Title", type="string")
+ */
+ private $title;
+
+ /**
+ * @return string
+ */
+ public function getTitle(){ return $this->title;}
+
+ /**
+ * @ORM\Column(name="Filename", type="string")
+ */
+ private $filename;
+
+ /**
+ * @return string
+ */
+ public function getFilename(){ return $this->filename;}
}
\ No newline at end of file
diff --git a/app/Models/Foundation/Main/Member.php b/app/Models/Foundation/Main/Member.php
new file mode 100644
index 00000000..af83d06d
--- /dev/null
+++ b/app/Models/Foundation/Main/Member.php
@@ -0,0 +1,185 @@
+bio;
+ }
+
+ /**
+ * @return string
+ */
+ public function getLinkedInProfile()
+ {
+ return $this->linked_in_profile;
+ }
+
+ /**
+ * @return string
+ */
+ public function getIrcHandle()
+ {
+ return $this->irc_handle;
+ }
+
+ /**
+ * @return string
+ */
+ public function getTwitterHandle()
+ {
+ return $this->twitter_handle;
+ }
+ /**
+ * @ORM\ManyToOne(targetEntity="models\main\File")
+ * @ORM\JoinColumn(name="PhotoID", referencedColumnName="ID")
+ * @var File
+ */
+ private $photo;
+
+ /**
+ * @ORM\Column(name="FirstName", type="string")
+ * @var string
+ */
+ private $first_name;
+
+ /**
+ * @ORM\Column(name="Bio", type="string")
+ * @var string
+ */
+ private $bio;
+
+ /**
+ * @ORM\Column(name="LinkedInProfile", type="string")
+ * @var string
+ */
+ private $linked_in_profile;
+
+ /**
+ * @ORM\Column(name="IRCHandle", type="string")
+ * @var string
+ */
+ private $irc_handle;
+
+ /**
+ * @ORM\Column(name="TwitterName", type="string")
+ * @var string
+ */
+ private $twitter_handle;
+
+
+ /**
+ * @ORM\Column(name="Gender", type="string")
+ * @var string
+ */
+ private $gender;
+
+ /**
+ * @return string
+ */
+ public function getGender(){
+ return $this->gender;
+ }
+
+ /**
+ * @return string
+ */
+ public function getLastName()
+ {
+ return $this->last_name;
+ }
+
+ /**
+ * @return string
+ */
+ public function getFirstName()
+ {
+ return $this->first_name;
+ }
+
+ /**
+ * @ORM\Column(name="Surname", type="string")
+ * @var string
+ */
+ private $last_name;
+
+ /**
+ * @ORM\OneToMany(targetEntity="models\summit\SummitEventFeedback", mappedBy="owner", cascade={"persist"})
+ * @var SummitEventFeedback[]
+ */
+ private $feedback;
+
+ public function __construct()
+ {
+ parent::__construct();
+ $this->feedback = new ArrayCollection();
+ }
+
+ /**
+ * @return File
+ */
+ public function getPhoto()
+ {
+ return $this->photo;
+ }
+
+ /**
+ * @param File $photo
+ */
+ public function setPhoto(File $photo)
+ {
+ $this->photo = $photo;
+ }
+
+ /**
+ * @return SummitEventFeedback[]
+ */
+ public function getFeedback(){
+ return $this->feedback;
+ }
+
+ /**
+ * @param Summit $summit
+ * @return SummitEventFeedback[]
+ */
+ public function getFeedbackBySummit(Summit $summit){
+ return $this->createQueryBuilder()
+ ->select('distinct f')
+ ->from('models\summit\SummitEventFeedback','f')
+ ->join('f.event','e')
+ ->join('f.owner','o')
+ ->join('e.summit','s')
+ ->where('s.id = :summit_id and o.id = :owner_id')
+ ->setParameter('summit_id', $summit->getId())
+ ->setParameter('owner_id', $this->getId())
+ ->getQuery()->getResult();
+ }
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Main/Repositories/IMemberRepository.php b/app/Models/Foundation/Main/Repositories/IMemberRepository.php
new file mode 100644
index 00000000..f3727c58
--- /dev/null
+++ b/app/Models/Foundation/Main/Repositories/IMemberRepository.php
@@ -0,0 +1,30 @@
+tag;
+ }
+
+ /**
+ * @param string $tag
+ */
+ public function setTag($tag)
+ {
+ $this->tag = $tag;
+ }
+
+ /**
+ * Tag constructor.
+ * @param string $tag
+ */
+ public function __construct($tag)
+ {
+ $this->tag = $tag;
+ }
+
+}
\ No newline at end of file
diff --git a/app/Models/marketplace/CompanyService.php b/app/Models/Foundation/Marketplace/CompanyService.php
similarity index 100%
rename from app/Models/marketplace/CompanyService.php
rename to app/Models/Foundation/Marketplace/CompanyService.php
diff --git a/app/Models/marketplace/Consultant.php b/app/Models/Foundation/Marketplace/Consultant.php
similarity index 100%
rename from app/Models/marketplace/Consultant.php
rename to app/Models/Foundation/Marketplace/Consultant.php
diff --git a/app/Models/marketplace/DataCenterLocation.php b/app/Models/Foundation/Marketplace/DataCenterLocation.php
similarity index 100%
rename from app/Models/marketplace/DataCenterLocation.php
rename to app/Models/Foundation/Marketplace/DataCenterLocation.php
diff --git a/app/Models/marketplace/DataCenterRegion.php b/app/Models/Foundation/Marketplace/DataCenterRegion.php
similarity index 100%
rename from app/Models/marketplace/DataCenterRegion.php
rename to app/Models/Foundation/Marketplace/DataCenterRegion.php
diff --git a/app/Models/marketplace/ICloudService.php b/app/Models/Foundation/Marketplace/ICloudService.php
similarity index 100%
rename from app/Models/marketplace/ICloudService.php
rename to app/Models/Foundation/Marketplace/ICloudService.php
diff --git a/app/Models/marketplace/ICloudServiceRepository.php b/app/Models/Foundation/Marketplace/ICloudServiceRepository.php
similarity index 100%
rename from app/Models/marketplace/ICloudServiceRepository.php
rename to app/Models/Foundation/Marketplace/ICloudServiceRepository.php
diff --git a/app/Models/marketplace/ICompanyServiceRepository.php b/app/Models/Foundation/Marketplace/ICompanyServiceRepository.php
similarity index 100%
rename from app/Models/marketplace/ICompanyServiceRepository.php
rename to app/Models/Foundation/Marketplace/ICompanyServiceRepository.php
diff --git a/app/Models/marketplace/IConsultant.php b/app/Models/Foundation/Marketplace/IConsultant.php
similarity index 100%
rename from app/Models/marketplace/IConsultant.php
rename to app/Models/Foundation/Marketplace/IConsultant.php
diff --git a/app/Models/marketplace/IConsultantRepository.php b/app/Models/Foundation/Marketplace/IConsultantRepository.php
similarity index 100%
rename from app/Models/marketplace/IConsultantRepository.php
rename to app/Models/Foundation/Marketplace/IConsultantRepository.php
diff --git a/app/Models/marketplace/IPrivateCloudServiceRepository.php b/app/Models/Foundation/Marketplace/IPrivateCloudServiceRepository.php
similarity index 100%
rename from app/Models/marketplace/IPrivateCloudServiceRepository.php
rename to app/Models/Foundation/Marketplace/IPrivateCloudServiceRepository.php
diff --git a/app/Models/marketplace/IPublicCloudServiceRepository.php b/app/Models/Foundation/Marketplace/IPublicCloudServiceRepository.php
similarity index 100%
rename from app/Models/marketplace/IPublicCloudServiceRepository.php
rename to app/Models/Foundation/Marketplace/IPublicCloudServiceRepository.php
diff --git a/app/Models/marketplace/Office.php b/app/Models/Foundation/Marketplace/Office.php
similarity index 100%
rename from app/Models/marketplace/Office.php
rename to app/Models/Foundation/Marketplace/Office.php
diff --git a/app/Models/marketplace/PrivateCloudService.php b/app/Models/Foundation/Marketplace/PrivateCloudService.php
similarity index 100%
rename from app/Models/marketplace/PrivateCloudService.php
rename to app/Models/Foundation/Marketplace/PrivateCloudService.php
diff --git a/app/Models/marketplace/PublicCloudService.php b/app/Models/Foundation/Marketplace/PublicCloudService.php
similarity index 100%
rename from app/Models/marketplace/PublicCloudService.php
rename to app/Models/Foundation/Marketplace/PublicCloudService.php
diff --git a/app/Models/Foundation/Summit/Attendees/ConfirmationExternalOrderRequest.php b/app/Models/Foundation/Summit/Attendees/ConfirmationExternalOrderRequest.php
new file mode 100644
index 00000000..f27a3b97
--- /dev/null
+++ b/app/Models/Foundation/Summit/Attendees/ConfirmationExternalOrderRequest.php
@@ -0,0 +1,92 @@
+summit;
+ }
+
+ /**
+ * @return int
+ */
+ public function getMemberId()
+ {
+ return $this->member_id;
+ }
+
+ /**
+ * @return string
+ */
+ public function getExternalOrderId()
+ {
+ return $this->external_order_id;
+ }
+
+ /**
+ * @return string
+ */
+ public function getExternalAttendeeId()
+ {
+ return $this->external_attendee_id;
+ }
+
+ /**
+ * @var int
+ */
+ private $member_id;
+
+ /**
+ * @var string
+ */
+ private $external_order_id;
+
+ /**
+ * @var string
+ */
+ private $external_attendee_id;
+
+ /**
+ * ConfirmationExternalOrderRequest constructor.
+ * @param Summit $summit
+ * @param int $member_id
+ * @param string $external_order_id
+ * @param string $external_attendee_id
+ */
+ public function __construct(
+ Summit $summit,
+ $member_id,
+ $external_order_id,
+ $external_attendee_id
+ )
+ {
+ $this->summit = $summit;
+ $this->member_id = $member_id;
+ $this->external_order_id = $external_order_id;
+ $this->external_attendee_id = $external_attendee_id;
+ }
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/Attendees/SummitAttendee.php b/app/Models/Foundation/Summit/Attendees/SummitAttendee.php
new file mode 100644
index 00000000..ba629cd0
--- /dev/null
+++ b/app/Models/Foundation/Summit/Attendees/SummitAttendee.php
@@ -0,0 +1,253 @@
+summit_hall_checked_in_date;
+ }
+
+ /**
+ * @return bool
+ */
+ public function getSummitHallCheckedIn(){
+ return (bool)$this->summit_hall_checked_in;
+ }
+
+ /**
+ * @return boolean
+ */
+ public function getSharedContactInfo()
+ {
+ return $this->share_contact_info;
+ }
+
+ /**
+ * @param boolean $share_contact_info
+ */
+ public function setShareContactInfo($share_contact_info)
+ {
+ $this->share_contact_info = $share_contact_info;
+ }
+
+ /**
+ * @ORM\OneToMany(targetEntity="SummitAttendeeSchedule", mappedBy="attendee", cascade={"persist"}, orphanRemoval=true)
+ * @var SummitAttendeeSchedule[]
+ */
+ private $schedule;
+
+ /**
+ * @ORM\ManyToOne(targetEntity="models\main\Member")
+ * @ORM\JoinColumn(name="MemberID", referencedColumnName="ID")
+ * @var Member
+ */
+ private $member;
+
+ /**
+ * @return int
+ */
+ public function getMemberId(){
+ try{
+ return $this->member->getId();
+ }
+ catch(\Exception $ex){
+ return 0;
+ }
+ }
+
+ /**
+ * @return bool
+ */
+ public function hasMember(){
+ return $this->getMemberId() > 0;
+ }
+
+ /**
+ * @ORM\OneToMany(targetEntity="SummitAttendeeTicket", mappedBy="owner", cascade={"persist"})
+ * @var SummitAttendeeTicket[]
+ */
+ private $tickets;
+
+ /**
+ * @return SummitAttendeeTicket[]
+ */
+ public function getTickets(){
+ return $this->tickets;
+ }
+
+ /**
+ * @param SummitAttendeeTicket $ticket
+ */
+ public function addTicket(SummitAttendeeTicket $ticket){
+ $this->tickets->add($ticket);
+ $ticket->setOwner($this);
+ }
+
+ /**
+ * @return Member
+ */
+ public function getMember(){
+ return $this->member;
+ }
+
+ /**
+ * @param Member $member
+ */
+ public function setMember(Member $member){
+ $this->member = $member;
+ }
+
+ use SummitOwned;
+
+ public function __construct()
+ {
+ parent::__construct();
+ $this->share_contact_info = false;
+ $this->summit_hall_checked_in = false;
+ $this->schedule = new ArrayCollection();
+ $this->tickets = new ArrayCollection();
+ }
+
+ /**
+ * @return SummitEventFeedback[]
+ */
+ public function getEmittedFeedback(){
+
+ return $this->member->getFeedback()->matching
+ (
+ Criteria::create()->orderBy(["id" => Criteria::ASC])
+ );
+ }
+
+ /**
+ * @param SummitEvent $event
+ * @throws ValidationException
+ */
+ public function add2Schedule(SummitEvent $event)
+ {
+ $schedule = $this->getScheduleByEvent($event);
+
+ if($schedule !== false)
+ throw new ValidationException(sprintf('Event %s already belongs to attendee %s schedule.', $event->getId(), $this->getId()));
+
+ $schedule = new SummitAttendeeSchedule;
+
+ $schedule->setAttendee($this);
+ $schedule->setEvent($event);
+ $schedule->setIsCheckedIn(false);
+ $this->schedule->add($schedule);
+ }
+
+ /**
+ * @param SummitEvent $event
+ * @throws ValidationException
+ */
+ public function removeFromSchedule(SummitEvent $event)
+ {
+ $schedule = $this->getScheduleByEvent($event);
+ if($schedule === false)
+ throw new ValidationException
+ (
+ sprintf('Event %s does not belongs to attendee %s schedule.', $event->getId(), $this->getId())
+ );
+
+ $this->schedule->removeElement($schedule);
+ $schedule->clearAttendee();
+ }
+
+ /**
+ * @param SummitEvent $event
+ * @return bool
+ */
+ public function isOnSchedule(SummitEvent $event)
+ {
+ return $this->getScheduleByEvent($event) !== false;
+ }
+
+ /**
+ * @param SummitEvent $event
+ * @return SummitAttendeeSchedule
+ */
+ public function getScheduleByEvent(SummitEvent $event){
+ return $this->schedule->filter(function($e) use($event){
+ return $e->getEvent()->getId() == $event->getId();
+ })->first();
+ }
+
+ /**
+ * @param SummitEvent $event
+ * @throws ValidationException
+ */
+ public function checkIn(SummitEvent $event)
+ {
+ $schedule = $this->getScheduleByEvent($event);
+
+ if($schedule === false)
+ throw new ValidationException(sprintf('Event %s does not belongs to attendee %s schedule.', $event->ID, $this->ID));
+ $schedule->setIsCheckedIn(true);
+ }
+
+ /**
+ * @return SummitAttendeeSchedule[]
+ */
+ public function getSchedule(){
+ return $this->schedule;
+ }
+
+ /**
+ * @return int[]
+ */
+ public function getScheduledEventsIds(){
+ return $this->schedule->map(function($entity) {
+ return $entity->getEvent()->getId();
+ })->toArray();
+ }
+
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/Attendees/SummitAttendeeSchedule.php b/app/Models/Foundation/Summit/Attendees/SummitAttendeeSchedule.php
new file mode 100644
index 00000000..03b2ee05
--- /dev/null
+++ b/app/Models/Foundation/Summit/Attendees/SummitAttendeeSchedule.php
@@ -0,0 +1,166 @@
+id;
+ }
+
+ /**
+ * @return SummitAttendee
+ */
+ public function getAttendee()
+ {
+ return $this->attendee;
+ }
+
+ /**
+ * @param SummitAttendee $attendee
+ */
+ public function setAttendee($attendee)
+ {
+ $this->attendee = $attendee;
+ }
+
+ public function clearAttendee(){
+ $this->attendee = null;
+ $this->event = null;
+ }
+
+ /**
+ * @return SummitEvent
+ */
+ public function getEvent()
+ {
+ return $this->event;
+ }
+
+ /**
+ * @param SummitEvent $event
+ */
+ public function setEvent($event)
+ {
+ $this->event = $event;
+ }
+
+ /**
+ * @return boolean
+ */
+ public function isIsCheckedIn()
+ {
+ return $this->is_checked_in;
+ }
+
+ /**
+ * @param boolean $is_checked_in
+ */
+ public function setIsCheckedIn($is_checked_in)
+ {
+ $this->is_checked_in = $is_checked_in;
+ }
+
+ /**
+ * @return string
+ */
+ public function getGoogleCalendarEventId()
+ {
+ return $this->google_calendar_event_id;
+ }
+
+ /**
+ * @param string $google_calendar_event_id
+ */
+ public function setGoogleCalendarEventId($google_calendar_event_id)
+ {
+ $this->google_calendar_event_id = $google_calendar_event_id;
+ }
+
+ /**
+ * @return string
+ */
+ public function getAppleCalendarEventId()
+ {
+ return $this->apple_calendar_event_id;
+ }
+
+ /**
+ * @param string $apple_calendar_event_id
+ */
+ public function setAppleCalendarEventId($apple_calendar_event_id)
+ {
+ $this->apple_calendar_event_id = $apple_calendar_event_id;
+ }
+
+ /**
+ * @return int
+ */
+ public function getIdentifier()
+ {
+ return $this->id;
+ }
+
+ /**
+ * @ORM\ManyToOne(targetEntity="SummitAttendee", inversedBy="schedule")
+ * @ORM\JoinColumn(name="SummitAttendeeID", referencedColumnName="ID", nullable=true )
+ * @var SummitAttendee
+ */
+ private $attendee;
+
+ /**
+ * @ORM\ManyToOne(targetEntity="SummitEvent")
+ * @ORM\JoinColumn(name="SummitEventID", referencedColumnName="ID")
+ * @var SummitEvent
+ */
+ private $event;
+
+ /**
+ * @ORM\Column(name="IsCheckedIn", type="boolean")
+ * @var bool
+ */
+ private $is_checked_in;
+
+ /**
+ * @ORM\Column(name="GoogleCalEventId", type="integer")
+ * @var string
+ */
+ private $google_calendar_event_id;
+
+ /**
+ * @ORM\Column(name="AppleCalEventId", type="boolean")
+ * @var string
+ */
+ private $apple_calendar_event_id;
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/Attendees/SummitAttendeeTicket.php b/app/Models/Foundation/Summit/Attendees/SummitAttendeeTicket.php
new file mode 100644
index 00000000..078f7753
--- /dev/null
+++ b/app/Models/Foundation/Summit/Attendees/SummitAttendeeTicket.php
@@ -0,0 +1,179 @@
+changed_date;
+ }
+
+ /**
+ * @param mixed $changed_date
+ */
+ public function setChangedDate($changed_date)
+ {
+ $this->changed_date = $changed_date;
+ }
+ /**
+ * @return string
+ */
+ public function getExternalOrderId()
+ {
+ return $this->external_order_id;
+ }
+
+ /**
+ * @param string $external_order_id
+ */
+ public function setExternalOrderId($external_order_id)
+ {
+ $this->external_order_id = $external_order_id;
+ }
+
+ /**
+ * @return string
+ */
+ public function getExternalAttendeeId()
+ {
+ return $this->external_attendee_id;
+ }
+
+ /**
+ * @param string $external_attendee_id
+ */
+ public function setExternalAttendeeId($external_attendee_id)
+ {
+ $this->external_attendee_id = $external_attendee_id;
+ }
+
+ /**
+ * @return \DateTime
+ */
+ public function getBoughtDate()
+ {
+ return $this->bought_date;
+ }
+
+ /**
+ * @param \DateTime $bought_date
+ */
+ public function setBoughtDate($bought_date)
+ {
+ $this->bought_date = $bought_date;
+ }
+
+ /**
+ * @return SummitTicketType
+ */
+ public function getTicketType()
+ {
+ return $this->ticket_type;
+ }
+
+ /**
+ * @return int
+ */
+ public function getTicketTypeId(){
+ try{
+ return $this->ticket_type->getId();
+ }
+ catch(\Exception $ex){
+ return 0;
+ }
+ }
+
+ /**
+ * @return bool
+ */
+ public function hasTicketType(){
+ return $this->getTicketTypeId() > 0;
+ }
+
+ /**
+ * @param SummitTicketType $ticket_type
+ */
+ public function setTicketType($ticket_type)
+ {
+ $this->ticket_type = $ticket_type;
+ }
+
+ /**
+ * @return SummitAttendee
+ */
+ public function getOwner()
+ {
+ return $this->owner;
+ }
+
+ /**
+ * @param SummitAttendee $owner
+ */
+ public function setOwner($owner)
+ {
+ $this->owner = $owner;
+ }
+
+ /**
+ * @ORM\Column(name="ExternalOrderId", type="string")
+ * @var string
+ */
+ private $external_order_id;
+
+ /**
+ * @ORM\Column(name="ExternalAttendeeId", type="string")
+ * @var
+ */
+ private $external_attendee_id;
+
+ /**
+ * @ORM\Column(name="TicketBoughtDate", type="datetime")
+ * @var \DateTime
+ */
+ private $bought_date;
+
+ /**
+ * @ORM\Column(name="TicketChangedDate", type="datetime")
+ * @var \DateTime
+ */
+ private $changed_date;
+
+
+ /**
+ * @ORM\ManyToOne(targetEntity="SummitTicketType", fetch="EAGER")
+ * @ORM\JoinColumn(name="TicketTypeID", referencedColumnName="ID")
+ * @var SummitTicketType
+ */
+ private $ticket_type;
+
+ /**
+ * @ORM\ManyToOne(targetEntity="SummitAttendee")
+ * @ORM\JoinColumn(name="OwnerID", referencedColumnName="ID")
+ * @var SummitAttendee
+ */
+ private $owner;
+
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/EntityEvents/EntityEventList.php b/app/Models/Foundation/Summit/EntityEvents/EntityEventList.php
new file mode 100644
index 00000000..09d06bb2
--- /dev/null
+++ b/app/Models/Foundation/Summit/EntityEvents/EntityEventList.php
@@ -0,0 +1,126 @@
+container = $values;
+ }
+
+ /**
+ * @return array
+ */
+ public function values(){
+ return array_values($this->container);
+ }
+
+ /**
+ * @return int
+ */
+ public function size(){
+ return count($this->container);
+ }
+ /**
+ * @return int
+ */
+ public function getIdx(){ return $this->idx; }
+
+ /**
+ * Whether a offset exists
+ * @link http://php.net/manual/en/arrayaccess.offsetexists.php
+ * @param mixed $offset
+ * An offset to check for.
+ *
+ * @return boolean true on success or false on failure.
+ *
+ *
+ * The return value will be casted to boolean if non-boolean was returned.
+ * @since 5.0.0
+ */
+ public function offsetExists($offset)
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Offset to retrieve
+ * @link http://php.net/manual/en/arrayaccess.offsetget.php
+ * @param mixed $offset
+ * The offset to retrieve.
+ *
+ * @return mixed Can return all value types.
+ * @since 5.0.0
+ */
+ public function offsetGet($offset)
+ {
+ return isset($this->container[$offset]) ? $this->container[$offset] : null;
+ }
+
+ /**
+ * Offset to set
+ * @link http://php.net/manual/en/arrayaccess.offsetset.php
+ * @param mixed $offset
+ * The offset to assign the value to.
+ *
+ * @param mixed $value
+ * The value to set.
+ *
+ * @return void
+ * @since 5.0.0
+ */
+ public function offsetSet($offset, $value)
+ {
+ if (is_null($offset)) {
+ ++$this->idx;
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Offset to unset
+ * @link http://php.net/manual/en/arrayaccess.offsetunset.php
+ * @param mixed $offset
+ * The offset to unset.
+ *
+ * @return void
+ * @since 5.0.0
+ */
+ public function offsetUnset($offset)
+ {
+ unset($this->container[$offset]);
+ }
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/EntityEvents/SummitEntityEventProcessContext.php b/app/Models/Foundation/Summit/EntityEvents/SummitEntityEventProcessContext.php
new file mode 100644
index 00000000..51a35fa0
--- /dev/null
+++ b/app/Models/Foundation/Summit/EntityEvents/SummitEntityEventProcessContext.php
@@ -0,0 +1,170 @@
+list = new EntityEventList();
+ $this->current_member_id = $current_member_id;
+ }
+
+ /**
+ * @return int|null
+ */
+ public function getCurrentMemberId(){ return $this->current_member_id; }
+
+ /**
+ * @param SummitEntityEvent $entity_event
+ * @return bool
+ */
+ public function existsOpType(SummitEntityEvent $entity_event){
+ switch($entity_event->getType()){
+ case 'INSERT': return $this->existsInsertOp($entity_event);break;
+ case 'UPDATE': return $this->existsUpdateOp($entity_event);break;
+ case 'DELETE': return $this->existsDeleteOp($entity_event);break;
+ default: throw new \InvalidArgumentException;break;
+ }
+ }
+
+ public function registerOpType(SummitEntityEvent $entity_event){
+ switch($entity_event->getType()){
+ case 'INSERT': return $this->registerInsertOp($entity_event);break;
+ case 'UPDATE': return $this->registerUpdateOp($entity_event);break;
+ case 'DELETE': return $this->registerDeleteOp($entity_event);break;
+ default: throw new \InvalidArgumentException;break;
+ }
+ }
+ /**
+ * @param SummitEntityEvent $entity_event
+ * @return bool
+ */
+ public function existsDeleteOp(SummitEntityEvent $entity_event){
+ return isset($this->delete_operations[$entity_event->getKey()]);
+ }
+
+ /**
+ * @param SummitEntityEvent $entity_event
+ */
+ public function registerDeleteOp(SummitEntityEvent $entity_event){
+ $this->delete_operations[$entity_event->getKey()] = $entity_event->getKey();
+ }
+
+ /**
+ * @param SummitEntityEvent $entity_event
+ * @return bool
+ */
+ public function existsUpdateOp(SummitEntityEvent $entity_event){
+ return isset($this->update_operations[$entity_event->getKey()]);
+ }
+
+ /**
+ * @param SummitEntityEvent $entity_event
+ */
+ public function registerUpdateOp(SummitEntityEvent $entity_event){
+ $this->update_operations[$entity_event->getKey()] = $entity_event->getKey();
+ }
+
+ /**
+ * @param SummitEntityEvent $entity_event
+ * @return bool
+ */
+ public function existsInsertOp(SummitEntityEvent $entity_event){
+ return isset($this->insert_operations[$entity_event->getKey()]);
+ }
+
+ /**
+ * @param SummitEntityEvent $entity_event
+ */
+ public function registerInsertOp(SummitEntityEvent $entity_event){
+ $this->insert_operations[$entity_event->getKey()] = $entity_event->getKey();
+ }
+
+ /**
+ * @param SummitEntityEvent $entity_event
+ */
+ public function registerSummitEventOp(SummitEntityEvent $entity_event){
+ $key = $entity_event->getKey();
+ if(!isset($this->summit_events_operations[$key])) $this->summit_events_operations[$key] = array();
+ array_push($this->summit_events_operations[$key], ['idx' => $this->list->getIdx() - 1 , 'op' => $entity_event->getType()]);
+ }
+
+ /**
+ * @param SummitEntityEvent $e
+ */
+ public function registerEntityEvent(SummitEntityEvent $e){
+ $this->list[] = SerializerRegistry::getInstance()->getSerializer($e)->serialize
+ (
+ implode(',',['speakers','tracks','sponsors', 'floor'])
+ );
+ }
+
+ /**
+ * @return array
+ */
+ public function getListValues(){
+ return $this->list->values();
+ }
+
+ public function postProcessList(){
+ foreach ($this->summit_events_operations as $key => $ops) {
+ $last_idx = null;
+ $last_op = null;
+ $must_insert = false;
+ foreach ($ops as $op) {
+ if (!is_null($last_idx))
+ unset($this->list[$last_idx]);
+ $last_op = $op['op'];
+ $last_idx = intval($op['idx']);
+ $must_insert = !$must_insert && $last_op === 'INSERT' ? true : $must_insert;
+ }
+ $last_op = $must_insert && $last_op !== 'DELETE' ? 'INSERT' : $last_op;
+ $summit_events_ops[$key] = array(['idx' => $last_idx, 'op' => ($last_op)]);
+ // element update
+ $e = $this->list[$last_idx];
+ $e['type'] = $last_op;
+ $this->list[$last_idx] = $e;
+ }
+ }
+
+ /**
+ * @return int
+ */
+ public function getListSize(){
+ return $this->list->size();
+ }
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/EntityEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/EntityEventType.php
new file mode 100644
index 00000000..6ca93a7c
--- /dev/null
+++ b/app/Models/Foundation/Summit/EntityEvents/Types/EntityEventType.php
@@ -0,0 +1,49 @@
+entity_event = $entity_event;
+ $this->process_ctx = $process_ctx;
+ }
+
+ /**
+ * @return IEntity|null
+ */
+ abstract protected function registerEntity();
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/EntityEventTypeFactory.php b/app/Models/Foundation/Summit/EntityEvents/Types/EntityEventTypeFactory.php
new file mode 100644
index 00000000..3a97964e
--- /dev/null
+++ b/app/Models/Foundation/Summit/EntityEvents/Types/EntityEventTypeFactory.php
@@ -0,0 +1,153 @@
+getEntityClassName())
+ {
+ case 'Presentation':
+ case 'SummitEvent':
+ {
+ if ($e->getType() === 'UPDATE' || $e->getType() === "INSERT")
+ return new SummitEventEntityEventInsertOrUpdateType($e, $ctx);
+ return new SummitEventEntityEventDeleteType($e, $ctx);
+ }
+ break;
+ case 'MySchedule':
+ {
+ return new MyScheduleEntityEventType($e, $ctx);
+ }
+ break;
+ case 'Summit':
+ {
+ return new SummitEntityEventType($e, $ctx);
+ }
+ break;
+ case 'SummitType':
+ {
+ return new SummitTypeEntityEventType($e, $ctx);
+ }
+ break;
+ case 'SummitEventType':
+ {
+ return new SummitEventTypeEntityEventType($e, $ctx);
+ }
+ break;
+ case 'SummitVenue':
+ case 'SummitVenueRoom':
+ case 'SummitAirport':
+ case 'SummitHotel':
+ case 'SummitGeoLocatedLocation':
+ case 'SummitExternalLocation':
+ case 'SummitAbstractLocation':
+ case 'VenueFloorFromVenueRoom':
+ {
+ return new SummitLocationEntityEventType($e, $ctx);
+ }
+ break;
+ case 'PresentationSpeaker':
+ {
+ return new PresentationSpeakerEntityEventType($e, $ctx);
+ }
+ break;
+ case 'SummitTicketType':
+ {
+ return new SummitTicketTypeEntityEventType($e, $ctx);
+ }
+ break;
+ case 'SummitLocationImage':
+ case 'SummitLocationMap':
+ {
+ return new SummitLocationImageEventType($e, $ctx);
+ }
+ break;
+ case 'PresentationCategory':
+ {
+ return new PresentationCategoryEntityEventType($e, $ctx);
+ }
+ break;
+ case 'PresentationCategoryGroup':
+ {
+ return new PresentationCategoryGroupEntityEventType($e, $ctx);
+ }
+ break;
+ case 'PresentationSlide':
+ case 'PresentationVideo':
+ case 'PresentationLink':
+ {
+ return new PresentationMaterialEntityEventType($e, $ctx);
+ }
+ break;
+ case 'SpeakerFromPresentation':
+ case 'SummitTypeFromEvent':
+ case 'SponsorFromEvent':
+ {
+ return new SummitEventRelationEntityEventType($e, $ctx);
+ }
+ break;
+ case 'TrackFromTrackGroup':
+ {
+ return new TrackFromTrackGroupEventType($e, $ctx);
+ }
+ break;
+ case 'SummitVenueFloor':
+ {
+ return new SummitVenueFloorEntityEventType($e, $ctx);
+ }
+ break;
+ case 'WipeData':
+ {
+ return new WipeDataEntityEventType($e, $ctx);
+ }
+ break;
+ default:
+ throw new InvalidArgumentException(sprintf('invalid entity class name %s!', $e->getEntityClassName()));
+ break;
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/GenericSummitEntityEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/GenericSummitEntityEventType.php
new file mode 100644
index 00000000..14fe4504
--- /dev/null
+++ b/app/Models/Foundation/Summit/EntityEvents/Types/GenericSummitEntityEventType.php
@@ -0,0 +1,36 @@
+process_ctx->existsOpType($this->entity_event)) return;
+ $this->process_ctx->registerOpType($this->entity_event);
+ if ($this->entity_event->getType() === 'UPDATE' || $this->entity_event->getType() === "INSERT") {
+ $entity = $this->registerEntity();
+ if (is_null($entity)) return;
+ }
+ $this->process_ctx->registerEntityEvent($this->entity_event);
+ }
+}
\ No newline at end of file
diff --git a/app/Models/summit/SummitAirport.php b/app/Models/Foundation/Summit/EntityEvents/Types/IEntityEventType.php
similarity index 74%
rename from app/Models/summit/SummitAirport.php
rename to app/Models/Foundation/Summit/EntityEvents/Types/IEntityEventType.php
index 8107a8ef..91b0572a 100644
--- a/app/Models/summit/SummitAirport.php
+++ b/app/Models/Foundation/Summit/EntityEvents/Types/IEntityEventType.php
@@ -1,6 +1,7 @@
-process_ctx->getCurrentMemberId();
+ if (is_null($member_id) || intval($member_id) !== $this->entity_event->getOwnerId()) return;
+ if($this->entity_event->getType() === 'INSERT'){
+ $entity = $this->registerEntity();
+ if (is_null($entity)) return;
+ }
+ $this->process_ctx->registerEntityEvent($this->entity_event);
+ }
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/PresentationCategoryEntityEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/PresentationCategoryEntityEventType.php
new file mode 100644
index 00000000..9889098e
--- /dev/null
+++ b/app/Models/Foundation/Summit/EntityEvents/Types/PresentationCategoryEntityEventType.php
@@ -0,0 +1,32 @@
+entity_event->getSummit()->getPresentationCategory($this->entity_event->getEntityId());
+ if(is_null($entity)) return null;
+ $this->entity_event->registerEntity($entity);
+ return $entity;
+ }
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/PresentationCategoryGroupEntityEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/PresentationCategoryGroupEntityEventType.php
new file mode 100644
index 00000000..33244758
--- /dev/null
+++ b/app/Models/Foundation/Summit/EntityEvents/Types/PresentationCategoryGroupEntityEventType.php
@@ -0,0 +1,34 @@
+entity_event->getSummit()->getCategoryGroup($this->entity_event->getEntityId());
+ if(is_null($entity)) return null;
+ $this->entity_event->registerEntity($entity);
+ return $entity;
+ }
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/PresentationMaterialEntityEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/PresentationMaterialEntityEventType.php
new file mode 100644
index 00000000..c0f5b8d1
--- /dev/null
+++ b/app/Models/Foundation/Summit/EntityEvents/Types/PresentationMaterialEntityEventType.php
@@ -0,0 +1,37 @@
+entity_event->getMetadata();
+ if(!isset($metadata['presentation_id'])) return null;
+ $presentation = $this->entity_event->getSummit()->getScheduleEvent(intval($metadata['presentation_id']));
+ if (is_null($presentation)) return null;
+ $material = $presentation->getMaterial($this->entity_event->getEntityId());
+ if(is_null($material)) return null;
+ $this->entity_event->registerEntity($material);
+ return $material;
+ }
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/PresentationSpeakerEntityEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/PresentationSpeakerEntityEventType.php
new file mode 100644
index 00000000..f4f8b693
--- /dev/null
+++ b/app/Models/Foundation/Summit/EntityEvents/Types/PresentationSpeakerEntityEventType.php
@@ -0,0 +1,34 @@
+entity_event->getSummit()->getSpeaker($this->entity_event->getEntityId());
+ if(!is_null($entity))
+ $this->entity_event->registerEntity($entity);
+ return $entity;
+ }
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/SummitEntityEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/SummitEntityEventType.php
new file mode 100644
index 00000000..cfcb7278
--- /dev/null
+++ b/app/Models/Foundation/Summit/EntityEvents/Types/SummitEntityEventType.php
@@ -0,0 +1,34 @@
+entity_event->getSummit();
+ if(is_null($summit)) return null;
+ if($summit->getId() !== $this->entity_event->getEntityId()) return null;
+ return $this->entity_event->registerEntity($summit);
+ }
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/SummitEventEntityEventDeleteType.php b/app/Models/Foundation/Summit/EntityEvents/Types/SummitEventEntityEventDeleteType.php
new file mode 100644
index 00000000..58aa2b0b
--- /dev/null
+++ b/app/Models/Foundation/Summit/EntityEvents/Types/SummitEventEntityEventDeleteType.php
@@ -0,0 +1,30 @@
+process_ctx->existsDeleteOp($this->entity_event)) return;
+ $this->process_ctx->registerDeleteOp($this->entity_event);
+ $this->process_ctx->registerEntityEvent($this->entity_event);
+ }
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/SummitEventEntityEventInsertOrUpdateType.php b/app/Models/Foundation/Summit/EntityEvents/Types/SummitEventEntityEventInsertOrUpdateType.php
new file mode 100644
index 00000000..4677dbb5
--- /dev/null
+++ b/app/Models/Foundation/Summit/EntityEvents/Types/SummitEventEntityEventInsertOrUpdateType.php
@@ -0,0 +1,50 @@
+entity_event->getMetadata();
+ $published_old = isset($metadata['pub_old']) ? (bool)intval($metadata['pub_old']) : false;
+ $published_current = isset($metadata['pub_new']) ? (bool)intval($metadata['pub_new']) : false;
+
+ // the event was not published at the moment of UPDATE .. then skip it!
+ if (!$published_old && !$published_current) return;
+ $entity = $this->registerEntity();
+ if (!is_null($entity)) // if event exists its bc its published
+ {
+ $this->entity_event->setType
+ (
+ $published_current && isset($metadata['pub_old']) && !$published_old ? 'INSERT' : $this->entity_event->getType()
+ );
+
+ $this->process_ctx->registerEntityEvent($this->entity_event);
+ $this->process_ctx->registerSummitEventOp($this->entity_event);
+ return;
+ }
+ // if does not exists on schedule delete it
+ $this->entity_event->setType('DELETE');
+ $chain = new SummitEventEntityEventDeleteType($this->entity_event, $this->process_ctx);
+ return $chain->process();
+ }
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/SummitEventEntityEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/SummitEventEntityEventType.php
new file mode 100644
index 00000000..8a223060
--- /dev/null
+++ b/app/Models/Foundation/Summit/EntityEvents/Types/SummitEventEntityEventType.php
@@ -0,0 +1,31 @@
+entity_event->getSummit()->getScheduleEvent($this->entity_event->getEntityId());
+ if(!is_null($entity))
+ $this->entity_event->registerEntity($entity);
+ return $entity;
+ }
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/SummitEventRelationEntityEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/SummitEventRelationEntityEventType.php
new file mode 100644
index 00000000..719cdeea
--- /dev/null
+++ b/app/Models/Foundation/Summit/EntityEvents/Types/SummitEventRelationEntityEventType.php
@@ -0,0 +1,51 @@
+entity_event->getMetadata();
+ if(!isset($metadata['event_id'])) return null;
+ $event = $this->entity_event->getSummit()->getScheduleEvent(intval($metadata['event_id']));
+ if (is_null($event)) return null;
+ $this->entity_event->setEntityClassName($event->getClassName());
+ $this->entity_event->registerEntity($event);
+ return $event;
+ }
+
+ /**
+ * @return void
+ */
+ public function process()
+ {
+ $entity = $this->registerEntity();
+ if(is_null($entity)) return;
+ $this->entity_event->setType('UPDATE');
+ if($this->process_ctx->existsUpdateOp($this->entity_event)) return;
+ $this->process_ctx->registerUpdateOp($this->entity_event);
+ $this->process_ctx->registerEntityEvent($this->entity_event);
+ }
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/SummitEventTypeEntityEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/SummitEventTypeEntityEventType.php
new file mode 100644
index 00000000..987a8600
--- /dev/null
+++ b/app/Models/Foundation/Summit/EntityEvents/Types/SummitEventTypeEntityEventType.php
@@ -0,0 +1,33 @@
+entity_event->getSummit()->getEventType($this->entity_event->getEntityId());
+ if(!is_null($entity))
+ $this->entity_event->registerEntity($entity);
+ return $entity;
+ }
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/SummitLocationEntityEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/SummitLocationEntityEventType.php
new file mode 100644
index 00000000..214526f1
--- /dev/null
+++ b/app/Models/Foundation/Summit/EntityEvents/Types/SummitLocationEntityEventType.php
@@ -0,0 +1,37 @@
+entity_event->getType();
+ // if there is an insert in place, skip it
+ if($type === 'UPDATE' && $this->process_ctx->existsInsertOp($this->entity_event)) return null;
+ $entity = $this->entity_event->getSummit()->getLocation($this->entity_event->getEntityId());
+ if(is_null($entity)) return null;
+ return $this->entity_event->registerEntity($entity);
+ }
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/SummitLocationImageEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/SummitLocationImageEventType.php
new file mode 100644
index 00000000..3da2fb69
--- /dev/null
+++ b/app/Models/Foundation/Summit/EntityEvents/Types/SummitLocationImageEventType.php
@@ -0,0 +1,37 @@
+entity_event->getMetadata();
+ if(!isset($metadata['location_id'])) return null;
+ $location = $this->entity_event->getSummit()->getLocation(intval($metadata['location_id']));
+ if(is_null($location)) return null;
+ $entity = $location->getImage($this->entity_event->getEntityId());
+ if(is_null($entity)) return null;
+ $this->entity_event->registerEntity($entity);
+ return $entity;
+ }
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/SummitTicketTypeEntityEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/SummitTicketTypeEntityEventType.php
new file mode 100644
index 00000000..3119c3f1
--- /dev/null
+++ b/app/Models/Foundation/Summit/EntityEvents/Types/SummitTicketTypeEntityEventType.php
@@ -0,0 +1,33 @@
+entity_event->getSummit()->getTicketType($this->entity_event->getEntityId());
+ if(!is_null($entity))
+ $this->entity_event->registerEntity($entity);
+ return $entity;
+ }
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/SummitTypeEntityEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/SummitTypeEntityEventType.php
new file mode 100644
index 00000000..907ae6a0
--- /dev/null
+++ b/app/Models/Foundation/Summit/EntityEvents/Types/SummitTypeEntityEventType.php
@@ -0,0 +1,34 @@
+entity_event->getSummit()->getSummitType($this->entity_event->getEntityId());
+ if(!is_null($entity))
+ $this->entity_event->registerEntity($entity);
+ return $entity;
+ }
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/SummitVenueFloorEntityEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/SummitVenueFloorEntityEventType.php
new file mode 100644
index 00000000..b0c34f2e
--- /dev/null
+++ b/app/Models/Foundation/Summit/EntityEvents/Types/SummitVenueFloorEntityEventType.php
@@ -0,0 +1,37 @@
+entity_event->getMetadata();
+ if(!isset($metadata['venue_id'])) return null;
+ $location = $this->entity_event->getSummit()->getLocation(intval($metadata['venue_id']));
+ if (is_null($location)) return null;
+ $floor = $location->getFloor($this->entity_event->getEntityId());
+ if(is_null($floor)) return null;
+ $this->entity_event->registerEntity($floor);
+ return $floor;
+ }
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/TrackFromTrackGroupEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/TrackFromTrackGroupEventType.php
new file mode 100644
index 00000000..876c4847
--- /dev/null
+++ b/app/Models/Foundation/Summit/EntityEvents/Types/TrackFromTrackGroupEventType.php
@@ -0,0 +1,49 @@
+entity_event->getMetadata();
+ if(!isset($metadata['group_id'])) return null;
+ $group = $this->entity_event->getSummit()->getCategoryGroup(intval($metadata['group_id']));
+ if (is_null($group)) return null;
+ $this->entity_event->registerEntity($group);
+ return $group;
+ }
+
+ /**
+ * @return void
+ */
+ public function process()
+ {
+ $entity = $this->registerEntity();
+ if(is_null($entity)) return;
+ $this->entity_event->setType('UPDATE');
+ $this->entity_event->setEntityClassName('PresentationCategoryGroup');
+ if($this->process_ctx->existsUpdateOp($this->entity_event)) return;
+ $this->process_ctx->registerUpdateOp($this->entity_event);
+ $this->process_ctx->registerEntityEvent($this->entity_event);
+ }
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/EntityEvents/Types/WipeDataEntityEventType.php b/app/Models/Foundation/Summit/EntityEvents/Types/WipeDataEntityEventType.php
new file mode 100644
index 00000000..42438cef
--- /dev/null
+++ b/app/Models/Foundation/Summit/EntityEvents/Types/WipeDataEntityEventType.php
@@ -0,0 +1,48 @@
+entity_event->getEntityId() > 0) {
+ $attendee_id = intval($this->entity_event->getEntityId());
+ $member_id = $this->process_ctx->getCurrentMemberId();
+ $attendee = $this->entity_event->getSummit()->getAttendeeByMemberId($member_id);
+ // if we are not the recipient or its already processed then continue
+ if(is_null($attendee) || $attendee->getId() != $attendee_id) return;
+ }
+ $this->entity_event->setType('TRUNCATE');
+ $this->process_ctx->registerEntityEvent($this->entity_event);
+ }
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/Events/Presentations/Materials/PresentationLink.php b/app/Models/Foundation/Summit/Events/Presentations/Materials/PresentationLink.php
new file mode 100644
index 00000000..bbefb953
--- /dev/null
+++ b/app/Models/Foundation/Summit/Events/Presentations/Materials/PresentationLink.php
@@ -0,0 +1,52 @@
+link;
+ }
+
+ /**
+ * @param string $link
+ */
+ public function setLink($link)
+ {
+ $this->link = $link;
+ }
+ /**
+ * @ORM\Column(name="Link", type="string")
+ * @var string
+ */
+ private $link;
+
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/Events/Presentations/Materials/PresentationMaterial.php b/app/Models/Foundation/Summit/Events/Presentations/Materials/PresentationMaterial.php
new file mode 100644
index 00000000..123e0bdf
--- /dev/null
+++ b/app/Models/Foundation/Summit/Events/Presentations/Materials/PresentationMaterial.php
@@ -0,0 +1,197 @@
+presentation;
+ }
+
+ /**
+ * @param Presentation $presentation
+ */
+ public function setPresentation(Presentation $presentation){
+ $this->presentation = $presentation;
+ }
+
+ /**
+ * @return int
+ */
+ public function getPresentationId(){
+ try {
+ return $this->presentation->getId();
+ }
+ catch (\Exception $ex){
+ return 0;
+ }
+ }
+
+ /**
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * @param string $name
+ */
+ public function setName($name)
+ {
+ $this->name = $name;
+ }
+
+ /**
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
+ /**
+ * @param string $description
+ */
+ public function setDescription($description)
+ {
+ $this->description = $description;
+ }
+
+ /**
+ * @return string
+ */
+ public function getDisplayOnSite()
+ {
+ return $this->display_on_site;
+ }
+
+ /**
+ * @param string $display_on_site
+ */
+ public function setDisplayOnSite($display_on_site)
+ {
+ $this->display_on_site = $display_on_site;
+ }
+
+ /**
+ * @return string
+ */
+ public function getFeatured()
+ {
+ return $this->featured;
+ }
+
+ /**
+ * @param string $featured
+ */
+ public function setFeatured($featured)
+ {
+ $this->featured = $featured;
+ }
+
+ /**
+ * @ORM\Column(name="Name", type="string")
+ * @var string
+ */
+ protected $name;
+
+ /**
+ * @ORM\Column(name="Description", type="string")
+ * @var string
+ */
+ protected $description;
+
+ /**
+ * @ORM\Column(name="DisplayOnSite", type="boolean")
+ * @var string
+ */
+ protected $display_on_site;
+
+ /**
+ * @ORM\Column(name="Order", type="integer")
+ * @var int
+ */
+ protected $order;
+
+ /**
+ * @return int
+ */
+ public function getOrder()
+ {
+ return $this->order;
+ }
+
+ /**
+ * @param int $order
+ */
+ public function setOrder($order)
+ {
+ $this->order = $order;
+ }
+
+ /**
+ * @ORM\Column(name="Featured", type="boolean")
+ * @var string
+ */
+ protected $featured;
+
+ public function __construct()
+ {
+ parent::__construct();
+ $this->featured = false;
+ $this->display_on_site = false;
+ $this->order = 0;
+ }
+
+ /**
+ * @ORM\PostPersist
+ */
+ public function inserted($args){
+ Event::fire(new PresentationMaterialCreated($this, $args));
+ }
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/Events/Presentations/Materials/PresentationSlide.php b/app/Models/Foundation/Summit/Events/Presentations/Materials/PresentationSlide.php
new file mode 100644
index 00000000..7cf992af
--- /dev/null
+++ b/app/Models/Foundation/Summit/Events/Presentations/Materials/PresentationSlide.php
@@ -0,0 +1,98 @@
+slide;
+ }
+
+ /**
+ * @param File $slide
+ */
+ public function setSlide($slide)
+ {
+ $this->slide = $slide;
+ }
+
+ /**
+ * @return string
+ */
+ public function getLink()
+ {
+ return $this->link;
+ }
+
+ /**
+ * @param string $link
+ */
+ public function setLink($link)
+ {
+ $this->link = $link;
+ }
+
+ /**
+ * @return bool
+ */
+ public function hasSlide(){
+ return $this->getSlideId() > 0;
+ }
+
+ /**
+ * @return int
+ */
+ public function getSlideId(){
+ try{
+ return !is_null($this->slide)?$this->slide->getId():0;
+ }
+ catch(\Exception $ex){
+ return 0;
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/Events/Presentations/Materials/PresentationVideo.php b/app/Models/Foundation/Summit/Events/Presentations/Materials/PresentationVideo.php
new file mode 100644
index 00000000..25c67a41
--- /dev/null
+++ b/app/Models/Foundation/Summit/Events/Presentations/Materials/PresentationVideo.php
@@ -0,0 +1,128 @@
+youtube_id;
+ }
+
+ /**
+ * @param string $youtube_id
+ */
+ public function setYoutubeId($youtube_id)
+ {
+ $this->youtube_id = $youtube_id;
+ }
+
+ /**
+ * @return \DateTime
+ */
+ public function getDateUploaded()
+ {
+ return $this->date_uploaded;
+ }
+
+ /**
+ * @param \DateTime $date_uploaded
+ */
+ public function setDateUploaded($date_uploaded)
+ {
+ $this->date_uploaded = $date_uploaded;
+ }
+
+ /**
+ * @return bool
+ */
+ public function getHighlighted()
+ {
+ return (bool)$this->highlighted;
+ }
+
+ /**
+ * @param bool $highlighted
+ */
+ public function setHighlighted($highlighted)
+ {
+ $this->highlighted = $highlighted;
+ }
+
+ /**
+ * @return int
+ */
+ public function getViews()
+ {
+ return $this->views;
+ }
+
+ /**
+ * @param int $views
+ */
+ public function setViews($views)
+ {
+ $this->views = $views;
+ }
+
+ /**
+ * @ORM\Column(name="DateUploaded", type="datetime")
+ * @var \DateTime
+ */
+ private $date_uploaded;
+
+ /**
+ * @ORM\Column(name="Highlighted", type="boolean")
+ * @var bool
+ */
+ private $highlighted;
+
+ /**
+ * @ORM\Column(name="Views", type="integer")
+ * @var int
+ */
+ private $views;
+
+ public function __construct()
+ {
+ parent::__construct();
+ $this->highlighted = false;
+ $this->views = 0;
+ $this->date_uploaded = new \DateTime();
+ }
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/Events/Presentations/Presentation.php b/app/Models/Foundation/Summit/Events/Presentations/Presentation.php
new file mode 100644
index 00000000..fd7ed240
--- /dev/null
+++ b/app/Models/Foundation/Summit/Events/Presentations/Presentation.php
@@ -0,0 +1,308 @@
+materials = new ArrayCollection();
+ $this->speakers = new ArrayCollection();
+ }
+
+ /**
+ * @return string
+ */
+ public function getLevel()
+ {
+ return $this->level;
+ }
+
+ /**
+ * @param string $level
+ */
+ public function setLevel($level)
+ {
+ $this->level = $level;
+ }
+
+ /**
+ * @return string
+ */
+ public function getProblemAddressed()
+ {
+ return $this->problem_addressed;
+ }
+
+ /**
+ * @param string $problem_addressed
+ */
+ public function setProblemAddressed($problem_addressed)
+ {
+ $this->problem_addressed = $problem_addressed;
+ }
+
+ /**
+ * @ORM\Column(name="Level", type="string")
+ * @var string
+ */
+ private $level;
+
+ /**
+ * @ORM\Column(name="ProblemAddressed", type="string")
+ * @var string
+ */
+ private $problem_addressed;
+
+ /**
+ * @ORM\Column(name="AttendeesExpectedLearnt", type="string")
+ * @var string
+ */
+ private $attendees_expected_learnt;
+
+ /**
+ * @return string
+ */
+ public function getAttendeesExpectedLearnt()
+ {
+ return $this->attendees_expected_learnt;
+ }
+
+ /**
+ * @param string $attendees_expected_learnt
+ */
+ public function setAttendeesExpectedLearnt($attendees_expected_learnt)
+ {
+ $this->attendees_expected_learnt = $attendees_expected_learnt;
+ }
+
+ /**
+ * @return string
+ */
+ public function getClassName(){
+ return "Presentation";
+ }
+
+ /**
+ * @return PresentationSpeaker[]
+ */
+ public function getSpeakers()
+ {
+ return $this->speakers;
+ }
+
+ /**
+ * @param PresentationSpeaker $speaker
+ */
+ public function addSpeaker(PresentationSpeaker $speaker){
+ $this->speakers->add($speaker);
+ $speaker->addPresentation($this);
+ }
+
+ public function clearSpeakers(){
+ $this->speakers->clear();
+ }
+
+ /**
+ * @return int[]
+ */
+ public function getSpeakerIds()
+ {
+ return $this->speakers->map(function($entity) {
+ return $entity->getId();
+ })->toArray();
+ }
+
+ /**
+ * @return PresentationVideo[]
+ */
+ public function getVideos()
+ {
+ return $this->materials->filter(function( $element) { return $element instanceof PresentationVideo; });
+ }
+
+ /**
+ * @param int $material_id
+ * @return PresentationMaterial|null
+ */
+ public function getMaterial($material_id){
+ $criteria = Criteria::create();
+ $criteria->where(Criteria::expr()->eq('id', intval($material_id)));
+ $material = $this->materials->matching($criteria)->first();
+ return $material === false ? null:$material;
+ }
+
+ /**
+ * @param PresentationVideo $video
+ * @return $this
+ */
+ public function addVideo(PresentationVideo $video){
+ $this->materials->add($video);
+ $video->setPresentation($this);
+ }
+
+ /**
+ * @return bool
+ */
+ public function hasVideos(){
+ return count($this->getVideos()) > 0;
+ }
+
+ /**
+ * @return PresentationSlide[]
+ */
+ public function getSlides()
+ {
+ return $this->materials->filter(function( $element) { return $element instanceof PresentationSlide; });
+ }
+
+ /**
+ * @param PresentationSlide $slide
+ * @return $this
+ */
+ public function addSlide(PresentationSlide $slide){
+ $this->materials->add($slide);
+ $slide->setPresentation($this);
+ }
+
+ /**
+ * @return bool
+ */
+ public function hasSlides(){
+ return count($this->getSlides()) > 0;
+ }
+
+ /**
+ * @return PresentationLink[]
+ */
+ public function getLinks(){
+ return $this->materials->filter(function($element) { return $element instanceof PresentationLink; });
+ }
+
+ /**
+ * @return bool
+ */
+ public function hasLinks(){
+ return count($this->getLinks()) > 0;
+ }
+
+ /**
+ * @param PresentationLink $link
+ * @return $this
+ */
+ public function addLink(PresentationLink $link){
+ $this->materials->add($link);
+ $link->setPresentation($this);
+ }
+
+ /**
+ * @return int
+ */
+ public function getCategoryId(){
+ try {
+ return !is_null($this->category)? $this->category->getId():0;
+ }
+ catch(\Exception $ex){
+ return 0;
+ }
+ }
+
+ /**
+ * @ORM\ManyToOne(targetEntity="PresentationCategory")
+ * @ORM\JoinColumn(name="CategoryID", referencedColumnName="ID")
+ * @var PresentationCategory
+ */
+ private $category = null;
+
+ /**
+ * @param PresentationCategory $category
+ * @return $this
+ */
+ public function setCategory(PresentationCategory $category)
+ {
+ $this->category = $category;
+ return $this;
+ }
+
+ /**
+ * @return PresentationCategory
+ */
+ public function getCategory(){
+ return $this->category;
+ }
+
+ /**
+ * @return int
+ */
+ public function getModeratorId(){
+ try {
+ return !is_null($this->moderator)? $this->moderator->getId():0;
+ }
+ catch(\Exception $ex){
+ return 0;
+ }
+ }
+
+ /**
+ * @ORM\ManyToOne(targetEntity="PresentationSpeaker")
+ * @ORM\JoinColumn(name="ModeratorID", referencedColumnName="ID")
+ * @var PresentationSpeaker
+ */
+ private $moderator;
+
+ /**
+ * @return PresentationSpeaker
+ */
+ public function getModerator()
+ {
+ return $this->moderator;
+ }
+
+ /**
+ * @param PresentationSpeaker $moderator
+ */
+ public function setModerator(PresentationSpeaker $moderator)
+ {
+ $this->moderator = $moderator;
+ }
+
+
+ public function unsetModerator(){
+ $this->moderator = nul;
+ }
+
+}
diff --git a/app/Models/Foundation/Summit/Events/Presentations/PresentationCategory.php b/app/Models/Foundation/Summit/Events/Presentations/PresentationCategory.php
new file mode 100644
index 00000000..81907177
--- /dev/null
+++ b/app/Models/Foundation/Summit/Events/Presentations/PresentationCategory.php
@@ -0,0 +1,132 @@
+description;
+ }
+
+ /**
+ * @param string $description
+ */
+ public function setDescription($description)
+ {
+ $this->description = $description;
+ }
+
+ /**
+ * @return string
+ */
+ public function getCode()
+ {
+ return $this->code;
+ }
+
+ /**
+ * @param string $code
+ */
+ public function setCode($code)
+ {
+ $this->code = $code;
+ }
+
+ /**
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->title;
+ }
+
+ /**
+ * @param string $title
+ */
+ public function setTitle($title)
+ {
+ $this->title = $title;
+ }
+
+ /**
+ * @ORM\ManyToOne(targetEntity="Summit", inversedBy="presentation_categories")
+ * @ORM\JoinColumn(name="SummitID", referencedColumnName="ID")
+ * @var Summit
+ */
+ protected $summit;
+
+ public function setSummit($summit){
+ $this->summit = $summit;
+ }
+
+ /**
+ * @return Summit
+ */
+ public function getSummit(){
+ return $this->summit;
+ }
+
+ /**
+ * @ORM\ManyToMany(targetEntity="models\summit\PresentationCategoryGroup", mappedBy="categories")
+ * @var PresentationCategoryGroup[]
+ */
+ private $groups;
+
+ public function __construct()
+ {
+ parent::__construct();
+ $this->groups = new ArrayCollection();
+ }
+
+ /**
+ * @return PresentationCategoryGroup[]
+ */
+ public function getGroups()
+ {
+ return $this->groups;
+ }
+
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/Events/Presentations/PresentationCategoryGroup.php b/app/Models/Foundation/Summit/Events/Presentations/PresentationCategoryGroup.php
new file mode 100644
index 00000000..cea2a58d
--- /dev/null
+++ b/app/Models/Foundation/Summit/Events/Presentations/PresentationCategoryGroup.php
@@ -0,0 +1,139 @@
+name;
+ }
+
+ /**
+ * @param mixed $name
+ */
+ public function setName($name)
+ {
+ $this->name = $name;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getColor()
+ {
+ return $this->color;
+ }
+
+ /**
+ * @param mixed $color
+ */
+ public function setColor($color)
+ {
+ $this->color = $color;
+ }
+
+ /**
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
+ /**
+ * @param string $description
+ */
+ public function setDescription($description)
+ {
+ $this->description = $description;
+ }
+
+ /**
+ * @ORM\ManyToOne(targetEntity="Summit", inversedBy="category_groups")
+ * @ORM\JoinColumn(name="SummitID", referencedColumnName="ID")
+ * @var Summit
+ */
+ protected $summit;
+
+ public function setSummit($summit){
+ $this->summit = $summit;
+ }
+
+ /**
+ * @return Summit
+ */
+ public function getSummit(){
+ return $this->summit;
+ }
+
+
+
+ public function __construct()
+ {
+ parent::__construct();
+ $this->categories = new ArrayCollection;
+ }
+
+ /**
+ * @ORM\ManyToMany(targetEntity="models\summit\PresentationCategory", inversedBy="groups")
+ * @ORM\JoinTable(name="PresentationCategoryGroup_Categories",
+ * joinColumns={@ORM\JoinColumn(name="PresentationCategoryGroupID", referencedColumnName="ID")},
+ * inverseJoinColumns={@ORM\JoinColumn(name="PresentationCategoryID", referencedColumnName="ID")}
+ * )
+ * @var PresentationCategory[]
+ */
+ private $categories;
+
+ /**
+ * @return PresentationCategory[]
+ */
+ public function getCategories()
+ {
+ return $this->categories;
+ }
+
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/Events/Presentations/PresentationSpeaker.php b/app/Models/Foundation/Summit/Events/Presentations/PresentationSpeaker.php
new file mode 100644
index 00000000..fcd8a328
--- /dev/null
+++ b/app/Models/Foundation/Summit/Events/Presentations/PresentationSpeaker.php
@@ -0,0 +1,270 @@
+first_name;
+ }
+
+ /**
+ * @param string $first_name
+ */
+ public function setFirstName($first_name)
+ {
+ $this->first_name = $first_name;
+ }
+
+ /**
+ * @return string
+ */
+ public function getLastName()
+ {
+ return $this->last_name;
+ }
+
+ /**
+ * @param string $last_name
+ */
+ public function setLastName($last_name)
+ {
+ $this->last_name = $last_name;
+ }
+
+ /**
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->title;
+ }
+
+ /**
+ * @param string $title
+ */
+ public function setTitle($title)
+ {
+ $this->title = $title;
+ }
+
+ /**
+ * @return string
+ */
+ public function getBio()
+ {
+ return $this->bio;
+ }
+
+ /**
+ * @param string $bio
+ */
+ public function setBio($bio)
+ {
+ $this->bio = $bio;
+ }
+
+ /**
+ * @return string
+ */
+ public function getIrcHandle()
+ {
+ return $this->irc_handle;
+ }
+
+ /**
+ * @param string $irc_handle
+ */
+ public function setIrcHandle($irc_handle)
+ {
+ $this->irc_handle = $irc_handle;
+ }
+
+ /**
+ * @return string
+ */
+ public function getTwitterName()
+ {
+ return $this->twitter_name;
+ }
+
+ /**
+ * @param string $twitter_name
+ */
+ public function setTwitterName($twitter_name)
+ {
+ $this->twitter_name = $twitter_name;
+ }
+
+ /**
+ * @ORM\Column(name="LastName", type="string")
+ */
+ private $last_name;
+
+ /**
+ * @ORM\Column(name="Title", type="string")
+ */
+ private $title;
+
+ /**
+ * @ORM\Column(name="Bio", type="string")
+ */
+ private $bio;
+
+ /**
+ * @ORM\Column(name="IRCHandle", type="string")
+ */
+ private $irc_handle;
+
+ /**
+ * @ORM\Column(name="TwitterName", type="string")
+ */
+ private $twitter_name;
+
+ /**
+ * @ORM\ManyToMany(targetEntity="models\summit\Presentation", inversedBy="speakers")
+ * @ORM\JoinTable(name="Presentation_Speakers",
+ * joinColumns={
+ * @ORM\JoinColumn(name="PresentationSpeakerID", referencedColumnName="ID")
+ * },
+ * inverseJoinColumns={
+ * @ORM\JoinColumn(name="PresentationID", referencedColumnName="ID")
+ * }
+ * )
+ */
+ private $presentations;
+
+ public function __construct()
+ {
+ parent::__construct();
+ $this->presentations = new ArrayCollection;
+ }
+
+ /**
+ * @param Presentation $presentation
+ */
+ public function addPresentation(Presentation $presentation){
+ $this->presentations->add($presentation);
+ }
+
+ /**
+ * @param null|int $summit_id
+ * @param bool|true $published_ones
+ * @return Presentation[]
+ */
+ public function presentations($summit_id, $published_ones = true)
+ {
+
+ return $this->presentations
+ ->filter(function($p) use($published_ones, $summit_id){
+ $res = $published_ones? $p->isPublished(): true;
+ $res &= is_null($summit_id)? true : $p->getSummit()->getId() == $summit_id;
+ return $res;
+ });
+ }
+
+ /**
+ * @param int $presentation_id
+ * @return Presentation
+ */
+ public function getPresentation($presentation_id)
+ {
+ return $this->presentations->get($presentation_id);
+ }
+ /**
+ * @param null $summit_id
+ * @param bool|true $published_ones
+ * @return array
+ */
+ public function getPresentationIds($summit_id, $published_ones = true)
+ {
+ return $this->presentations($summit_id, $published_ones)->map(function($entity) {
+ return $entity->getId();
+ })->toArray();
+ }
+
+
+ /**
+ * @ORM\ManyToOne(targetEntity="models\main\File")
+ * @ORM\JoinColumn(name="PhotoID", referencedColumnName="ID")
+ * @var File
+ */
+ protected $photo;
+
+ /**
+ * @return File
+ */
+ public function getPhoto()
+ {
+ return $this->photo;
+ }
+
+ /**
+ * @ORM\ManyToOne(targetEntity="models\main\Member")
+ * @ORM\JoinColumn(name="MemberID", referencedColumnName="ID")
+ * @var Image
+ */
+ private $member;
+
+ /**
+ * @return Member
+ */
+ public function getMember()
+ {
+ return $this->member;
+ }
+
+ /**
+ * @return bool
+ */
+ public function hasMember(){
+ return $this->getMemberId() > 0;
+ }
+
+ /**
+ * @return int
+ */
+ public function getMemberId()
+ {
+ try{
+ return $this->member->getId();
+ }
+ catch(\Exception $ex){
+ return 0;
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/Events/SummitEntityEvent.php b/app/Models/Foundation/Summit/Events/SummitEntityEvent.php
new file mode 100644
index 00000000..bea99939
--- /dev/null
+++ b/app/Models/Foundation/Summit/Events/SummitEntityEvent.php
@@ -0,0 +1,165 @@
+entity_id = $entity_id;
+ }
+
+ /**
+ * @return int
+ */
+ public function getEntityId(){return $this->entity_id;}
+
+ /**
+ * @ORM\Column(name="EntityClassName", type="string")
+ */
+ private $entity_class_name;
+
+ /**
+ * @return string
+ */
+ public function getEntityClassName(){return $this->entity_class_name;}
+
+ /**
+ * @param string $entity_class_name
+ */
+ public function setEntityClassName($entity_class_name){$this->entity_class_name = $entity_class_name;}
+
+ /**
+ * @ORM\Column(name="Type", type="string")
+ */
+ private $type;
+
+ /**
+ * @return string
+ */
+ public function getType(){return $this->type;}
+
+ /**
+ * @param string $type
+ */
+ public function setType($type){$this->type = $type;}
+
+ /**
+ * @ORM\Column(name="Metadata", type="string")
+ */
+ private $metadata;
+
+ /**
+ * @param string $metadata
+ */
+ public function setMetadata($metadata){
+ $this->metadata = $metadata;
+ }
+
+ /**
+ * @return array
+ */
+ public function getMetadata(){
+ return !empty($this->metadata) ? json_decode($this->metadata, true) : array();
+ }
+
+ /**
+ * @ORM\ManyToOne(targetEntity="models\main\Member", cascade={"persist"})
+ * @ORM\JoinColumn(name="OwnerID", referencedColumnName="ID")
+ * @var Member
+ */
+ private $owner;
+
+ /**
+ * @return int
+ */
+ public function getOwnerId(){
+ try{
+ return $this->owner->getId();
+ }
+ catch(\Exception $ex){
+ return 0;
+ }
+ }
+
+ /**
+ * @return bool
+ */
+ public function hasOwner(){
+ return $this->getOwnerId() > 0;
+ }
+
+ /**
+ * @return Member
+ */
+ public function getOwner(){
+ return $this->owner;
+ }
+
+ /**
+ * @param Member $owner
+ */
+ public function setOwner(Member $owner){
+ $this->owner = $owner;
+ }
+
+ /**
+ * @return string
+ */
+ public function getKey(){
+ return sprintf("%s.%s", $this->entity_class_name, $this->entity_id);
+ }
+
+ /**
+ * @var IEntity
+ */
+ private $entity;
+
+ /**
+ * @return IEntity
+ */
+ public function getEntity(){
+ return $this->entity;
+ }
+
+ /**
+ * @param IEntity $entity
+ * @return IEntity
+ */
+ public function registerEntity(IEntity $entity){
+ $this->entity = $entity;
+ return $this->entity;
+ }
+
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/Events/SummitEvent.php b/app/Models/Foundation/Summit/Events/SummitEvent.php
new file mode 100644
index 00000000..fb72467e
--- /dev/null
+++ b/app/Models/Foundation/Summit/Events/SummitEvent.php
@@ -0,0 +1,722 @@
+title;
+ }
+
+ /**
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
+ /**
+ * @return boolean
+ */
+ public function isAllowFeedback()
+ {
+ return $this->getAllowFeedback();
+ }
+
+ /**
+ * @return boolean
+ */
+ public function getAllowFeedback()
+ {
+ return $this->allow_feedback;
+ }
+
+ use SummitOwned;
+
+ /**
+ * SummitEvent constructor.
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->allow_feedback = false;
+ $this->published = false;
+ $this->avg_feedback = 0;
+ $this->head_count = 0;
+ $this->tags = new ArrayCollection();
+ $this->summit_types = new ArrayCollection();
+ $this->feedback = new ArrayCollection();
+ $this->attendees = new ArrayCollection();
+ $this->sponsors = new ArrayCollection();
+ }
+
+ /**
+ * @ORM\Column(name="Title", type="string")
+ * @var string
+ */
+ protected $title;
+
+ /**
+ * @param string $title
+ * @return $this
+ */
+ public function setTitle($title)
+ {
+ $this->title = $title;
+ return $this;
+ }
+
+ /**
+ * @return string
+ */
+ public function getClassName(){
+ return "SummitEvent";
+ }
+
+ /**
+ * @ORM\Column(name="Description", type="string")
+ * @var string
+ */
+ protected $description;
+
+ /**
+ * @ORM\Column(name="ShortDescription", type="string")
+ * @var string
+ */
+ protected $short_description;
+
+ /**
+ * @param string $description
+ * @return $this
+ */
+ public function setDescription($description)
+ {
+ $this->description = $description;
+ return $this;
+ }
+
+ /**
+ * @ORM\Column(name="StartDate", type="datetime")
+ * @var \DateTime
+ */
+ protected $start_date;
+
+ /**
+ * @ORM\Column(name="RSVPTemplateID", type="integer")
+ * @var int
+ */
+ protected $rsvp_template_id;
+
+ /**
+ * @return string
+ */
+ public function getShortDescription()
+ {
+ return $this->short_description;
+ }
+
+ /**
+ * @param string $short_description
+ */
+ public function setShortDescription($short_description)
+ {
+ $this->short_description = $short_description;
+ }
+
+ /**
+ * @return DateTime
+ */
+ public function getPublishedDate()
+ {
+ return $this->published_date;
+ }
+
+ /**
+ * @param DateTime $published_date
+ */
+ public function setPublishedDate($published_date)
+ {
+ $this->published_date = $published_date;
+ }
+
+ /**
+ * @return float
+ */
+ public function getAvgFeedbackRate()
+ {
+ return $this->avg_feedback;
+ }
+
+ /**
+ * @param float $avg_feedback
+ */
+ public function setAvgFeedbackRate($avg_feedback)
+ {
+ $this->avg_feedback = $avg_feedback;
+ }
+
+ /**
+ * @return string
+ */
+ public function getRsvpLink()
+ {
+ if($this->rsvp_template_id > 0){
+ $summit = $this->getSummit();
+ $main_page = $summit->getMainPage();
+ $schedule_page = $summit->getSchedulePage();
+ return sprintf("%ssummit/%s/%s/events/%s/%s/rsvp",
+ Config::get("server.assets_base_url", 'https://www.openstack.org/'),
+ $main_page,
+ $schedule_page,
+ $this->getId(),
+ $this->getSlug()
+ );
+ }
+ return $this->rsvp_link;
+ }
+
+ public function getSlug(){
+ $slugify = new Slugify();
+ return $slugify->slugify($this->title);
+ }
+
+ /**
+ * @param string $rsvp_link
+ */
+ public function setRsvpLink($rsvp_link)
+ {
+ $this->rsvp_link = $rsvp_link;
+ }
+
+ /**
+ * @return int
+ */
+ public function getHeadCount()
+ {
+ return $this->head_count;
+ }
+
+ /**
+ * @param int $head_count
+ */
+ public function setHeadCount($head_count)
+ {
+ $this->head_count = $head_count;
+ }
+
+ /**
+ * @ORM\Column(name="EndDate", type="datetime")
+ * @var \DateTime
+ */
+ protected $end_date;
+
+ /**
+ * @ORM\Column(name="Published", type="boolean")
+ * @var bool
+ */
+ protected $published;
+
+ /**
+ * @ORM\Column(name="PublishedDate", type="datetime")
+ * @var \DateTime
+ */
+ protected $published_date;
+
+ /**
+ * @ORM\Column(name="AllowFeedBack", type="boolean")
+ * @var bool
+ */
+ protected $allow_feedback;
+
+ /**
+ * @ORM\Column(name="AvgFeedbackRate", type="float")
+ * @var float
+ */
+ protected $avg_feedback;
+
+ /**
+ * @ORM\Column(name="RSVPLink", type="string")
+ * @var string
+ */
+ protected $rsvp_link;
+
+
+ /**
+ * @ORM\Column(name="HeadCount", type="integer")
+ * @var int
+ */
+ protected $head_count;
+
+
+ /**
+ * @return bool
+ */
+ public function hasLocation(){
+ return $this->getLocationId() > 0;
+ }
+
+ /**
+ * @return int
+ */
+ public function getLocationId()
+ {
+ try {
+ return !is_null($this->location)? $this->location->getId():0;
+ }
+ catch(\Exception $ex){
+ return 0;
+ }
+ }
+
+ /**
+ * @param DateTime $value
+ * @return $this
+ */
+ public function setStartDate(DateTime $value)
+ {
+ $summit = $this->getSummit();
+ if(!is_null($summit))
+ {
+ $value = $summit->convertDateFromTimeZone2UTC($value);
+ }
+ $this->start_date = $value;
+ return $this;
+ }
+
+ /**
+ * @return DateTime|null
+ */
+ public function getLocalStartDate()
+ {
+ $value = $this->start_date;
+ if(!empty($value)) {
+ $summit = $this->getSummit();
+ if(!is_null($summit))
+ {
+ $res = $summit->convertDateFromUTC2TimeZone($value);
+ }
+ return $res;
+ }
+ return null;
+ }
+
+ /**
+ * @return \DateTime|null
+ */
+ public function getStartDate()
+ {
+ return $this->start_date;
+ }
+
+ /**
+ * @param DateTime $value
+ * @return $this
+ */
+ public function setEndDate(DateTime $value)
+ {
+ $summit = $this->getSummit();
+ if(!is_null($summit))
+ {
+ $value = $summit->convertDateFromTimeZone2UTC($value);
+ }
+ $this->end_date = $value;
+ return $this;
+ }
+
+ /**
+ * @return DateTime|null
+ */
+ public function getLocalEndDate()
+ {
+ $value = $this->end_date;
+ if(!empty($value)) {
+ $summit = $this->getSummit();
+ if(!is_null($summit))
+ {
+ $res = $summit->convertDateFromUTC2TimeZone($value);
+ }
+ return $res;
+ }
+ return null;
+ }
+
+ /**
+ * @return \DateTime|null
+ */
+ public function getEndDate()
+ {
+ return $this->end_date;
+ }
+
+ /**
+ * @param bool $allow_feeback
+ * @return $this
+ */
+ public function setAllowFeedBack($allow_feeback)
+ {
+ $this->allow_feedback = $allow_feeback;
+ return $this;
+ }
+
+ /**
+ * @return int
+ */
+ public function getTypeId()
+ {
+ try {
+ return $this->type->getId();
+ }
+ catch(\Exception $ex){
+ return 0;
+ }
+ }
+
+ /**
+ * @ORM\ManyToOne(targetEntity="SummitEventType")
+ * @ORM\JoinColumn(name="TypeID", referencedColumnName="ID")
+ * @var SummitEventType
+ */
+ private $type;
+
+ /**
+ * @param SummitEventType $type
+ * @return $this
+ */
+ public function setType(SummitEventType $type)
+ {
+ $this->type = $type;
+ return $this;
+ }
+
+ /**
+ * @return SummitEventType
+ */
+ public function getType(){
+ return $this->type;
+ }
+
+ /**
+ * @ORM\ManyToOne(targetEntity="SummitAbstractLocation")
+ * @ORM\JoinColumn(name="LocationID", referencedColumnName="ID")
+ */
+ private $location = null;
+
+ /**
+ * @param SummitAbstractLocation $location
+ * @return $this
+ */
+ public function setLocation(SummitAbstractLocation $location)
+ {
+ $this->location = $location;
+ return $this;
+ }
+
+ /**
+ * @return SummitAbstractLocation
+ */
+ public function getLocation()
+ {
+ return $this->location;
+ }
+
+ /**
+ * @return array
+ */
+ public function getSummitTypesIds()
+ {
+ return $this->summit_types->map(function($entity) {
+ return $entity->getId();
+ })->toArray();
+ }
+
+ /**
+ * @return array
+ */
+ public function getSponsorsIds()
+ {
+ return $this->sponsors->map(function($entity) {
+ return $entity->getId();
+ })->toArray();
+ }
+
+ /**
+ * @ORM\ManyToMany(targetEntity="models\summit\SummitType")
+ * @ORM\JoinTable(name="SummitEvent_AllowedSummitTypes",
+ * joinColumns={@ORM\JoinColumn(name="SummitEventID", referencedColumnName="ID")},
+ * inverseJoinColumns={@ORM\JoinColumn(name="SummitTypeID", referencedColumnName="ID")}
+ * )
+ */
+ protected $summit_types;
+
+ /**
+ * @return ArrayCollection
+ */
+ public function getSummitTypes(){
+ return $this->summit_types;
+ }
+
+ /**
+ * @param SummitType $summit_type
+ */
+ public function addSummitType(SummitType $summit_type)
+ {
+ $this->summit_types->add($summit_type);
+ }
+
+ public function clearSummitTypes()
+ {
+ $this->summit_types->clear();
+ }
+
+ /**
+ * @ORM\ManyToMany(targetEntity="models\main\Company", inversedBy="sponsorships")
+ * @ORM\JoinTable(name="SummitEvent_Sponsors",
+ * joinColumns={@ORM\JoinColumn(name="SummitEventID", referencedColumnName="ID")},
+ * inverseJoinColumns={@ORM\JoinColumn(name="CompanyID", referencedColumnName="ID")}
+ * )
+ */
+ protected $sponsors;
+
+ /**
+ * @return Company[]
+ */
+ public function getSponsors()
+ {
+ return $this->sponsors;
+ }
+
+ /**
+ * @ORM\ManyToMany(targetEntity="models\summit\SummitAttendee")
+ * @ORM\JoinTable(name="SummitAttendee_Schedule",
+ * joinColumns={@ORM\JoinColumn(name="SummitEventID", referencedColumnName="ID")},
+ * inverseJoinColumns={@ORM\JoinColumn(name="SummitAttendeeID", referencedColumnName="ID")}
+ * )
+ */
+ protected $attendees;
+
+ /**
+ * @return SummitAttendee[]
+ */
+ public function getAttendees()
+ {
+ $criteria = Criteria::create();
+ $criteria->where(Criteria::expr()->eq('IsCheckedIn', 1));
+ return $this->attendees->matching($criteria);
+ }
+
+ /**
+ * @ORM\OneToMany(targetEntity="models\summit\SummitEventFeedback", mappedBy="event", cascade={"persist"})
+ * @var SummitEventFeedback[]
+ */
+ protected $feedback;
+
+ public function addFeedBack(SummitEventFeedback $feedback)
+ {
+ $this->feedback->add($feedback);
+ $feedback->setEvent($this);
+ }
+
+ /**
+ * @return SummitEventFeedback[]
+ */
+ public function getFeedback(){
+ $criteria = Criteria::create();
+ $criteria = $criteria->orderBy(['created' => Criteria::DESC]);
+ return $this->feedback->matching($criteria);
+ }
+
+ /**
+ * @ORM\ManyToMany(targetEntity="models\main\Tag", cascade={"persist"})
+ * @ORM\JoinTable(name="SummitEvent_Tags",
+ * joinColumns={@ORM\JoinColumn(name="SummitEventID", referencedColumnName="ID")},
+ * inverseJoinColumns={@ORM\JoinColumn(name="TagID", referencedColumnName="ID")}
+ * )
+ */
+ protected $tags;
+
+ /**
+ * @return ArrayCollection
+ */
+ public function getTags(){
+ return $this->tags;
+ }
+
+ /**
+ * @param string $tag
+ */
+ public function addTag($tag)
+ {
+ $this->tags->add(new Tag($tag));
+ }
+
+ public function clearTags()
+ {
+ $this->tags->clear();
+ }
+
+ /**
+ * @throws EntityValidationException
+ * @throws ValidationException
+ * @return void
+ */
+ public function publish()
+ {
+ if($this->isPublished())
+ throw new ValidationException('Already published Summit Event');
+
+ if($this->getSummitTypes()->count() === 0)
+ throw new EntityValidationException('To publish this event you must associate a valid summit type!');
+
+ $start_date = $this->getStartDate();
+ $end_date = $this->getEndDate();
+
+ if((is_null($start_date) || is_null($end_date)))
+ throw new ValidationException('To publish this event you must define a start/end datetime!');
+
+ $summit = $this->getSummit();
+
+ if(is_null($summit))
+ throw new ValidationException('To publish you must assign a summit');
+
+ $timezone = $summit->getTimeZoneId();
+
+ if(empty($timezone)){
+ throw new ValidationException('Invalid Summit TimeZone!');
+ }
+
+ if($end_date < $start_date)
+ throw new ValidationException('start datetime must be greather or equal than end datetime!');
+
+ if(!$summit->isEventInsideSummitDuration($this))
+ throw new ValidationException
+ (
+ sprintf
+ (
+ 'start/end datetime must be between summit start/end datetime! (%s - %s)',
+ $summit->getLocalBeginDate(),
+ $summit->getLocalEndDate()
+ )
+ );
+
+ $this->published = true;
+ $this->published_date = new DateTime();
+ }
+
+ /**
+ * @return bool
+ */
+ public function isPublished()
+ {
+ return $this->getPublished();
+ }
+
+ /**
+ * @return bool
+ */
+ public function getPublished()
+ {
+ return (bool)$this->published;
+ }
+
+ /**
+ * @return void
+ */
+ public function unPublish()
+ {
+ $this->published = false;
+ $this->published_date = null;
+ }
+
+ // events
+
+ /**
+ * @var PreRemoveEventArgs
+ */
+ private $pre_remove_events;
+ /**
+ * @ORM\PreRemove:
+ */
+ public function deleting($args){
+ $this->pre_remove_events = new PreRemoveEventArgs(['id' => $this->id, 'class_name' => $this->getClassName(), 'summit' => $this->summit ]);
+ }
+
+ /**
+ * @ORM\PostRemove:
+ */
+ public function deleted($args){
+ Event::fire(new SummitEventDeleted($this, $this->pre_remove_events ));
+ $this->pre_remove_events = null;
+ }
+
+ /**
+ * @var PreUpdateEventArgs
+ */
+ private $pre_update_args;
+
+ /**
+ * @ORM\PreUpdate:
+ */
+ public function updating(PreUpdateEventArgs $args){
+ $this->pre_update_args = $args;
+ }
+
+
+ /**
+ * @ORM\PostUpdate:
+ */
+ public function updated($args)
+ {
+ Event::fire(new SummitEventUpdated($this, $this->pre_update_args));
+ $this->pre_update_args = null;
+ }
+
+ /**
+ * @ORM\PostPersist
+ */
+ public function inserted($args){
+ Event::fire(new SummitEventCreated($this, $args));
+ }
+
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/Events/SummitEventFeedback.php b/app/Models/Foundation/Summit/Events/SummitEventFeedback.php
new file mode 100644
index 00000000..5841172f
--- /dev/null
+++ b/app/Models/Foundation/Summit/Events/SummitEventFeedback.php
@@ -0,0 +1,148 @@
+rate;
+ }
+
+ /**
+ * @param int $rate
+ */
+ public function setRate($rate)
+ {
+ $this->rate = $rate;
+ }
+
+ /**
+ * @return string
+ */
+ public function getNote()
+ {
+ return $this->note;
+ }
+
+ /**
+ * @param string $note
+ */
+ public function setNote($note)
+ {
+ $this->note = $note;
+ }
+
+ /**
+ * @ORM\Column(name="note", type="string")
+ * @var string
+ */
+ private $note;
+
+ /**
+ * @ORM\ManyToOne(targetEntity="models\main\Member", inversedBy="feedback")
+ * @ORM\JoinColumn(name="OwnerID", referencedColumnName="ID")
+ * @var Member
+ */
+ private $owner;
+
+ /**
+ * @return Member
+ */
+ public function getOwner()
+ {
+ return $this->owner;
+ }
+
+ /**
+ * @param Member $owner
+ */
+ public function setOwner(Member $owner){
+ $this->owner = $owner;
+ }
+
+ /**
+ * @ORM\ManyToOne(targetEntity="models\summit\SummitEvent", inversedBy="feedback", fetch="LAZY")
+ * @ORM\JoinColumn(name="EventID", referencedColumnName="ID")
+ * @var SummitEvent
+ */
+ private $event;
+
+ /**
+ * @return SummitEvent
+ */
+ public function getEvent()
+ {
+ return $this->event;
+ }
+
+ /**
+ * @return int
+ */
+ public function getEventId(){
+ try{
+ return $this->event->getId();
+ }
+ catch(\Exception $ex){
+ return 0;
+ }
+ }
+
+ /**
+ * @return bool
+ */
+ public function hasOwner(){
+ return $this->getOwnerId() > 0;
+ }
+
+ /**
+ * @return int
+ */
+ public function getOwnerId(){
+ try{
+ return $this->owner->getId();
+ }
+ catch(\Exception $ex){
+ return 0;
+ }
+ }
+
+ /**
+ * @param SummitEvent $event
+ */
+ public function setEvent(SummitEvent $event){
+ $this->event = $event;
+ }
+
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/Events/SummitEventType.php b/app/Models/Foundation/Summit/Events/SummitEventType.php
new file mode 100644
index 00000000..22a73d14
--- /dev/null
+++ b/app/Models/Foundation/Summit/Events/SummitEventType.php
@@ -0,0 +1,121 @@
+class_name === 'PresentationType';
+ }
+
+ /**
+ * @return bool
+ */
+ public function allowsModerator(){
+ return $this->isPresentationType() && in_array($this->type, ['Panel','Keynotes']);
+ }
+
+ /**
+ * @ORM\Column(name="BlackoutTimes", type="boolean")
+ * @var bool
+ */
+ private $blackout_times;
+
+ /**
+ * @return string
+ */
+ public function getType()
+ {
+ return $this->type;
+ }
+
+ /**
+ * @param string $type
+ */
+ public function setType($type)
+ {
+ $this->type = $type;
+ }
+
+ /**
+ * @return string
+ */
+ public function getColor()
+ {
+ return $this->color;
+ }
+
+ /**
+ * @param string $color
+ */
+ public function setColor($color)
+ {
+ $this->color = $color;
+ }
+
+ /**
+ * @return bool
+ */
+ public function getBlackoutTimes()
+ {
+ return $this->blackout_times;
+ }
+
+ /**
+ * @return bool
+ */
+ public function isBlackoutTimes(){
+ return $this->getBlackoutTimes();
+ }
+
+ /**
+ * @param bool $blackout_times
+ */
+ public function setBlackoutTimes($blackout_times)
+ {
+ $this->blackout_times = $blackout_times;
+ }
+
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/Factories/IPresentationVideoFactory.php b/app/Models/Foundation/Summit/Factories/IPresentationVideoFactory.php
new file mode 100644
index 00000000..3c83e04d
--- /dev/null
+++ b/app/Models/Foundation/Summit/Factories/IPresentationVideoFactory.php
@@ -0,0 +1,26 @@
+Type === 'Presentation' ? new Presentation: new SummitEvent;
+ $event = in_array($type->getType(),[ 'Presentation', 'Keynotes' , 'Panel']) ? new Presentation: new SummitEvent;
return $event;
}
}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/Locations/SummitAbstractLocation.php b/app/Models/Foundation/Summit/Locations/SummitAbstractLocation.php
new file mode 100644
index 00000000..b591c6b3
--- /dev/null
+++ b/app/Models/Foundation/Summit/Locations/SummitAbstractLocation.php
@@ -0,0 +1,136 @@
+type = self::TypeNone;
+ }
+
+ /**
+ * @return string
+ */
+ public function getClassName(){
+ return 'SummitAbstractLocation';
+ }
+
+ /**
+ * @return int
+ */
+ public function getOrder()
+ {
+ return $this->order;
+ }
+
+ /**
+ * @param int $order
+ */
+ public function setOrder($order)
+ {
+ $this->order = $order;
+ }
+
+ /**
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
+ /**
+ * @param string $description
+ */
+ public function setDescription($description)
+ {
+ $this->description = $description;
+ }
+
+ /**
+ * @return string
+ */
+ public function getLocationType()
+ {
+ return $this->type;
+ }
+
+ /**
+ * @param string $type
+ */
+ public function setLocationType($type)
+ {
+ $this->type = $type;
+ }
+
+ /**
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * @param string $name
+ */
+ public function setName($name)
+ {
+ $this->name = $name;
+ }
+
+ use SummitOwned;
+
+
+ /**
+ * @ORM\Column(name="Name", type="string")
+ */
+ protected $name;
+
+ /**
+ * @ORM\Column(name="Description", type="string")
+ */
+ protected $description;
+
+
+ /**
+ * @ORM\Column(name="LocationType", type="string")
+ */
+ protected $type;
+
+ /**
+ * @ORM\Column(name="Order", type="integer")
+ */
+ protected $order;
+
+
+}
\ No newline at end of file
diff --git a/app/Repositories/summit/EloquentSummitRepository.php b/app/Models/Foundation/Summit/Locations/SummitAirport.php
similarity index 50%
rename from app/Repositories/summit/EloquentSummitRepository.php
rename to app/Models/Foundation/Summit/Locations/SummitAirport.php
index 71618583..5508d267 100644
--- a/app/Repositories/summit/EloquentSummitRepository.php
+++ b/app/Models/Foundation/Summit/Locations/SummitAirport.php
@@ -1,5 +1,4 @@
-entity = $summit;
+ public function getClassName(){
+ return 'SummitAirport';
}
/**
- * @return Summit
+ * @return string
*/
- public function getCurrent()
+ public function getAirportType()
{
- //$now = new \DateTime('now', new DateTimeZone('UTC'));
- return $this->entity
- ->where('Active','=',1)
- ->first();
+ return $this->airport_type;
}
+
+ /**
+ * @param string $airport_type
+ */
+ public function setAirportType($airport_type)
+ {
+ $this->airport_type = $airport_type;
+ }
+
+ /**
+ * @ORM\Column(name="Type", type="string")
+ */
+ private $airport_type;
}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/Locations/SummitExternalLocation.php b/app/Models/Foundation/Summit/Locations/SummitExternalLocation.php
new file mode 100644
index 00000000..7f33007c
--- /dev/null
+++ b/app/Models/Foundation/Summit/Locations/SummitExternalLocation.php
@@ -0,0 +1,57 @@
+capacity;
+ }
+
+ /**
+ * @param int $capacity
+ */
+ public function setCapacity($capacity)
+ {
+ $this->capacity = $capacity;
+ }
+
+ /**
+ * @ORM\Column(name="Capacity", type="integer")
+ */
+ protected $capacity;
+
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/Locations/SummitGeoLocatedLocation.php b/app/Models/Foundation/Summit/Locations/SummitGeoLocatedLocation.php
new file mode 100644
index 00000000..b1c7dbae
--- /dev/null
+++ b/app/Models/Foundation/Summit/Locations/SummitGeoLocatedLocation.php
@@ -0,0 +1,341 @@
+address1;
+ }
+
+ /**
+ * @param mixed $address1
+ */
+ public function setAddress1($address1)
+ {
+ $this->address1 = $address1;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getAddress2()
+ {
+ return $this->address2;
+ }
+
+ /**
+ * @param mixed $address2
+ */
+ public function setAddress2($address2)
+ {
+ $this->address2 = $address2;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getZipCode()
+ {
+ return $this->zip_code;
+ }
+
+ /**
+ * @param mixed $zip_code
+ */
+ public function setZipCode($zip_code)
+ {
+ $this->zip_code = $zip_code;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getCity()
+ {
+ return $this->city;
+ }
+
+ /**
+ * @param mixed $city
+ */
+ public function setCity($city)
+ {
+ $this->city = $city;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getState()
+ {
+ return $this->state;
+ }
+
+ /**
+ * @param mixed $state
+ */
+ public function setState($state)
+ {
+ $this->state = $state;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getCountry()
+ {
+ return $this->country;
+ }
+
+ /**
+ * @param mixed $country
+ */
+ public function setCountry($country)
+ {
+ $this->country = $country;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getWebsiteUrl()
+ {
+ return $this->website_url;
+ }
+
+ /**
+ * @param mixed $website_url
+ */
+ public function setWebsiteUrl($website_url)
+ {
+ $this->website_url = $website_url;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getLng()
+ {
+ return $this->lng;
+ }
+
+ /**
+ * @param mixed $lng
+ */
+ public function setLng($lng)
+ {
+ $this->lng = $lng;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getLat()
+ {
+ return $this->lat;
+ }
+
+ /**
+ * @param mixed $lat
+ */
+ public function setLat($lat)
+ {
+ $this->lat = $lat;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getDisplayOnSite()
+ {
+ return $this->display_on_site;
+ }
+
+ /**
+ * @param mixed $display_on_site
+ */
+ public function setDisplayOnSite($display_on_site)
+ {
+ $this->display_on_site = $display_on_site;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getDetailsPage()
+ {
+ return $this->details_page;
+ }
+
+ /**
+ * @param mixed $details_page
+ */
+ public function setDetailsPage($details_page)
+ {
+ $this->details_page = $details_page;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getLocationMessage()
+ {
+ return $this->location_message;
+ }
+
+ /**
+ * @param mixed $location_message
+ */
+ public function setLocationMessage($location_message)
+ {
+ $this->location_message = $location_message;
+ }
+
+ /**
+ * @ORM\Column(name="Address2", type="string")
+ */
+ protected $address2;
+
+ /**
+ * @ORM\Column(name="ZipCode", type="string")
+ */
+ protected $zip_code;
+
+ /**
+ * @ORM\Column(name="City", type="string")
+ */
+ protected $city;
+
+ /**
+ * @ORM\Column(name="State", type="string")
+ */
+ protected $state;
+
+ /**
+ * @ORM\Column(name="Country", type="string")
+ */
+ protected $country;
+
+ /**
+ * @ORM\Column(name="WebSiteUrl", type="string")
+ */
+ protected $website_url;
+
+ /**
+ * @ORM\Column(name="Lng", type="string")
+ */
+ protected $lng;
+
+ /**
+ * @ORM\Column(name="Lat", type="string")
+ */
+ protected $lat;
+
+ /**
+ * @ORM\Column(name="DisplayOnSite", type="boolean")
+ */
+ protected $display_on_site;
+
+ /**
+ * @ORM\Column(name="DetailsPage", type="boolean")
+ */
+ protected $details_page;
+
+ /**
+ * @ORM\Column(name="LocationMessage", type="string")
+ */
+ protected $location_message;
+
+ /**
+ * @ORM\OneToMany(targetEntity="models\summit\SummitLocationImage", mappedBy="location", cascade={"persist"})
+ * @var SummitLocationImage[]
+ */
+ protected $images;
+
+ public function __construct()
+ {
+ parent::__construct();
+ $this->images = new ArrayCollection();
+ }
+
+ /**
+ * @return SummitLocationImage[]
+ */
+ public function getMaps()
+ {
+ return $this->images
+ ->matching
+ (
+ Criteria::create()
+ ->where(Criteria::expr()->eq("class_name", "SummitLocationMap"))
+ ->orderBy(array("order" => Criteria::ASC))
+ );
+ }
+
+ /**
+ * @return SummitLocationImage[]
+ */
+ public function getImages()
+ {
+
+ return $this->images
+ ->matching
+ (
+ Criteria::create()
+ ->where(Criteria::expr()->eq("class_name", "SummitLocationImage"))
+ ->orderBy(array("order" => Criteria::ASC))
+ );
+ }
+
+ /**
+ * @param int $image_id
+ * @return SummitLocationImage
+ */
+ public function getImage($image_id){
+ return $this->images
+ ->matching
+ (
+ Criteria::create()->where(Criteria::expr()->eq("id", $image_id))
+
+ )->first();
+ }
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/Locations/SummitHotel.php b/app/Models/Foundation/Summit/Locations/SummitHotel.php
new file mode 100644
index 00000000..22694221
--- /dev/null
+++ b/app/Models/Foundation/Summit/Locations/SummitHotel.php
@@ -0,0 +1,94 @@
+booking_link;
+ }
+
+ /**
+ * @param string $booking_link
+ */
+ public function setBookingLink($booking_link)
+ {
+ $this->booking_link = $booking_link;
+ }
+ /**
+ * @ORM\Column(name="BookingLink", type="string")
+ */
+ private $booking_link;
+
+ /**
+ * @return bool
+ */
+ public function getSoldOut()
+ {
+ return $this->sold_out;
+ }
+
+ /**
+ * @param bool $sold_out
+ */
+ public function setSoldOut($sold_out)
+ {
+ $this->sold_out = $sold_out;
+ }
+
+ /**
+ * @return string
+ */
+ public function getHotelType()
+ {
+ return $this->hotel_type;
+ }
+
+ /**
+ * @param string $hotel_type
+ */
+ public function setHotelType($hotel_type)
+ {
+ $this->hotel_type = $hotel_type;
+ }
+
+ /**
+ * @ORM\Column(name="SoldOut", type="boolean")
+ */
+ private $sold_out;
+
+ /**
+ * @ORM\Column(name="Type", type="string")
+ */
+ private $hotel_type;
+
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/Locations/SummitLocationImage.php b/app/Models/Foundation/Summit/Locations/SummitLocationImage.php
new file mode 100644
index 00000000..8cb5d16f
--- /dev/null
+++ b/app/Models/Foundation/Summit/Locations/SummitLocationImage.php
@@ -0,0 +1,174 @@
+name;
+ }
+
+ /**
+ * @param string $name
+ */
+ public function setName($name)
+ {
+ $this->name = $name;
+ }
+
+ /**
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
+ /**
+ * @param string $description
+ */
+ public function setDescription($description)
+ {
+ $this->description = $description;
+ }
+
+ /**
+ * @return int
+ */
+ public function getOrder()
+ {
+ return $this->order;
+ }
+
+ /**
+ * @param int $order
+ */
+ public function setOrder($order)
+ {
+ $this->order = $order;
+ }
+
+ /**
+ * @return File
+ */
+ public function getPicture()
+ {
+ return $this->picture;
+ }
+
+ /**
+ * @param File $picture
+ */
+ public function setPicture($picture)
+ {
+ $this->picture = $picture;
+ }
+
+ /**
+ * @return SummitAbstractLocation
+ */
+ public function getLocation()
+ {
+ return $this->location;
+ }
+
+ /**
+ * @param SummitAbstractLocation $location
+ */
+ public function setLocation($location)
+ {
+ $this->location = $location;
+ }
+
+ /**
+ * @ORM\Column(name="Name", type="string")
+ */
+ protected $name;
+
+ /**
+ * @ORM\Column(name="Description", type="string")
+ */
+ protected $description;
+
+ /**
+ * @ORM\Column(name="Order", type="integer")
+ */
+ protected $order;
+
+ /**
+ * @ORM\Column(name="ClassName", type="string")
+ */
+ protected $class_name;
+
+ /**
+ * @return string
+ */
+ public function getClassName()
+ {
+ return $this->class_name;
+ }
+
+ /**
+ * @param string $class_name
+ */
+ public function setClassName($class_name)
+ {
+ $this->class_name = $class_name;
+ }
+
+ /**
+ * @ORM\ManyToOne(targetEntity="models\main\File", fetch="EAGER")
+ * @ORM\JoinColumn(name="PictureID", referencedColumnName="ID")
+ * @var File
+ */
+ protected $picture;
+
+ /**
+ * @ORM\ManyToOne(targetEntity="models\summit\SummitAbstractLocation")
+ * @ORM\JoinColumn(name="LocationID", referencedColumnName="ID")
+ * @var SummitAbstractLocation
+ */
+ protected $location;
+
+ /**
+ * @return bool
+ */
+ public function hasPicture(){
+ return $this->getPictureId() > 0;
+ }
+
+ /**
+ * @return int
+ */
+ public function getPictureId(){
+ try{
+ return !is_null($this->picture) ? $this->picture->getId() : 0;
+ }
+ catch(\Exception $ex){
+ return 0;
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/Locations/SummitVenue.php b/app/Models/Foundation/Summit/Locations/SummitVenue.php
new file mode 100644
index 00000000..cb5dd889
--- /dev/null
+++ b/app/Models/Foundation/Summit/Locations/SummitVenue.php
@@ -0,0 +1,112 @@
+rooms = new ArrayCollection();
+ $this->floors = new ArrayCollection();
+ }
+
+ /**
+ * @ORM\Column(name="IsMain", type="boolean")
+ * @var bool
+ */
+ private $is_main;
+
+ /**
+ * @ORM\OneToMany(targetEntity="models\summit\SummitVenueRoom", mappedBy="venue", cascade={"persist"})
+ * @var SummitVenueRoom[]
+ */
+ private $rooms;
+
+ /**
+ * @ORM\OneToMany(targetEntity="models\summit\SummitVenueFloor", mappedBy="venue", cascade={"persist"})
+ * @var SummitVenueFloor[]
+ */
+ private $floors;
+
+ /**
+ * @return bool
+ */
+ public function getIsMain()
+ {
+ return (bool)$this->is_main;
+ }
+
+ /**
+ * @param bool $is_main
+ */
+ public function setIsMain($is_main)
+ {
+ $this->is_main = $is_main;
+ }
+
+ /**
+ * @return SummitVenueRoom[]
+ */
+ public function getRooms(){
+ return $this->rooms;
+ }
+
+ /**
+ * @param int $room_id
+ * @return SummitVenueRoom|null
+ */
+ public function getRoom($room_id){
+ $criteria = Criteria::create();
+ $criteria->where(Criteria::expr()->eq('id', intval($room_id)));
+ $room = $this->rooms->matching($criteria)->first();
+ return $room === false ? null:$room;
+ }
+
+ /**
+ * @return SummitVenueFloor[]
+ */
+ public function getFloors(){
+ return $this->floors;
+ }
+
+ /**
+ * @param int $floor_id
+ * @return SummitVenueFloor|null
+ */
+ public function getFloor($floor_id){
+ $criteria = Criteria::create();
+ $criteria->where(Criteria::expr()->eq('id', intval($floor_id)));
+ $floor = $this->floors->matching($criteria)->first();
+ return $floor === false ? null:$floor;
+ }
+
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/Locations/SummitVenueFloor.php b/app/Models/Foundation/Summit/Locations/SummitVenueFloor.php
new file mode 100644
index 00000000..da227490
--- /dev/null
+++ b/app/Models/Foundation/Summit/Locations/SummitVenueFloor.php
@@ -0,0 +1,161 @@
+name;
+ }
+
+ /**
+ * @param string $name
+ */
+ public function setName($name)
+ {
+ $this->name = $name;
+ }
+
+ /**
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
+ /**
+ * @param string $description
+ */
+ public function setDescription($description)
+ {
+ $this->description = $description;
+ }
+
+ /**
+ * @return int
+ */
+ public function getNumber()
+ {
+ return $this->number;
+ }
+
+ /**
+ * @param int $number
+ */
+ public function setNumber($number)
+ {
+ $this->number = $number;
+ }
+
+ /**
+ * @return SummitVenue
+ */
+ public function getVenue()
+ {
+ return $this->venue;
+ }
+
+ /**
+ * @return int
+ */
+ public function getVenueId(){
+ try{
+ return $this->venue->getId();
+ }
+ catch(\Exception $ex){
+ return 0;
+ }
+ }
+
+ /**
+ * @ORM\Column(name="Number", type="integer")
+ */
+ private $number;
+
+ /**
+ * @ORM\ManyToOne(targetEntity="models\main\File", fetch="EAGER")
+ * @ORM\JoinColumn(name="ImageID", referencedColumnName="ID")
+ * @var File
+ */
+ private $image;
+
+ /**
+ * @return File
+ */
+ public function getImage()
+ {
+ return $this->image;
+ }
+
+ /**
+ *
+ * @ORM\ManyToOne(targetEntity="models\summit\SummitVenue", inversedBy="floors")
+ * @ORM\JoinColumn(name="VenueID", referencedColumnName="ID")
+ * @var SummitVenue
+ */
+ private $venue;
+
+ /**
+ * @ORM\OneToMany(targetEntity="models\summit\SummitVenueRoom", mappedBy="floor", cascade={"persist"})
+ * @var SummitVenueRoom[]
+ */
+ private $rooms;
+
+ /**
+ * @return SummitVenueRoom[]
+ */
+ public function getRooms(){
+ return $this->rooms;
+ }
+
+ public function __construct()
+ {
+ parent::__construct();
+ $this->rooms = new ArrayCollection();
+ }
+
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/Locations/SummitVenueRoom.php b/app/Models/Foundation/Summit/Locations/SummitVenueRoom.php
new file mode 100644
index 00000000..6a1471fa
--- /dev/null
+++ b/app/Models/Foundation/Summit/Locations/SummitVenueRoom.php
@@ -0,0 +1,143 @@
+venue;
+ }
+
+ /**
+ * @return int
+ */
+ public function getVenueId(){
+ try{
+ return $this->venue->getId();
+ }
+ catch(\Exception $ex){
+ return 0;
+ }
+ }
+
+ /**
+ * @return bool
+ */
+ public function hasVenue(){
+ return $this->getVenueId() > 0;
+ }
+
+ /**
+ * @return SummitVenueFloor
+ */
+ public function getFloor()
+ {
+ return $this->floor;
+ }
+
+ /**
+ * @return int
+ */
+ public function getFloorId(){
+ try{
+ return $this->floor->getId();
+ }
+ catch(\Exception $ex){
+ return 0;
+ }
+ }
+
+ /**
+ * @return bool
+ */
+ public function hasFloor(){
+ return $this->getFloorId() > 0;
+ }
+
+ /**
+ * @return int
+ */
+ public function getCapacity()
+ {
+ return $this->capacity;
+ }
+
+ /**
+ * @param int $capacity
+ */
+ public function setCapacity($capacity)
+ {
+ $this->capacity = $capacity;
+ }
+
+ /**
+ * @return boolean
+ */
+ public function isOverrideBlackouts()
+ {
+ return $this->override_blackouts;
+ }
+
+ /**
+ * @param boolean $override_blackouts
+ */
+ public function setOverrideBlackouts($override_blackouts)
+ {
+ $this->override_blackouts = $override_blackouts;
+ }
+ /**
+ * @ORM\ManyToOne(targetEntity="models\summit\SummitVenue", inversedBy="rooms")
+ * @ORM\JoinColumn(name="VenueID", referencedColumnName="ID")
+ * @var SummitVenue
+ */
+ private $venue;
+
+ /**
+ * @ORM\ManyToOne(targetEntity="models\summit\SummitVenueFloor", inversedBy="rooms")
+ * @ORM\JoinColumn(name="FloorID", referencedColumnName="ID")
+ * @var SummitVenueFloor
+ */
+ private $floor;
+
+ /**
+ * @ORM\Column(name="Capacity", type="integer")
+ * @var int
+ */
+ private $capacity;
+
+ /**
+ * @ORM\Column(name="OverrideBlackouts", type="boolean")
+ * @var bool
+ */
+ private $override_blackouts;
+}
\ No newline at end of file
diff --git a/app/Http/Controllers/apis/protected/summit/strategies/RetrieveAllSummitEventsBySummitStrategy.php b/app/Models/Foundation/Summit/Repositories/IEventFeedbackRepository.php
similarity index 53%
rename from app/Http/Controllers/apis/protected/summit/strategies/RetrieveAllSummitEventsBySummitStrategy.php
rename to app/Models/Foundation/Summit/Repositories/IEventFeedbackRepository.php
index f28d1873..debf5285 100644
--- a/app/Http/Controllers/apis/protected/summit/strategies/RetrieveAllSummitEventsBySummitStrategy.php
+++ b/app/Models/Foundation/Summit/Repositories/IEventFeedbackRepository.php
@@ -1,6 +1,6 @@
-summit->events($page, $per_page, $filter);
- }
+ public function getByEvent(SummitEvent $event, PagingInfo $paging_info, Filter $filter = null, Order $order = null);
}
\ No newline at end of file
diff --git a/app/Models/summit/ISpeakerRepository.php b/app/Models/Foundation/Summit/Repositories/ISpeakerRepository.php
similarity index 92%
rename from app/Models/summit/ISpeakerRepository.php
rename to app/Models/Foundation/Summit/Repositories/ISpeakerRepository.php
index 1b2d2921..fd659245 100644
--- a/app/Models/summit/ISpeakerRepository.php
+++ b/app/Models/Foundation/Summit/Repositories/ISpeakerRepository.php
@@ -17,12 +17,13 @@ use utils\Order;
use utils\PagingResponse;
use utils\PagingInfo;
use utils\Filter;
+use models\utils\IBaseRepository;
/**
* Interface ISpeakerRepository
* @package models\repositories
*/
-interface ISpeakerRepository
+interface ISpeakerRepository extends IBaseRepository
{
/**
* @param Summit $summit
diff --git a/app/Models/summit/SummitHotel.php b/app/Models/Foundation/Summit/Repositories/ISummitAttendeeRepository.php
similarity index 74%
rename from app/Models/summit/SummitHotel.php
rename to app/Models/Foundation/Summit/Repositories/ISummitAttendeeRepository.php
index d9b736cc..9bae8266 100644
--- a/app/Models/summit/SummitHotel.php
+++ b/app/Models/Foundation/Summit/Repositories/ISummitAttendeeRepository.php
@@ -1,6 +1,6 @@
-name;
+ }
+
+ /**
+ * @param string $name
+ */
+ public function setName($name)
+ {
+ $this->name = $name;
+ }
+
+ /**
+ * @return string
+ */
+ public function getExternalSummitId()
+ {
+ return $this->external_summit_id;
+ }
+
+ /**
+ * @param string $external_summit_id
+ */
+ public function setExternalSummitId($external_summit_id)
+ {
+ $this->external_summit_id = $external_summit_id;
+ }
+
+ /**
+ * @return \DateTime
+ */
+ public function getScheduleDefaultStartDate()
+ {
+ return $this->schedule_default_start_date;
+ }
+
+ /**
+ * @param \DateTime $schedule_default_start_date
+ */
+ public function setScheduleDefaultStartDate($schedule_default_start_date)
+ {
+ $this->schedule_default_start_date = $schedule_default_start_date;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getBeginDate()
+ {
+ return $this->begin_date;
+ }
+
+ /**
+ * @param \DateTime $begin_date
+ */
+ public function setBeginDate($begin_date)
+ {
+ $this->begin_date = $begin_date;
+ }
+
+ /**
+ * @return \DateTime
+ */
+ public function getEndDate()
+ {
+ return $this->end_date;
+ }
+
+ /**
+ * @param \DateTime $end_date
+ */
+ public function setEndDate($end_date)
+ {
+ $this->end_date = $end_date;
+ }
+
+ /**
+ * @return bool
+ */
+ public function getActive()
+ {
+ return $this->active;
+ }
+
+ /**
+ * @param bool $active
+ */
+ public function setActive($active)
+ {
+ $this->active = $active;
+ }
+
+ /**
+ * @return \DateTime
+ */
+ public function getStartShowingVenuesDate()
+ {
+ return $this->start_showing_venues_date;
+ }
+
+ /**
+ * @param \DateTime $start_showing_venues_date
+ */
+ public function setStartShowingVenuesDate($start_showing_venues_date)
+ {
+ $this->start_showing_venues_date = $start_showing_venues_date;
+ }
+
+ /**
+ * @ORM\Column(name="Title", type="string")
+ * @var string
+ */
+ private $name;
+
+ /**
+ * @ORM\Column(name="SummitBeginDate", type="datetime")
+ * @var \DateTime
+ */
+ private $begin_date;
+
+ /**
+ * @ORM\Column(name="SummitEndDate", type="datetime")
+ * @var \DateTime
+ */
+ private $end_date;
+
+ /**
+ * @ORM\Column(name="Active", type="boolean")
+ * @var bool
+ */
+ private $active;
+
+ /**
+ * @ORM\Column(name="ExternalEventId", type="string")
+ * @var string
+ */
+ private $external_summit_id;
+
+ /**
+ * @ORM\Column(name="ScheduleDefaultStartDate", type="datetime")
+ * @var \DateTime
+ */
+ private $schedule_default_start_date;
+
+ /**
+ * @return string
+ */
+ public function getSummitExternalId(){ return $this->external_summit_id; }
+
+ /**
+ * @return bool
+ */
+ public function isActive(){
+ return $this->active;
+ }
+
+ /**
+ * @ORM\Column(name="StartShowingVenuesDate", type="datetime")
+ */
+ private $start_showing_venues_date;
+
+ /**
+ * @ORM\Column(name="TimeZone", type="string")
+ * @var string
+ */
+ private $time_zone_id;
+
+ /**
+ * @return string
+ */
+ public function getTimeZoneId()
+ {
+ return $this->time_zone_id;
+ }
+
+ /**
+ * @param string $time_zone_id
+ */
+ public function setTimeZoneId($time_zone_id)
+ {
+ $this->time_zone_id = $time_zone_id;
+ }
+
+ // ...
+ /**
+ * @ORM\OneToMany(targetEntity="SummitAbstractLocation", mappedBy="summit", cascade={"persist"})
+ */
+ private $locations;
+
+ /**
+ * @ORM\OneToMany(targetEntity="SummitEvent", mappedBy="summit", cascade={"persist"})
+ */
+ private $events;
+
+ /**
+ * Summit constructor.
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->locations = new ArrayCollection();
+ $this->events = new ArrayCollection();
+ $this->event_types = new ArrayCollection();
+ $this->summit_types = new ArrayCollection();
+ $this->ticket_types = new ArrayCollection();
+ $this->presentation_categories = new ArrayCollection();
+ $this->category_groups = new ArrayCollection();
+ $this->attendees = new ArrayCollection();
+ $this->entity_events = new ArrayCollection();
+ }
+
+ /**
+ * @param DateTime $value
+ * @return null|DateTime
+ */
+ public function convertDateFromTimeZone2UTC(DateTime $value)
+ {
+ $time_zone_id = $this->time_zone_id;
+ if(empty($time_zone_id)) return $value;
+ $time_zone_list = timezone_identifiers_list();
+
+ if(isset($time_zone_list[$time_zone_id]) && !empty($value))
+ {
+ $utc_timezone = new DateTimeZone("UTC");
+ $time_zone_name = $time_zone_list[$time_zone_id];
+ $summit_time_zone = new DateTimeZone($time_zone_name);
+ $local_date = $value->setTimezone($summit_time_zone);
+ return $local_date->setTimezone($utc_timezone);
+ }
+ return null;
+ }
+
+ /**
+ * @param DateTime $value
+ * @return null|DateTime
+ */
+ public function convertDateFromUTC2TimeZone(DateTime $value)
+ {
+ $time_zone_id = $this->time_zone_id;
+ if(empty($time_zone_id)) return $value;
+ $time_zone_list = timezone_identifiers_list();
+
+ if(isset($time_zone_list[$time_zone_id]) && !empty($value))
+ {
+ $utc_timezone = new DateTimeZone("UTC");
+ $time_zone_name = $time_zone_list[$time_zone_id];
+ $summit_time_zone = new DateTimeZone($time_zone_name);
+ $utc_date = $value->setTimezone($utc_timezone);
+
+ return $utc_date->setTimezone($summit_time_zone);
+ }
+ return null;
+ }
+
+ /**
+ * @return DateTime
+ */
+ public function getLocalBeginDate()
+ {
+ return $this->convertDateFromUTC2TimeZone($this->begin_date);
+ }
+
+ /**
+ * @return DateTime
+ */
+ public function getLocalEndDate()
+ {
+ return $this->convertDateFromUTC2TimeZone($this->end_date);
+ }
+
+ /**
+ * @param SummitAbstractLocation $location
+ */
+ public function addLocation(SummitAbstractLocation $location){
+ $this->locations->add($location);
+ $location->setSummit($this);
+ }
+
+ /**
+ * @return ArrayCollection
+ */
+ public function getLocations()
+ {
+ return $this->locations;
+ }
+
+ /**
+ * @return SummitVenue[]
+ */
+ public function getVenues(){
+ return $this->locations->filter(function($e){
+ return $e instanceof SummitVenue;
+ });
+ }
+
+ /**
+ * @return ArrayCollection
+ */
+ public function getEvents(){
+ return $this->events;
+ }
+
+ /**
+ * @param SummitEvent $event
+ */
+ public function addEvent(SummitEvent $event){
+ $this->events->add($event);
+ $event->setSummit($this);
+ }
+
+ /**
+ * @ORM\ManyToOne(targetEntity="models\main\File", fetch="EAGER")
+ * @ORM\JoinColumn(name="LogoID", referencedColumnName="ID")
+ * @var File
+ */
+ private $logo;
+
+ /**
+ * @return File
+ */
+ public function getLogo()
+ {
+ return $this->logo;
+ }
+
+ /**
+ * @return bool
+ */
+ public function hasLogo(){
+ return $this->getLogoId() > 0;
+ }
+
+ /**
+ * @return int
+ */
+ public function getLogoId(){
+ try{
+ return !is_null($this->logo)?$this->logo->getId():0;
+ }
+ catch(\Exception $ex){
+ return 0;
+ }
+ }
+
+ /**
+ * @param int $location_id
+ * @return SummitAbstractLocation
+ */
+ public function getLocation($location_id)
+ {
+ $criteria = Criteria::create();
+ $criteria->where(Criteria::expr()->eq('id', intval($location_id)));
+ $location = $this->locations->matching($criteria)->first();
+ return $location === false ? null:$location;
+ }
+
+ /**
+ * @ORM\OneToMany(targetEntity="models\summit\SummitEventType", mappedBy="summit", cascade={"persist"})
+ */
+ private $event_types;
+
+ /**
+ * @return SummitEventType[]
+ */
+ public function getEventTypes()
+ {
+ return $this->event_types;
+ }
+
+ /**
+ * @param int $event_type_id
+ * @return SummitEventType
+ */
+ public function getEventType($event_type_id)
+ {
+ $criteria = Criteria::create();
+ $criteria->where(Criteria::expr()->eq('id', intval($event_type_id)));
+ $event_type = $this->event_types->matching($criteria)->first();
+ return $event_type === false ? null:$event_type;
+ }
+
+ /**
+ * @ORM\OneToMany(targetEntity="models\summit\SummitType", mappedBy="summit", cascade={"persist"})
+ */
+ private $summit_types;
+
+ /**
+ * @return SummitType[]
+ */
+ public function getSummitTypes()
+ {
+ return $this->summit_types;
+ }
+
+ /**
+ * @param int $summit_type_id
+ * @return SummitType
+ */
+ public function getSummitType($summit_type_id)
+ {
+ $criteria = Criteria::create();
+ $criteria->where(Criteria::expr()->eq('id', intval($summit_type_id)));
+ $summit_type = $this->summit_types->matching($criteria)->first();
+ return $summit_type === false ? null:$summit_type;
+ }
+
+ /**
+ * @ORM\OneToMany(targetEntity="models\summit\SummitTicketType", mappedBy="summit", cascade={"persist"})
+ */
+ private $ticket_types;
+
+ /**
+ * @return SummitTicketType[]
+ */
+ public function getTicketTypes()
+ {
+ return $this->ticket_types;
+ }
+
+ /**
+ * @param int $ticket_type_id
+ * @return SummitTicketType|null
+ */
+ public function getTicketType($ticket_type_id){
+ $criteria = Criteria::create();
+ $criteria->where(Criteria::expr()->eq('id', intval($ticket_type_id)));
+ $ticket_type = $this->ticket_types->matching($criteria)->first();
+ return $ticket_type === false ? null:$ticket_type;
+ }
+
+ /**
+ * @param string $ticket_type_external_id
+ * @return SummitTicketType|null
+ */
+ public function getTicketTypeByExternalId($ticket_type_external_id){
+ $criteria = Criteria::create();
+ $criteria->where(Criteria::expr()->eq('external_id', $ticket_type_external_id));
+ $ticket_type = $this->ticket_types->matching($criteria)->first();
+ return $ticket_type === false ? null:$ticket_type;
+ }
+
+ /**
+ * @param int $event_id
+ * @return null|SummitEvent
+ */
+ public function getScheduleEvent($event_id)
+ {
+ $criteria = Criteria::create();
+ $criteria->where(Criteria::expr()->eq('published', 1));
+ $criteria->andWhere(Criteria::expr()->eq('id', intval($event_id)));
+ $event = $this->events->matching($criteria)->first();
+ return $event === false ? null:$event;
+ }
+
+ /**
+ * @param int $event_id
+ * @return bool
+ */
+ public function isEventOnSchedule($event_id){
+ $criteria = Criteria::create();
+ $criteria->where(Criteria::expr()->eq('published', 1));
+ $criteria->andWhere(Criteria::expr()->eq('id', intval($event_id)));
+ return $this->events->matching($criteria)->count() > 0;
+ }
+
+ public function getScheduleEvents(){
+ $criteria = Criteria::create();
+ $criteria->where(Criteria::expr()->eq('published', 1));
+ $criteria->orderBy(["start_date" => Criteria::ASC, "end_date" => Criteria::ASC]);
+ return $this->events->matching($criteria);
+ }
+
+ public function getPresentations(){
+ $query = $this->createQuery("SELECT p from models\summit\Presentation p JOIN p.summit s WHERE s.id = :summit_id");
+ return $query->setParameter('summit_id', $this->getIdentifier())->getResult();
+ }
+ /**
+ * @param int $event_id
+ * @return null|SummitEvent
+ */
+ public function getEvent($event_id)
+ {
+ $criteria = Criteria::create();
+ $criteria->where(Criteria::expr()->eq('id', intval($event_id)));
+ $event = $this->events->matching($criteria)->first();
+ return $event === false ? null:$event;
+ }
+
+ /**
+ * @ORM\OneToMany(targetEntity="models\summit\PresentationCategory", mappedBy="summit", cascade={"persist"})
+ * @var PresentationCategory[]
+ */
+ private $presentation_categories;
+
+ /**
+ * @return PresentationCategory[]
+ */
+ public function getPresentationCategories()
+ {
+ return $this->presentation_categories;
+ }
+
+ /**
+ * @param int $category_id
+ * @return PresentationCategory
+ */
+ public function getPresentationCategory($category_id){
+ $criteria = Criteria::create();
+ $criteria->where(Criteria::expr()->eq('id', intval($category_id)));
+ $category = $this->presentation_categories->matching($criteria)->first();
+ return $category === false ? null:$category;
+ }
+
+ /**
+ * @ORM\OneToMany(targetEntity="models\summit\PresentationCategoryGroup", mappedBy="summit", cascade={"persist"})
+ * @var PresentationCategoryGroup[]
+ */
+ private $category_groups;
+
+ /**
+ * @return PresentationCategoryGroup[]
+ */
+ public function getCategoryGroups()
+ {
+ return $this->category_groups;
+ }
+
+ /**
+ * @param int $group_id
+ * @return null|PresentationCategoryGroup
+ */
+ public function getCategoryGroup($group_id)
+ {
+ $criteria = Criteria::create();
+ $criteria->where(Criteria::expr()->eq('id', intval($group_id)));
+ $group = $this->category_groups->matching($criteria)->first();
+ return $group === false ? null:$group;
+ }
+
+ /**
+ * @ORM\OneToMany(targetEntity="models\summit\SummitAttendee", mappedBy="summit", cascade={"persist"})
+ * @var SummitAttendee[]
+ */
+ private $attendees;
+
+ /**
+ * @param int $member_id
+ * @return SummitAttendee
+ */
+ public function getAttendeeByMemberId($member_id)
+ {
+ $builder = $this->createQueryBuilder();
+ $members = $builder
+ ->select('a')
+ ->from('models\summit\SummitAttendee','a')
+ ->join('a.member','m')
+ ->join('a.summit','s')
+ ->where('s.id = :summit_id and m.id = :member_id')
+ ->setParameter('summit_id', $this->getId())
+ ->setParameter('member_id', intval($member_id))
+ ->getQuery()->getResult();
+ return count($members) > 0 ? $members[0] : null;
+ }
+
+ /**
+ * @param Member $member
+ * @return SummitAttendee|null
+ */
+ public function getAttendeeByMember(Member $member){
+ return $this->getAttendeeByMemberId($member->getId());
+ }
+
+ /**
+ * @param int $attendee_id
+ * @return SummitAttendee
+ */
+ public function getAttendeeById($attendee_id)
+ {
+ $criteria = Criteria::create();
+ $criteria->where(Criteria::expr()->eq('id', intval($attendee_id)));
+ $attendee = $this->attendees->matching($criteria)->first();
+ return $attendee === false ? null:$attendee;
+ }
+
+ /**
+ * @ORM\OneToMany(targetEntity="models\summit\SummitEntityEvent", mappedBy="summit", cascade={"persist"})
+ * @var SummitEntityEvent[]
+ */
+ private $entity_events;
+
+ /**
+ * @param SummitEvent $summit_event
+ * @return bool
+ */
+ public function isEventInsideSummitDuration(SummitEvent $summit_event)
+ {
+ $event_start_date = $summit_event->getLocalStartDate();
+ $event_end_date = $summit_event->getLocalEndDate();
+ $summit_start_date = $this->getLocalBeginDate();
+ $summit_end_date = $this->getLocalEndDate();
+
+ return $event_start_date >= $summit_start_date && $event_start_date <= $summit_end_date &&
+ $event_end_date <= $summit_end_date && $event_end_date >= $event_start_date;
+ }
+
+ /**
+ * @return \Doctrine\ORM\QueryBuilder
+ */
+ private function buildModeratorsQuery(){
+ return $this->createQueryBuilder()
+ ->select('distinct ps')
+ ->from('models\summit\PresentationSpeaker','ps')
+ ->join('ps.presentations','p')
+ ->join('p.summit','s')
+ ->join('p.moderator','m')
+ ->where('s.id = :summit_id and p.published = 1 and m.id = ps.id')
+ ->setParameter('summit_id', $this->getId());
+ }
+
+ /**
+ * @return \Doctrine\ORM\QueryBuilder
+ */
+ private function buildSpeakersQuery(){
+ return $this->createQueryBuilder()
+ ->select('distinct ps')
+ ->from('models\summit\PresentationSpeaker','ps')
+ ->join('ps.presentations','p')
+ ->join('p.summit','s')
+ ->where("s.id = :summit_id and p.published = 1")
+ ->setParameter('summit_id', $this->getId());
+ }
+
+ /**
+ * @return PresentationSpeaker[]
+ */
+ public function getSpeakers(){
+ // moderators
+ $moderators = $this->buildModeratorsQuery()->getQuery()->getResult();
+ // get moderators ids to exclude from speakers
+ $moderators_ids = array();
+ foreach($moderators as $m){
+ $moderators_ids[] = $m->getId();
+ }
+
+ // speakers
+ $sbuilder = $this->buildSpeakersQuery();
+
+ if(count($moderators_ids) > 0){
+ $moderators_ids = implode(', ',$moderators_ids);
+ $sbuilder = $sbuilder->andWhere("ps.id not in ({$moderators_ids})");
+ }
+
+ $speakers = $sbuilder->getQuery()->getResult();
+
+ return array_merge($speakers, $moderators);
+ }
+
+ /**
+ * @param Member $member
+ * @return PresentationSpeaker|null
+ */
+ public function getSpeakerByMember(Member $member){
+ return $this->getSpeakerByMemberId($member->getId());
+ }
+
+ /**
+ * @param int $member_id
+ * @return PresentationSpeaker|null
+ */
+ public function getSpeakerByMemberId($member_id){
+ // moderators
+ $moderator = $this->buildModeratorsQuery()
+ ->join('ps.member','mb')
+ ->andWhere('mb.id = :member_id')
+ ->setParameter('member_id', $member_id)
+ ->getQuery()->getOneOrNullResult();
+
+ if(!is_null($moderator)) return $moderator;
+
+ // speakers
+ $speaker = $this->buildSpeakersQuery()
+ ->join('ps.member','mb')
+ ->andWhere('mb.id = :member_id')
+ ->setParameter('member_id', $member_id)
+ ->getQuery()->getOneOrNullResult();
+
+ if(!is_null($speaker)) return $speaker;;
+
+ return null;
+ }
+
+ /**
+ * @param int $speaker_id
+ * @return PresentationSpeaker|null
+ */
+ public function getSpeaker($speaker_id){
+ // moderators
+ $moderator = $this->buildModeratorsQuery()
+ ->andWhere('ps.id = :speaker_id')
+ ->setParameter('speaker_id', $speaker_id)
+ ->getQuery()->getOneOrNullResult();
+
+ if(!is_null($moderator)) return $moderator;
+
+ // speakers
+ $speaker = $this->buildSpeakersQuery()
+ ->andWhere('ps.id = :speaker_id')
+ ->setParameter('speaker_id', $speaker_id)
+ ->getQuery()->getOneOrNullResult();
+
+ if(!is_null($speaker)) return $speaker;;
+
+ return null;
+ }
+
+ /**
+ * @return Company[]
+ */
+ public function getSponsors(){
+ $builder = $this->createQueryBuilder();
+ return $builder
+ ->select('distinct c')
+ ->from('models\main\Company','c')
+ ->join('c.sponsorships','sp')
+ ->join('sp.summit','s')
+ ->where('s.id = :summit_id and sp.published = 1')
+ ->setParameter('summit_id', $this->getId())->getQuery()->getResult();
+ }
+
+ /**
+ * @return string
+ */
+ public function getMainPage(){
+ try {
+ $sql = <<prepareRawSQL($sql);
+ $stmt->execute(['summit_id' => $this->id]);
+ $res = $stmt->fetchAll(\PDO::FETCH_COLUMN);
+ return count($res) > 0 ? $res[0] : '';
+ }
+ catch (\Exception $ex){
+
+ }
+ return '';
+ }
+
+ /**
+ * @return string
+ */
+ public function getSchedulePage(){
+ try{
+ $sql = <<prepareRawSQL($sql);
+ $stmt->execute(['summit_id' => $this->id]);
+ $res = $stmt->fetchAll(\PDO::FETCH_COLUMN);
+ return count($res) > 0 ? $res[0] : '';
+ }
+ catch (\Exception $ex){
+
+ }
+ return '';
+ }
+
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/SummitOwned.php b/app/Models/Foundation/Summit/SummitOwned.php
new file mode 100644
index 00000000..7aa800dc
--- /dev/null
+++ b/app/Models/Foundation/Summit/SummitOwned.php
@@ -0,0 +1,53 @@
+summit = $summit;
+ }
+
+ /**
+ * @return Summit
+ */
+ public function getSummit(){
+ return $this->summit;
+ }
+
+ /**
+ * @return int
+ */
+ public function getSummitId(){
+ try {
+ return $this->summit->getId();
+ }
+ catch(\Exception $ex){
+ return 0;
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/SummitTicketType.php b/app/Models/Foundation/Summit/SummitTicketType.php
new file mode 100644
index 00000000..7ff93484
--- /dev/null
+++ b/app/Models/Foundation/Summit/SummitTicketType.php
@@ -0,0 +1,119 @@
+name;
+ }
+
+ /**
+ * @param string $name
+ */
+ public function setName($name)
+ {
+ $this->name = $name;
+ }
+
+ /**
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
+ /**
+ * @param string $description
+ */
+ public function setDescription($description)
+ {
+ $this->description = $description;
+ }
+
+ /**
+ * @ORM\Column(name="Description", type="string")
+ * @var string
+ */
+ private $description;
+
+ /**
+ * @ORM\Column(name="ExternalId", type="string")
+ * @var string
+ */
+ private $external_id;
+
+ /**
+ * @return string
+ */
+ public function getExternalId(){return $this->external_id; }
+
+
+ public function __construct()
+ {
+ parent::__construct();
+ $this->allowed_summit_types = new ArrayCollection();
+ }
+
+ /**
+ * @ORM\ManyToMany(targetEntity="models\summit\SummitType")
+ * @ORM\JoinTable(name="SummitTicketType_AllowedSummitTypes",
+ * joinColumns={@ORM\JoinColumn(name="SummitTicketTypeID", referencedColumnName="ID")},
+ * inverseJoinColumns={@ORM\JoinColumn(name="SummitTypeID", referencedColumnName="ID")}
+ * )
+ * @var SummitType[]
+ */
+ private $allowed_summit_types;
+
+ /**
+ * @return SummitType[]
+ */
+ public function getAllowedSummitTypes()
+ {
+ return $this->allowed_summit_types;
+ }
+
+ /**
+ * @return int[]
+ */
+ public function getAllowedSummitTypeIds()
+ {
+ return $this->allowed_summit_types->map(function($entity) {
+ return $entity->getId();
+ })->toArray();
+ }
+
+}
\ No newline at end of file
diff --git a/app/Models/Foundation/Summit/SummitType.php b/app/Models/Foundation/Summit/SummitType.php
new file mode 100644
index 00000000..28ab1d73
--- /dev/null
+++ b/app/Models/Foundation/Summit/SummitType.php
@@ -0,0 +1,90 @@
+title;
+ }
+
+ /**
+ * @param mixed $title
+ */
+ public function setTitle($title)
+ {
+ $this->title = $title;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getColor()
+ {
+ return $this->color;
+ }
+
+ /**
+ * @param mixed $color
+ */
+ public function setColor($color)
+ {
+ $this->color = $color;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getType()
+ {
+ return $this->type;
+ }
+
+ /**
+ * @param mixed $type
+ */
+ public function setType($type)
+ {
+ $this->type = $type;
+ }
+
+ /**
+ * @ORM\Column(name="Type", type="string")
+ */
+ private $type;
+}
\ No newline at end of file
diff --git a/app/Models/oauth2/AccessToken.php b/app/Models/OAuth2/AccessToken.php
similarity index 100%
rename from app/Models/oauth2/AccessToken.php
rename to app/Models/OAuth2/AccessToken.php
diff --git a/app/Models/oauth2/IResourceServerContext.php b/app/Models/OAuth2/IResourceServerContext.php
similarity index 100%
rename from app/Models/oauth2/IResourceServerContext.php
rename to app/Models/OAuth2/IResourceServerContext.php
diff --git a/app/Models/oauth2/ResourceServerContext.php b/app/Models/OAuth2/ResourceServerContext.php
similarity index 100%
rename from app/Models/oauth2/ResourceServerContext.php
rename to app/Models/OAuth2/ResourceServerContext.php
diff --git a/app/Models/oauth2/Token.php b/app/Models/OAuth2/Token.php
similarity index 100%
rename from app/Models/oauth2/Token.php
rename to app/Models/OAuth2/Token.php
diff --git a/app/Models/resource_server/AccessTokenService.php b/app/Models/ResourceServer/AccessTokenService.php
similarity index 95%
rename from app/Models/resource_server/AccessTokenService.php
rename to app/Models/ResourceServer/AccessTokenService.php
index 902d8905..5192356b 100644
--- a/app/Models/resource_server/AccessTokenService.php
+++ b/app/Models/ResourceServer/AccessTokenService.php
@@ -138,15 +138,15 @@ final class AccessTokenService implements IAccessTokenService
try {
$client = new Client([
- 'defaults' => [
- 'timeout' => Config::get('curl.timeout', 60),
+ 'defaults' => [
+ 'timeout' => Config::get('curl.timeout', 60),
'allow_redirects' => Config::get('curl.allow_redirects', false),
- 'verify' => Config::get('curl.verify_ssl_cert', true)
+ 'verify' => Config::get('curl.verify_ssl_cert', true)
]
]);
- $client_id = Config::get('app.openstackid_client_id', '');
- $client_secret = Config::get('app.openstackid_client_secret', '');
+ $client_id = Config::get('app.openstackid_client_id', '');
+ $client_secret = Config::get('app.openstackid_client_secret', '');
$auth_server_url = Config::get('app.openstackid_base_url', '');
if (empty($client_id)) {
diff --git a/app/Models/resource_server/Api.php b/app/Models/ResourceServer/Api.php
similarity index 100%
rename from app/Models/resource_server/Api.php
rename to app/Models/ResourceServer/Api.php
diff --git a/app/Models/resource_server/ApiEndpoint.php b/app/Models/ResourceServer/ApiEndpoint.php
similarity index 100%
rename from app/Models/resource_server/ApiEndpoint.php
rename to app/Models/ResourceServer/ApiEndpoint.php
diff --git a/app/Models/resource_server/ApiScope.php b/app/Models/ResourceServer/ApiScope.php
similarity index 100%
rename from app/Models/resource_server/ApiScope.php
rename to app/Models/ResourceServer/ApiScope.php
diff --git a/app/Models/resource_server/IAccessTokenService.php b/app/Models/ResourceServer/IAccessTokenService.php
similarity index 100%
rename from app/Models/resource_server/IAccessTokenService.php
rename to app/Models/ResourceServer/IAccessTokenService.php
diff --git a/app/Models/resource_server/IApi.php b/app/Models/ResourceServer/IApi.php
similarity index 100%
rename from app/Models/resource_server/IApi.php
rename to app/Models/ResourceServer/IApi.php
diff --git a/app/Models/resource_server/IApiEndpoint.php b/app/Models/ResourceServer/IApiEndpoint.php
similarity index 100%
rename from app/Models/resource_server/IApiEndpoint.php
rename to app/Models/ResourceServer/IApiEndpoint.php
diff --git a/app/Models/resource_server/IApiEndpointRepository.php b/app/Models/ResourceServer/IApiEndpointRepository.php
similarity index 100%
rename from app/Models/resource_server/IApiEndpointRepository.php
rename to app/Models/ResourceServer/IApiEndpointRepository.php
diff --git a/app/Models/resource_server/IApiScope.php b/app/Models/ResourceServer/IApiScope.php
similarity index 100%
rename from app/Models/resource_server/IApiScope.php
rename to app/Models/ResourceServer/IApiScope.php
diff --git a/app/Models/Utils/BaseModelEloquent.php b/app/Models/Utils/BaseModelEloquent.php
index c2816b29..fd7b888e 100644
--- a/app/Models/Utils/BaseModelEloquent.php
+++ b/app/Models/Utils/BaseModelEloquent.php
@@ -17,7 +17,8 @@ use DB;
use Eloquent;
use libs\utils\JsonUtils;
use ReflectionClass;
-
+use Illuminate\Database\Eloquent\Relations\HasMany;
+use Illuminate\Database\Eloquent\Builder;
/**
* Class BaseModelEloquent
*/
@@ -26,7 +27,7 @@ class BaseModelEloquent extends Eloquent
private $class = null;
- protected $array_mappings = array();
+ protected static $array_mappings = array();
/**
* Register a restoring model event with the dispatcher.
@@ -62,13 +63,66 @@ class BaseModelEloquent extends Eloquent
}
}
+ /**
+ * @return array
+ */
+ public function getAttributeMappings(){
+ $mappings = array();
+
+ $hierarchy = $this->getClassHierarchy();
+ foreach($hierarchy as $class_name){
+ if($class_name == $this->class->getName()) continue;
+ $class = new $class_name;
+ if($class instanceof BaseModelEloquent)
+ $mappings = array_merge($mappings, $class->getSelfMappings());
+ }
+ $mappings = array_merge($mappings, $this->getSelfMappings());
+ return $mappings;
+ }
+
+ public function getSelfMappings(){
+ return static::$array_mappings;
+ }
+
+ /**
+ * @return array
+ */
+ public function getClassHierarchy(){
+ $class_hierarchy = array();
+
+ if ($this->useMti()) {
+ $class = $this->class->getName();
+ $parents = $this->get_class_lineage(new $class);
+
+ if ($this->mtiClassType === 'concrete') {
+ $base_class_name = $this->class->getName();
+ array_push($class_hierarchy, $base_class_name);
+ }
+
+ foreach ($parents as $parent) {
+
+ if (!$this->isAllowedParent($parent)) {
+ continue;
+ }
+
+ $parent = new $parent;
+ if ($parent->mtiClassType === 'abstract') {
+ continue;
+ }
+
+ array_push($class_hierarchy, $parent->class->getName());
+ }
+ }
+ return array_reverse($class_hierarchy);
+ }
+
public function toArray()
{
- $values = parent::toArray();
-
- if (count($this->array_mappings)) {
+ $values = parent::toArray();
+ $mappings = $this->getAttributeMappings();
+ if (count($mappings)) {
$new_values = array();
- foreach ($this->array_mappings as $old_key => $new_key) {
+ foreach ($mappings as $old_key => $new_key) {
$value = isset($values[$old_key])? $values[$old_key] :
(
isset($values['pivot'])? (
@@ -208,4 +262,144 @@ class BaseModelEloquent extends Eloquent
return parent::newFromBuilder($attributes, $connection);
}
}
+
+ /**
+ * Define a one-to-many relationship.
+ *
+ * @param string $related
+ * @param string $foreignKey
+ * @param string $localKey
+ * @param bool $prefix_fkey
+ * @return \Illuminate\Database\Eloquent\Relations\HasMany
+ */
+ public function hasMany($related, $foreignKey = null, $localKey = null, $prefix_fkey = true)
+ {
+ $foreignKey = $foreignKey ?: $this->getForeignKey();
+ $instance = new $related;
+ $table_name = $instance->getTable();
+
+ $localKey = $localKey ?: $this->getKeyName();
+ if($prefix_fkey) $foreignKey = $table_name . '.' . $foreignKey;
+
+ return new HasMany($instance->newQuery(), $this, $foreignKey, $localKey);
+ }
+
+ /**
+ * Save the model to the database.
+ *
+ * @param array $options
+ * @return bool
+ */
+ public function save(array $options = array())
+ {
+ $query = $this->newQueryWithoutScopes();
+
+ // If the "saving" event returns false we'll bail out of the save and return
+ // false, indicating that the save failed. This provides a chance for any
+ // listeners to cancel save operations if validations fail or whatever.
+ if ($this->fireModelEvent('saving') === false)
+ {
+ return false;
+ }
+
+ // If the model already exists in the database we can just update our record
+ // that is already in this database using the current IDs in this "where"
+ // clause to only update this model. Otherwise, we'll just insert them.
+ if ($this->exists)
+ {
+ $saved = $this->performUpdate($query, $options);
+ }
+
+ // If the model is brand new, we'll insert it into our database and set the
+ // ID attribute on the model to the value of the newly inserted row's ID
+ // which is typically an auto-increment value managed by the database.
+ else
+ {
+ $saved = $this->performInsert($query, $options);
+ }
+
+ if ($saved) $this->finishSave($options);
+
+ return $saved;
+ }
+
+ /**
+ * Perform a model insert operation.
+ *
+ * @param \Illuminate\Database\Eloquent\Builder $query
+ * @param array $options
+ * @return bool
+ */
+ protected function performInsert(Builder $query, array $options = [])
+ {
+ if ($this->fireModelEvent('creating') === false) return false;
+
+ // First we'll need to create a fresh query instance and touch the creation and
+ // update timestamps on this model, which are maintained by us for developer
+ // convenience. After, we will just continue saving these model instances.
+ if ($this->timestamps && array_get($options, 'timestamps', true))
+ {
+ $this->updateTimestamps();
+ }
+
+ $class_hierarchy = array();
+
+ if ($this->useMti())
+ {
+ $class = $this->class->getName();
+ $parents = $this->get_class_lineage(new $class);
+
+ if ($this->mtiClassType === 'concrete')
+ {
+ $base_class_name = $this->class->getShortName();
+ array_push($class_hierarchy, $base_class_name);
+ }
+
+ foreach ($parents as $parent) {
+
+ if(!$this->isAllowedParent($parent))
+ {
+ continue;
+ }
+
+ $parent = new $parent;
+ if ($parent->mtiClassType === 'abstract') {
+ continue;
+ }
+
+ array_push($class_hierarchy, $parent->class->getShortName());
+ }
+ $attributes = $this->attributes;
+ do{
+ $table = array_pop($class_hierarchy);
+ $class = new $table;
+
+ }while(true);
+ }
+ else {
+ // If the model has an incrementing key, we can use the "insertGetId" method on
+ // the query builder, which will give us back the final inserted ID for this
+ // table from the database. Not all tables have to be incrementing though.
+ $attributes = $this->attributes;
+
+ if ($this->incrementing) {
+ $this->insertAndSetId($query, $attributes);
+ }
+
+ // If the table is not incrementing we'll simply insert this attributes as they
+ // are, as this attributes arrays must contain an "id" column already placed
+ // there by the developer as the manually determined key for these models.
+ else {
+ $query->insert($attributes);
+ }
+ }
+ // We will go ahead and set the exists property to true, so that it is set when
+ // the created event is fired, just in case the developer tries to update it
+ // during the event. This will allow them to do so and run an update here.
+ $this->exists = true;
+
+ $this->fireModelEvent('created', false);
+
+ return true;
+ }
}
\ No newline at end of file
diff --git a/app/Models/Utils/IEntity.php b/app/Models/Utils/IEntity.php
index ad4ab748..c73c88c9 100644
--- a/app/Models/Utils/IEntity.php
+++ b/app/Models/Utils/IEntity.php
@@ -20,4 +20,5 @@ interface IEntity {
* @return int
*/
public function getIdentifier();
+
}
\ No newline at end of file
diff --git a/app/Http/Utils/JoinFilterMapping.php b/app/Models/Utils/PreRemoveEventArgs.php
similarity index 57%
rename from app/Http/Utils/JoinFilterMapping.php
rename to app/Models/Utils/PreRemoveEventArgs.php
index c56926d1..7c1d86f9 100644
--- a/app/Http/Utils/JoinFilterMapping.php
+++ b/app/Models/Utils/PreRemoveEventArgs.php
@@ -1,6 +1,7 @@
-params = $params;
+ }
/**
- * JoinFilterMapping constructor.
- * @param string $table
- * @param string $join
- * @param string $where
+ * @return array
*/
- public function __construct($table, $join, $where)
+ public function getParams()
{
- parent::__construct($table, $where);
- $this->join = $join;
+ return $this->params;
}
+
}
\ No newline at end of file
diff --git a/app/Models/Utils/SilverstripeBaseModel.php b/app/Models/Utils/SilverstripeBaseModel.php
index 74492cba..d011292b 100644
--- a/app/Models/Utils/SilverstripeBaseModel.php
+++ b/app/Models/Utils/SilverstripeBaseModel.php
@@ -1,4 +1,4 @@
-ClassName = $this->table;
+ return $this->created;
}
/**
- * @return int
+ * @param mixed $created
*/
+ public function setCreated($created)
+ {
+ $this->created = $created;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getLastEdited()
+ {
+ return $this->last_edited;
+ }
+
+ /**
+ * @param mixed $last_edited
+ */
+ public function setLastEdited($last_edited)
+ {
+ $this->last_edited = $last_edited;
+ }
+
+ /**
+ * @ORM\Id
+ * @ORM\GeneratedValue
+ * @ORM\Column(name="ID", type="integer", unique=true, nullable=false)
+ */
+ protected $id;
+
+ /**
+ * @ORM\Column(name="Created", type="datetime")
+ */
+ protected $created;
+
+ /**
+ * @ORM\Column(name="LastEdited", type="datetime")
+ */
+ protected $last_edited;
+
+ /**
+ * @return int
+ */
public function getIdentifier()
{
- return (int)$this->ID;
+ return (int)$this->id;
}
+
+ public function getId(){
+ return $this->getIdentifier();
+ }
+
+ public function __construct()
+ {
+
+ $now = new \DateTime('now', new \DateTimeZone(self::DefaultTimeZone));
+ $this->created = $now;
+ $this->last_edited = $now;
+ }
+
+ /**
+ * @return QueryBuilder
+ */
+ protected function createQueryBuilder(){
+ return Registry::getManager(self::EntityManager)->createQueryBuilder();
+ }
+
+ /**
+ * @param string $dql
+ * @return Query
+ */
+ protected function createQuery($dql){
+ return Registry::getManager(self::EntityManager)->createQuery($dql);
+ }
+
+ /**
+ * @param string $sql
+ * @return mixed
+ */
+ protected function prepareRawSQL($sql){
+
+ return Registry::getManager(self::EntityManager)->getConnection()->prepare($sql);
+ }
+
+ const EntityManager = 'ss';
}
\ No newline at end of file
diff --git a/app/Models/main/Member.php b/app/Models/main/Member.php
deleted file mode 100644
index b3d8eae4..00000000
--- a/app/Models/main/Member.php
+++ /dev/null
@@ -1,38 +0,0 @@
- 'id:json_int',
- 'FirstName' => 'first_name:json_string',
- 'Surname' => 'last_name:json_string',
- 'Email' => 'email:datetime_epoch',
- );
-
- /**
- * @return Image
- */
- public function photo()
- {
- return $this->hasOne('models\main\Image', 'ID', 'PhotoID')->first();
- }
-}
\ No newline at end of file
diff --git a/app/Models/summit/Presentation.php b/app/Models/summit/Presentation.php
deleted file mode 100644
index 179d32e0..00000000
--- a/app/Models/summit/Presentation.php
+++ /dev/null
@@ -1,199 +0,0 @@
- 'id:json_int',
- 'Title' => 'title:json_string',
- 'Description' => 'description:json_string',
- 'StartDate' => 'start_date:datetime_epoch',
- 'EndDate' => 'end_date:datetime_epoch',
- 'LocationID' => 'location_id:json_int',
- 'SummitID' => 'summit_id:json_int',
- 'TypeID' => 'type_id:json_int',
- 'ClassName' => 'class_name',
- 'CategoryID' => 'track_id:json_int',
- 'ModeratorID' => 'moderator_speaker_id:json_int',
- 'Level' => 'level',
- 'AllowFeedBack' => 'allow_feedback:json_boolean',
- 'AvgFeedbackRate' => 'avg_feedback_rate:json_float',
- 'Published' => 'is_published:json_boolean',
- 'HeadCount' => 'head_count:json_int',
- 'RSVPLink' => 'rsvp_link:json_string',
- );
-
- public static $allowed_fields = array
- (
- 'id',
- 'title',
- 'description',
- 'start_date',
- 'end_date',
- 'location_id',
- 'summit_id',
- 'type_id',
- 'class_name',
- 'track_id',
- 'moderator_speaker_id',
- 'level',
- 'allow_feedback',
- 'avg_feedback_rate',
- 'is_published',
- 'head_count',
- 'rsvp_link',
- );
-
- public static $allowed_relations = array
- (
- 'summit_types',
- 'sponsors',
- 'tags',
- 'slides',
- 'videos',
- 'speakers',
- );
-
-
- /**
- * @param array $fields
- * @return PresentationSpeaker[]
- */
- public function speakers(array $fields = array('*'))
- {
- return $this->belongsToMany('models\summit\PresentationSpeaker','Presentation_Speakers','PresentationID','PresentationSpeakerID')->get($fields);
- }
-
- public function getSpeakerIds()
- {
- $ids = array();
-
- foreach($this->speakers(array('PresentationSpeaker.ID')) as $speaker)
- {
- array_push($ids, intval($speaker->ID));
- }
-
- return $ids;
- }
-
- public function setFromSpeaker()
- {
- $this->from_speaker = true;
- }
-
- /**
- * @param array $fields
- * @param array $relations
- * @return array
- */
- public function toArray(array $fields = array(), array $relations = array())
- {
- if(!count($fields)) $fields = self::$allowed_fields;
- if(!count($relations)) $relations = self::$allowed_relations;
-
- $values = parent::toArray($fields, $relations);
-
- if(in_array('speakers', $relations)) {
- if (!$this->from_speaker)
- $values['speakers'] = $this->getSpeakerIds();
- }
-
- if(in_array('slides', $relations))
- {
- $slides = array();
- foreach ($this->slides() as $s) {
- array_push($slides, $s->toArray());
- }
- $values['slides'] = $slides;
- }
-
- if(in_array('videos', $relations))
- {
- $videos = array();
- foreach ($this->videos() as $v) {
- array_push($videos, $v->toArray());
- }
- $values['videos'] = $videos;
- }
-
- return $values;
- }
- /**
- * @return PresentationVideo[]
- */
- public function videos()
- {
- $bindings = array('presentation_id' => $this->ID);
- $rows = DB::connection('ss')->select("select * from `PresentationVideo` left join `PresentationMaterial` on `PresentationVideo`.`ID` = `PresentationMaterial`.`ID`
-where `PresentationMaterial`.`PresentationID` = :presentation_id and `PresentationMaterial`.`PresentationID` is not null", $bindings);
-
- $videos = array();
- foreach($rows as $row)
- {
- $instance = new PresentationVideo;
- $instance->setRawAttributes((array)$row, true);
- array_push($videos, $instance);
- }
- return $videos;
- }
-
- /**
- * @return PresentationSlide[]
- */
- public function slides()
- {
- $bindings = array('presentation_id' => $this->ID);
- $rows = DB::connection('ss')->select("select * from `PresentationSlide` left join `PresentationMaterial` on `PresentationSlide`.`ID` = `PresentationMaterial`.`ID`
-where `PresentationMaterial`.`PresentationID` = :presentation_id and `PresentationMaterial`.`PresentationID` is not null", $bindings);
-
- $slides = array();
- foreach($rows as $row)
- {
- $instance = new PresentationSlide;
- $instance->setRawAttributes((array)$row, true);
- array_push($slides, $instance);
- }
- return $slides;
- }
-
- /**
- * @param SummitEvent $event
- * @return Presentation
- */
- public static function toPresentation(SummitEvent $event){
- $presentation = new Presentation();
- $attributes = $event->getAttributes();
- $presentation->setRawAttributes($attributes);
- return $presentation;
- }
-}
diff --git a/app/Models/summit/PresentationCategory.php b/app/Models/summit/PresentationCategory.php
deleted file mode 100644
index 2643eadf..00000000
--- a/app/Models/summit/PresentationCategory.php
+++ /dev/null
@@ -1,57 +0,0 @@
- 'id:json_int',
- 'Title' => 'name:json_string',
- );
-
-
- /**
- * @return PresentationCategoryGroup[]
- */
- public function groups()
- {
- return $this->belongsToMany('models\summit\PresentationCategoryGroup','PresentationCategoryGroup_Categories','PresentationCategoryID', 'PresentationCategoryGroupID')->get();
- }
-
- /**
- * @return array
- */
- public function toArray()
- {
- $values = parent::toArray();
- $groups = array();
- foreach($this->groups() as $g)
- {
- array_push($groups, intval($g->ID));
- }
- $values['track_groups'] = $groups;
- return $values;
- }
-}
\ No newline at end of file
diff --git a/app/Models/summit/PresentationMaterial.php b/app/Models/summit/PresentationMaterial.php
deleted file mode 100644
index ad6db3ed..00000000
--- a/app/Models/summit/PresentationMaterial.php
+++ /dev/null
@@ -1,41 +0,0 @@
- 'id:json_int',
- 'Name' => 'name:json_text',
- 'Description' => 'description:json_text',
- 'DisplayOnSite' => 'display_on_site:json_boolean',
- 'Featured' => 'featured:json_boolean',
- 'PresentationID' => 'presentation_id:json_int',
- );
-
-}
\ No newline at end of file
diff --git a/app/Models/summit/PresentationSlide.php b/app/Models/summit/PresentationSlide.php
deleted file mode 100644
index 11614f46..00000000
--- a/app/Models/summit/PresentationSlide.php
+++ /dev/null
@@ -1,59 +0,0 @@
- 'id:json_int',
- 'Name' => 'name:json_text',
- 'Description' => 'description:json_text',
- 'DisplayOnSite' => 'display_on_site:json_boolean',
- 'Featured' => 'featured:json_boolean',
- 'PresentationID' => 'presentation_id:json_int',
- 'Link' => 'link:json_text',
- );
-
- /**
- * @return Image
- */
- public function slide()
- {
- return $this->hasOne('models\main\Image', 'ID', 'SlideID')->first();
- }
-
- public function toArray()
- {
- $values = parent::toArray();
- $slide = $this->slide();
- if(!is_null($slide))
- {
- $values['link'] = Config::get("server.assets_base_url", 'https://www.openstack.org/'). $slide->Filename;
- }
- return $values;
- }
-}
\ No newline at end of file
diff --git a/app/Models/summit/PresentationSpeaker.php b/app/Models/summit/PresentationSpeaker.php
deleted file mode 100644
index 6065044f..00000000
--- a/app/Models/summit/PresentationSpeaker.php
+++ /dev/null
@@ -1,122 +0,0 @@
- 'id:json_int',
- 'FirstName' => 'first_name:json_string',
- 'LastName' => 'last_name:json_string',
- 'Title' => 'title:json_string',
- 'Bio' => 'bio:json_string',
- 'IRCHandle' => 'irc:json_string',
- 'TwitterName' => 'twitter:json_string',
- 'MemberID' => 'member_id:json_int',
- );
-
- /**
- * @param null|int $summit_id
- * @param bool|true $published_ones
- * @param array $fields
- * @return Presentation[]
- */
- public function presentations($summit_id = null, $published_ones = true, array $fields = array('*'))
- {
- if (is_null($summit_id))
- $summit_id = Summit::where('Active', '=', 1)->first()->ID;
-
- $presentations = $this
- ->belongsToMany('models\summit\Presentation', 'Presentation_Speakers', 'PresentationSpeakerID', 'PresentationID')
- ->where('SummitEvent.SummitID', '=', $summit_id);
-
- if ($published_ones) {
- $presentations = $presentations->where('SummitEvent.Published', '=', 1);
- }
-
- return $presentations->get($fields);
- }
-
- /**
- * @param null $summit_id
- * @param bool|true $published_ones
- * @return array
- */
- public function getPresentationIds($summit_id = null, $published_ones = true)
- {
- $ids = array();
- foreach ($this->presentations($summit_id, $published_ones, array('SummitEvent.ID', 'SummitEvent.ClassName')) as $p) {
- array_push($ids, intval($p->ID));
- }
- return $ids;
- }
-
- /**
- * @return Image
- */
- public function photo()
- {
- return $this->hasOne('models\main\Image', 'ID', 'PhotoID')->first();
- }
-
- /**
- * @return Member
- */
- public function member()
- {
- return $this->hasOne('models\main\Member', 'ID', 'MemberID')->first();
- }
-
- /**
- * @param null $summit_id
- * @param bool|true $published_ones
- * @return array
- */
- public function toArray($summit_id = null, $published_ones = true)
- {
- $values = parent::toArray();
- $values['presentations'] = $this->getPresentationIds($summit_id, $published_ones);
- $member = $this->member();
- $values['pic'] = Config::get("server.assets_base_url", 'https://www.openstack.org/') . 'profile_images/speakers/' . $this->ID;
- if (!is_null($member)) {
- $values['gender'] = $member->Gender;
- }
- return $values;
- }
-
-
- /**
- * @param int $presentation_id
- * @return Presentation
- */
- public function getPresentation($presentation_id)
- {
- return $this->belongsToMany('models\summit\Presentation', 'Presentation_Speakers', 'PresentationSpeakerID', 'PresentationID')
- ->where('PresentationID', '=', $presentation_id)
- ->first();
- }
-}
\ No newline at end of file
diff --git a/app/Models/summit/Summit.php b/app/Models/summit/Summit.php
deleted file mode 100644
index 3a269a71..00000000
--- a/app/Models/summit/Summit.php
+++ /dev/null
@@ -1,593 +0,0 @@
- 'id:json_int',
- 'Name' => 'name:json_string',
- 'SummitBeginDate' => 'start_date:datetime_epoch',
- 'SummitEndDate' => 'end_date:datetime_epoch',
- 'StartShowingVenuesDate' => 'start_showing_venues_date:datetime_epoch',
- 'Active' => 'active:json_boolean',
- );
-
- protected $hidden = array
- (
-
- );
-
- /**
- * @return SummitAbstractLocation[]
- */
- public function locations()
- {
- $res = $this->hasMany('models\summit\SummitAbstractLocation', 'SummitID', 'ID')->get();
- $locations = array();
- foreach($res as $l)
- {
-
- $class = 'models\\summit\\'.$l->ClassName;
- $entity = $class::find($l->ID);
- if(is_null($entity)) continue;
- array_push($locations, $entity);
- }
- return $locations;
- }
-
- /**
- * @return Image
- */
- public function logo()
- {
- return $this->hasOne('models\main\Image', 'ID', 'LogoID')->first();
- }
-
- /**
- * @param int $location_id
- * @return SummitAbstractLocation
- */
- public function getLocation($location_id)
- {
- $location = $this->hasMany('models\summit\SummitAbstractLocation', 'SummitID', 'ID')->where('SummitAbstractLocation.ID', '=', $location_id)->get()->first();
- if(!is_null($location))
- {
- $class = 'models\\summit\\'.$location->ClassName;
- $location = $class::find($location->ID);
- }
- return $location;
- }
-
- /**
- * @return SummitEventType[]
- */
- public function event_types()
- {
- return $this->hasMany('models\summit\SummitEventType', 'SummitID', 'ID')->get();
- }
-
- /**
- * @param int $event_type_id
- * @return SummitEventType
- */
- public function getEventType($event_type_id)
- {
- return $this->hasMany('models\summit\SummitEventType', 'SummitID', 'ID')->where('ID','=', intval($event_type_id))->first();
- }
-
- /**
- * @return SummitType[]
- */
- public function summit_types()
- {
- return $this->hasMany('models\summit\SummitType', 'SummitID', 'ID')->get();
- }
-
- /**
- * @param int $summit_type_id
- * @return SummitType
- */
- public function getSummitType($summit_type_id)
- {
- return $this->hasMany('models\summit\SummitType', 'SummitID', 'ID')->where('ID','=', intval($summit_type_id))->first();
- }
-
- /**
- * @return SummitTicketType[]
- */
- public function ticket_types()
- {
- return $this->hasMany('models\summit\SummitTicketType', 'SummitID', 'ID')->get();
- }
-
- /**
- * @param int $page
- * @param int $per_page
- * @param Filter|null $filter
- * @param Order|null $order
- * @return array
- */
- public function attendees($page = 1, $per_page = 100, Filter $filter = null, Order $order = null)
- {
- $rel = $this->hasMany('models\summit\SummitAttendee', 'SummitID', 'ID')->join('Member', 'Member.ID', '=', 'SummitAttendee.MemberID');
-
- if(!is_null($filter))
- {
- $filter->apply2Relation($rel, array
- (
- 'first_name' => 'Member.FirstName',
- 'last_name' => 'Member.Surname',
- 'email' => 'Member.Email',
- ));
- }
-
- if(!is_null($order))
- {
- $order->apply2Relation($rel, array
- (
- 'first_name' => 'Member.FirstName',
- 'last_name' => 'Member.Surname',
- ));
- }
-
- $pagination_result = $rel->paginate($per_page);
- $total = $pagination_result->total();
- $items = $pagination_result->items();
- $per_page = $pagination_result->perPage();
- $current_page = $pagination_result->currentPage();
- $last_page = $pagination_result->lastPage();
-
- return array ($total,$per_page, $current_page, $last_page, $items);
- }
- /**
- * @param int $page
- * @param int $per_page
- * @param Filter|null $filter
- * @return array
- */
- public function schedule($page = 1, $per_page = 100, Filter $filter = null)
- {
- return $this->events($page, $per_page, $filter, true);
- }
-
- /**
- * @param int $page
- * @param int $per_page
- * @param Filter|null $filter
- * @param bool|false $published
- * @return array
- */
- public function events($page = 1, $per_page = 100, Filter $filter = null, $published = false)
- {
- $rel = $this
- ->hasMany('models\summit\SummitEvent', 'SummitID', 'ID')
- ->select
- (
- array
- (
- 'SummitEvent.*',
- 'Presentation.Priority',
- 'Presentation.Level',
- 'Presentation.Status',
- 'Presentation.OtherTopic',
- 'Presentation.Progress',
- 'Presentation.Slug',
- 'Presentation.CreatorID',
- 'Presentation.CategoryID',
- 'Presentation.Views',
- 'Presentation.ModeratorID',
- 'Presentation.ProblemAddressed',
- 'Presentation.AttendeesExpectedLearnt',
- 'Presentation.SelectionMotive',
- )
- );
-
- $rel = $rel->leftJoin('Presentation', 'SummitEvent.ID', '=', 'Presentation.ID');
- if($published)
- {
- $rel = $rel->where('Published','=','1');
- }
-
- if(!is_null($filter))
- {
- $filter->apply2Relation($rel, array
- (
- 'title' => 'SummitEvent.Title',
- 'start_date' => 'SummitEvent.StartDate:datetime_epoch',
- 'end_date' => 'SummitEvent.EndDate:datetime_epoch',
- 'tags' => new ExistsFilterManyManyMapping
- (
- 'Tag',
- 'SummitEvent_Tags',
- 'SummitEvent_Tags.TagID = Tag.ID',
- "SummitEvent_Tags.SummitEventID = SummitEvent.ID AND Tag.Tag :operator ':value'"
- ),
- 'summit_type_id'=> new ExistsFilterManyManyMapping
- (
- 'SummitType',
- 'SummitEvent_AllowedSummitTypes',
- 'SummitType.ID = SummitEvent_AllowedSummitTypes.SummitTypeID',
- 'SummitEvent_AllowedSummitTypes.SummitEventID = SummitEvent.ID AND SummitType.ID :operator :value'
- ),
- 'event_type_id' => new ExistsFilterManyToOneMapping
- (
- 'SummitEventType',
- 'SummitEventType.ID = SummitEvent.TypeID AND SummitEventType.ID :operator :value'
- ),
- ));
- }
-
- $rel = $rel->orderBy('StartDate','asc')->orderBy('EndDate','asc');
-
- $pagination_result = $rel->paginate($per_page);
- $total = $pagination_result->total();
- $items = $pagination_result->items();
- $per_page = $pagination_result->perPage();
- $current_page = $pagination_result->currentPage();
- $last_page = $pagination_result->lastPage();
- $events = array();
- foreach($items as $e)
- {
- if($e->ClassName === 'Presentation')
- $e = Presentation::toPresentation($e);
- array_push($events, $e);
- }
- return array($total,$per_page, $current_page, $last_page, $events);
- }
-
- /**
- * @param int $member_id
- * @return SummitAttendee
- */
- public function getAttendeeByMemberId($member_id)
- {
- return $this->hasMany('models\summit\SummitAttendee', 'SummitID', 'ID')->where('MemberID','=',$member_id)->first();
- }
-
- /**
- * @param int $attendee_id
- * @return SummitAttendee
- */
- public function getAttendeeById($attendee_id)
- {
- return $this->hasMany('models\summit\SummitAttendee', 'SummitID', 'ID')->where('SummitAttendee.ID','=',$attendee_id)->first();
- }
-
- /**
- * @param int $event_id
- * @return null|SummitEvent
- */
- public function getScheduleEvent($event_id)
- {
- $e = $this->hasMany('models\summit\SummitEvent', 'SummitID', 'ID')
- ->where('SummitEvent.ID','=', intval($event_id))
- ->where('Published','=','1')
- ->first();
- if(is_null($e)) return null;
- $class = 'models\\summit\\'.$e->ClassName;
- return $class::find($e->ID);
- }
-
- /**
- * @param int $event_id
- * @return null|SummitEvent
- */
- public function getEvent($event_id)
- {
- $e = $this->hasMany('models\summit\SummitEvent', 'SummitID', 'ID')
- ->where('SummitEvent.ID','=', intval($event_id))
- ->first();
- if(is_null($e)) return null;
- $class = 'models\\summit\\'.$e->ClassName;
- return $class::find($e->ID);
- }
-
- /**
- * @return PresentationCategory[]
- */
- public function presentation_categories()
- {
- return $this->hasMany('models\summit\PresentationCategory', 'SummitID', 'ID')->get();
- }
-
- /**
- * @return PresentationCategoryGroup[]
- */
- public function category_groups()
- {
- return $this->hasMany('models\summit\PresentationCategoryGroup', 'SummitID', 'ID')->get();
- }
-
-
- /**
- * @param int $group_id
- * @return null|PresentationCategoryGroup
- */
- public function getCategoryGroup($group_id)
- {
- return $this->hasMany('models\summit\PresentationCategoryGroup', 'SummitID', 'ID')
- ->where('PresentationCategoryGroup.ID','=', intval($group_id))
- ->first();
- }
-
- public function sponsors()
- {
- $summit_id = $this->ID;
- $rows = DB::connection('ss')->select("SELECT DISTINCT C.* FROM SummitEvent_Sponsors S
-INNER JOIN SummitEvent E ON E.ID = S.SummitEventID AND E.SummitID = {$summit_id}
-INNER JOIN Company C ON C.ID = S.CompanyID");
-
- $sponsors = array();
- foreach($rows as $row)
- {
- $instance = new Company;
- $instance->setRawAttributes((array)$row, true);
- array_push($sponsors, $instance);
- }
- return $sponsors;
- }
-
- /**
- * @param int $speaker_id
- * @return null|PresentationSpeaker
- */
- public function getSpeakerById($speaker_id)
- {
- return PresentationSpeaker::where('PresentationSpeaker.ID','=', intval($speaker_id))
- ->whereRaw(" EXISTS (
- SELECT 1 FROM Presentation_Speakers INNER JOIN SummitEvent
- ON
- SummitEvent.ID = Presentation_Speakers.PresentationID
- WHERE
- Presentation_Speakers.PresentationSpeakerID = PresentationSpeaker.ID
- AND SummitEvent.SummitID = {$this->ID}) ")
- ->first();
- }
-
- /**
- * @param int $member_id
- * @return null|PresentationSpeaker
- */
- public function getSpeakerByMemberId($member_id)
- {
-
- return PresentationSpeaker::where('PresentationSpeaker.MemberID','=', intval($member_id))
- ->whereRaw(" EXISTS (
- SELECT 1 FROM Presentation_Speakers INNER JOIN SummitEvent
- ON
- SummitEvent.ID = Presentation_Speakers.PresentationID
- WHERE
- Presentation_Speakers.PresentationSpeakerID = PresentationSpeaker.ID
- AND SummitEvent.SummitID = {$this->ID}) ")
- ->first();
- }
-
- /**
- * @param int|null $member_id
- * @param int|null $from_id
- * @param \DateTime|null $from_date
- * @param int $limit
- * @return SummitEntityEvent[]
- */
- public function getEntityEvents($member_id = null, $from_id = null, \DateTime $from_date = null, $limit = 25)
- {
- $filters = '';
- if(!is_null($from_id))
- {
- $filters .= " AND SummitEntityEvent.ID > {$from_id} ";
- }
- if(!is_null($from_date))
- {
- $str_date = $from_date->format("Y-m-d H:i:s");
- $filters .= " AND SummitEntityEvent.Created >= '{$str_date}' ";
- }
-
- $query = << 'MySchedule' AND EntityClassName <> 'SummitAttendee')
- -- GLOBAL TRUNCATE
- OR (EntityClassName = 'WipeData' AND EntityID = 0)
- )
- AND SummitID = {$this->ID}
- {$filters}
- LIMIT {$limit}
-)
-AS GLOBAL_EVENTS
-SQL;
-
- if(!is_null($member_id)){
- $query .= <<ID}
- {$filters}
- LIMIT {$limit}
-)
-AS MY_SCHEDULE
-UNION
-SELECT * FROM
-(
- SELECT * FROM SummitEntityEvent
- WHERE
- (
- EntityClassName = 'WipeData' AND EntityID = {$member_id}
- )
- AND SummitID = {$this->ID}
- {$filters}
- LIMIT {$limit}
-) AS USER_WIPE_DATA
-SQL;
- }
-
- $query .= <<select($query);
- $items = array();
- foreach($rows as $row)
- {
- $instance = new SummitEntityEvent();
- $instance->setRawAttributes((array)$row, true);
- array_push($items, $instance);
- }
- return $items;
- }
-
- /**
- * @return int
- */
- public function getLastEntityEventId(){
- $query = <<ID} ORDER BY ID DESC LIMIT 1;
-SQL;
-
- $last_id = DB::connection('ss')->select($query);
- $last_id = intval($last_id[0]->ID);
- return $last_id;
- }
-
- public function toArray()
- {
- $values = parent::toArray();
- $time_zone_list = timezone_identifiers_list();
- $time_zone_id = $this->TimeZone;
- $values['time_zone'] = null;
- if(!empty($time_zone_id) && isset($time_zone_list[$time_zone_id]))
- {
-
- $time_zone_name = $time_zone_list[$time_zone_id];
- $time_zone = new \DateTimeZone($time_zone_name);
- $time_zone_info = $time_zone->getLocation();
- $time_zone_info['name'] = $time_zone->getName();
- $now = new \DateTime("now", $time_zone);
- $time_zone_info['offset'] = $time_zone->getOffset($now);
- $values['time_zone'] = $time_zone_info;
- }
- $values['logo'] = ($this->logo() !== null) ? Config::get("server.assets_base_url", 'https://www.openstack.org/'). $this->logo()->Filename : null;
- if(empty($values['name']))
- {
- $values['name'] = $this->Title;
- }
- return $values;
- }
-
-
- /**
- * @param $value
- * @return null|string
- */
- public function convertDateFromTimeZone2UTC($value)
- {
- $time_zone_id = $this->TimeZone;
- if(empty($time_zone_id)) return $value;
- $time_zone_list = timezone_identifiers_list();
-
- if(isset($time_zone_list[$time_zone_id]) && !empty($value))
- {
- $utc_timezone = new \DateTimeZone("UTC");
- $time_zone_name = $time_zone_list[$time_zone_id];
- $time_zone = new \DateTimeZone($time_zone_name);
- $date = new \DateTime($value, $time_zone);
- $date->setTimezone($utc_timezone);
- return $date->format("Y-m-d H:i:s");
- }
- return null;
- }
-
- /**
- * @param $value
- * @return null|string
- */
- public function convertDateFromUTC2TimeZone($value)
- {
- $time_zone_id = $this->TimeZone;
- if(empty($time_zone_id)) return $value;
- $time_zone_list = timezone_identifiers_list();
-
- if(isset($time_zone_list[$time_zone_id]) && !empty($value))
- {
- $utc_timezone = new \DateTimeZone("UTC");
- $time_zone_name = $time_zone_list[$time_zone_id];
- $time_zone = new \DateTimeZone($time_zone_name);
- $date = new \DateTime($value, $utc_timezone);
-
- $date->setTimezone($time_zone);
- return $date->format("Y-m-d H:i:s");
- }
- return null;
- }
-
- /**
- * @param SummitEvent $summit_event
- * @return bool
- */
- public function isEventInsideSummitDuration(SummitEvent $summit_event)
- {
- $event_start_date = $summit_event->StartDate;
- $event_end_date = $summit_event->EndDate;
- $summit_start_date = new \DateTime($this->convertDateFromUTC2TimeZone($this->SummitBeginDate));
- $summit_end_date = new \DateTime($this->convertDateFromUTC2TimeZone($this->SummitEndDate));
-
- return $event_start_date >= $summit_start_date && $event_start_date <= $summit_end_date &&
- $event_end_date <= $summit_end_date && $event_end_date >= $event_start_date;
- }
-
- /**
- * @return \DateTime
- */
- public function getLocalBeginDate()
- {
- return new \DateTime($this->convertDateFromUTC2TimeZone($this->SummitBeginDate));
- }
-
- /**
- * @return \DateTime
- */
- public function getLocalEndDate()
- {
- return new \DateTime($this->convertDateFromUTC2TimeZone($this->SummitEndDate));
- }
-
-}
\ No newline at end of file
diff --git a/app/Models/summit/SummitAbstractLocation.php b/app/Models/summit/SummitAbstractLocation.php
deleted file mode 100644
index c33a9e42..00000000
--- a/app/Models/summit/SummitAbstractLocation.php
+++ /dev/null
@@ -1,152 +0,0 @@
- 'id:json_int',
- 'Name' => 'name:json_string',
- 'Description' => 'description:json_string',
- 'ClassName' => 'class_name',
- 'LocationType' => 'location_type',
- );
-
- /**
- * @return int
- */
- public function getIdentifier()
- {
- return (int)$this->ID;
- }
-
- /**
- * @param int $page
- * @param int $per_page
- * @param Filter|null $filter
- * @param bool|false $published
- * @return array
- */
- public function events($page = 1, $per_page = 100, Filter $filter = null, $published = false)
- {
- $rel = $this
- ->hasMany('models\summit\SummitEvent', 'LocationID', 'ID')
- ->select
- (
- array
- (
- 'SummitEvent.*',
- 'Presentation.Priority',
- 'Presentation.Level',
- 'Presentation.Status',
- 'Presentation.OtherTopic',
- 'Presentation.Progress',
- 'Presentation.Slug',
- 'Presentation.CreatorID',
- 'Presentation.CategoryID',
- 'Presentation.Views',
- 'Presentation.ModeratorID',
- 'Presentation.ProblemAddressed',
- 'Presentation.AttendeesExpectedLearnt',
- 'Presentation.SelectionMotive',
- )
- );
-
- $rel = $rel->leftJoin('Presentation', 'SummitEvent.ID', '=', 'Presentation.ID');
-
- if($published)
- {
- $rel = $rel->where('Published','=','1');
- }
-
- if(!is_null($filter))
- {
- $filter->apply2Relation($rel, array
- (
- 'title' => 'SummitEvent.Title',
- 'start_date' => 'SummitEvent.StartDate:datetime_epoch',
- 'end_date' => 'SummitEvent.EndDate:datetime_epoch',
- 'tags' => new ExistsFilterManyManyMapping
- (
- 'Tag',
- 'SummitEvent_Tags',
- 'SummitEvent_Tags.TagID = Tag.ID',
- "SummitEvent_Tags.SummitEventID = SummitEvent.ID AND Tag.Tag :operator ':value'"
- ),
- 'summit_type_id' => new ExistsFilterManyManyMapping
- (
- 'SummitType',
- 'SummitEvent_AllowedSummitTypes',
- 'SummitType.ID = SummitEvent_AllowedSummitTypes.SummitTypeID',
- 'SummitEvent_AllowedSummitTypes.SummitEventID = SummitEvent.ID AND SummitType.ID :operator :value'
- ),
- 'event_type_id' => new ExistsFilterManyToOneMapping
- (
- 'SummitEventType',
- 'SummitEventType.ID = SummitEvent.TypeID AND SummitEventType.ID :operator :value'
- ),
- 'track_id' => new ExistsFilterManyToOneMapping
- (
- 'PresentationCategory',
- 'PresentationCategory.ID = Presentation.CategoryID AND PresentationCategory.ID :operator :value'
- ),
- 'speaker' => new ExistsFilterManyManyMapping
- (
- 'PresentationSpeaker',
- 'Presentation_Speakers',
- 'Presentation_Speakers.PresentationSpeakerID = PresentationSpeaker.ID',
- "Presentation_Speakers.PresentationID = SummitEvent.ID AND CONCAT(FirstName, ' ' , LastName) :operator ':value'"
- ),
- ));
- }
-
- $rel = $rel->orderBy('StartDate','asc')->orderBy('EndDate','asc');
-
- $pagination_result = $rel->paginate($per_page);
- $total = $pagination_result->total();
- $items = $pagination_result->items();
- $per_page = $pagination_result->perPage();
- $current_page = $pagination_result->currentPage();
- $last_page = $pagination_result->lastPage();
- $events = array();
-
- foreach($items as $e)
- {
- if($e->ClassName === 'Presentation')
- $e = Presentation::toPresentation($e);
- array_push($events, $e);
- }
- return array($total,$per_page, $current_page, $last_page, $events);
- }
-
-
-}
\ No newline at end of file
diff --git a/app/Models/summit/SummitAttendee.php b/app/Models/summit/SummitAttendee.php
deleted file mode 100644
index a71bc537..00000000
--- a/app/Models/summit/SummitAttendee.php
+++ /dev/null
@@ -1,186 +0,0 @@
- 'id:json_int',
- 'SummitHallCheckedIn' => 'summit_hall_checked_in:json_boolean',
- 'SummitHallCheckedInDate' => 'summit_hall_checked_in_date:datetime_epoch',
- 'SharedContactInfo' => 'shared_contact_info:json_boolean',
- 'MemberID' => 'member_id:json_int',
- );
-
- /**
- * @return SummitEvent[]
- */
- public function schedule()
- {
- $res = $this->belongsToMany
- (
- 'models\summit\SummitEvent',
- 'SummitAttendee_Schedule',
- 'SummitAttendeeID',
- 'SummitEventID'
- )->withPivot('IsCheckedIn')->get();
-
- $events = array();
-
- foreach($res as $e)
- {
- $class = 'models\\summit\\'.$e->ClassName;
- $entity = $class::find($e->ID);
- if(is_null($entity)) continue;
- if(!$entity->isPublished()) continue;
- $entity->attributes['IsCheckedIn'] = $e->pivot->IsCheckedIn;
- array_push($events, $entity);
- }
- return $events;
- }
-
- /**
- * @return SummitEventFeedback[]
- */
- public function emitted_feedback(){
- return SummitEventFeedback::where('OwnerID', '=', $this->MemberID)->orderBy('ID','asc')->get();
- }
-
- /**
- * @return int[]
- */
- public function getScheduleIds()
- {
- $ids = array();
- foreach($this->schedule() as $e)
- array_push($ids, intval($e->ID));
- return $ids;
- }
-
- public function add2Schedule(SummitEvent $event)
- {
- if($this->isOnSchedule($event)) throw new ValidationException(sprintf('Event %s already belongs to attendee %s schedule.', $event->ID, $this->ID));
- $this->belongsToMany
- (
- 'models\summit\SummitEvent',
- 'SummitAttendee_Schedule',
- 'SummitAttendeeID',
- 'SummitEventID'
- )->attach($event->ID,['IsCheckedIn' => false] );
- return true;
- }
-
- public function removeFromSchedule(SummitEvent $event)
- {
- if(!$this->isOnSchedule($event)) throw new ValidationException(sprintf('Event %s does not belongs to attendee %s schedule.', $event->ID, $this->ID));
- $this->belongsToMany
- (
- 'models\summit\SummitEvent',
- 'SummitAttendee_Schedule',
- 'SummitAttendeeID',
- 'SummitEventID'
- )->detach($event->ID);
- return true;
- }
-
- public function isOnSchedule(SummitEvent $event)
- {
- return $this->belongsToMany
- (
- 'models\summit\SummitEvent',
- 'SummitAttendee_Schedule',
- 'SummitAttendeeID',
- 'SummitEventID'
- )->where('SummitEventID', '=', $event->ID)->count() > 0;
- }
-
- public function checkIn(SummitEvent $event)
- {
- if(!$this->isOnSchedule($event)) throw new ValidationException(sprintf('Event %s does not belongs to attendee %s schedule.', $event->ID, $this->ID));
- $this->belongsToMany
- (
- 'models\summit\SummitEvent',
- 'SummitAttendee_Schedule',
- 'SummitAttendeeID',
- 'SummitEventID'
- )->withPivot('IsCheckedIn')->updateExistingPivot($event->ID, ['IsCheckedIn' => true]);
- return true;
- }
-
- /**
- * @return Member
- */
- public function member()
- {
- return $this->hasOne('models\main\Member', 'ID', 'MemberID')->first();
- }
-
- /**
- * @return SummitAttendeeTicket[]
- */
- public function tickets()
- {
- return $this->hasMany('models\summit\SummitAttendeeTicket', 'OwnerID', 'ID')->get();
- }
-
- public function toArray()
- {
- $values = parent::toArray();
- $member = $this->member();
- $values['schedule'] = $this->getScheduleIds();
-
- $tickets = array();
- foreach($this->tickets() as $t)
- {
- if(is_null($t->ticket_type())) continue;
- array_push($tickets, intval($t->ticket_type()->ID));
- }
- $values['tickets'] = $tickets;
-
- if(!is_null($member))
- {
- $values['first_name'] = JsonUtils::toJsonString($member->FirstName);
- $values['last_name'] = JsonUtils::toJsonString($member->Surname);
- $values['gender'] = $member->Gender;
- $values['bio'] = JsonUtils::toJsonString($member->Bio);
- $values['pic'] = Config::get("server.assets_base_url", 'https://www.openstack.org/'). 'profile_images/members/'. $member->ID;
- $values['linked_in'] = $member->LinkedInProfile;
- $values['irc'] = $member->IRCHandle;
- $values['twitter'] = $member->TwitterName;
- }
- return $values;
- }
-
- /**
- * @return Summit
- */
- public function getSummit()
- {
- return $this->hasOne('models\summit\Summit', 'ID', 'SummitID')->first();
- }
-
-}
\ No newline at end of file
diff --git a/app/Models/summit/SummitAttendeeTicket.php b/app/Models/summit/SummitAttendeeTicket.php
deleted file mode 100644
index 656db363..00000000
--- a/app/Models/summit/SummitAttendeeTicket.php
+++ /dev/null
@@ -1,61 +0,0 @@
- 'id:json_int',
- 'ExternalOrderId' => 'external_order_id:json_int',
- 'ExternalAttendeeId' => 'external_attendee_id:json_int',
- 'TicketBoughtDate' => 'bought_date:datetime_epoch',
- );
-
-
- /**
- * @return SummitTicketType
- */
- public function ticket_type()
- {
- return $this->hasOne('models\summit\SummitTicketType', 'ID', 'TicketTypeID')->first();
- }
-
- /**
- * @return SummitAttendee
- */
- public function owner()
- {
- return $this->hasOne('models\summit\SummitAttendee', 'ID', 'SummitAttendeeID')->first();
- }
-
- /**
- * @return array
- */
- public function toArray()
- {
- $values = parent::toArray();
- $values['ticket_type_id'] = intval($this->ticket_type()->ID);
- return $values;
- }
-}
\ No newline at end of file
diff --git a/app/Models/summit/SummitEntityEvent.php b/app/Models/summit/SummitEntityEvent.php
deleted file mode 100644
index c5d21863..00000000
--- a/app/Models/summit/SummitEntityEvent.php
+++ /dev/null
@@ -1,36 +0,0 @@
- 'id:json_int',
- 'EntityID' => 'entity_id:json_int',
- 'EntityClassName' => 'entity_class:json_string',
- 'Created' => 'created:datetime_epoch',
- 'Type' => 'type',
- );
-
-}
\ No newline at end of file
diff --git a/app/Models/summit/SummitEvent.php b/app/Models/summit/SummitEvent.php
deleted file mode 100644
index 49192209..00000000
--- a/app/Models/summit/SummitEvent.php
+++ /dev/null
@@ -1,518 +0,0 @@
- 'id:json_int',
- 'Title' => 'title:json_string',
- 'Description' => 'description:json_string',
- 'StartDate' => 'start_date:datetime_epoch',
- 'EndDate' => 'end_date:datetime_epoch',
- 'LocationID' => 'location_id:json_int',
- 'SummitID' => 'summit_id:json_int',
- 'TypeID' => 'type_id:json_int',
- 'ClassName' => 'class_name',
- 'AllowFeedBack' => 'allow_feedback:json_boolean',
- 'AvgFeedbackRate' => 'avg_feedback_rate:json_float',
- 'Published' => 'is_published:json_boolean',
- 'HeadCount' => 'head_count:json_int',
- 'RSVPLink' => 'rsvp_link:json_string',
- );
-
- public static $allowed_fields = array
- (
- 'id',
- 'title',
- 'description',
- 'start_date',
- 'end_date',
- 'location_id',
- 'summit_id',
- 'type_id',
- 'class_name',
- 'allow_feedback',
- 'avg_feedback_rate',
- 'is_published',
- 'head_count',
- 'rsvp_link',
- );
-
- public static $allowed_relations = array
- (
- 'summit_types',
- 'sponsors',
- 'tags',
- );
-
- /**
- * @param string $title
- * @return $this
- */
- public function setTitle($title)
- {
- $this->Title = $title;
- return $this;
- }
-
- /**
- * @param string $description
- * @return $this
- */
- public function setDescription($description)
- {
- $this->Description = $description;
- return $this;
- }
-
- /**
- * @param \DateTime $value
- * @return $this
- */
- public function setStartDateAttribute(\DateTime $value)
- {
- $summit = $this->getSummit();
- if(!is_null($summit))
- {
- $value = new \DateTime($summit->convertDateFromTimeZone2UTC($value->format('Y-m-d H:i:s')));
- }
- $this->attributes['StartDate'] = $value->format('Y-m-d H:i:s');
- return $this;
- }
-
- /**
- * @return \DateTime|null
- */
- public function getStartDateAttribute($value)
- {
- if(!empty($value)) {
- $res = new \DateTime($value);
- $summit = $this->getSummit();
- if(!is_null($summit))
- {
- $res = new \DateTime($summit->convertDateFromUTC2TimeZone($value));
- }
- return $res;
- }
- return null;
- }
-
- /**
- * @return \DateTime|null
- */
- public function getStartDateUTCAttribute($value)
- {
- $value = $this->attributes['StartDate'];
- if(!empty($value)) {
- return new \DateTime($value);
- }
- return null;
- }
-
- /**
- * @param \DateTime $value
- * @return $this
- */
- public function setEndDateAttribute(\DateTime $value)
- {
- $summit = $this->getSummit();
- if(!is_null($summit))
- {
- $value = new \DateTime($summit->convertDateFromTimeZone2UTC($value->format('Y-m-d H:i:s')));
- }
- $this->attributes['EndDate'] = $value->format('Y-m-d H:i:s');
- return $this;
- }
-
- /**
- * @return \DateTime|null
- */
- public function getEndDateAttribute($value)
- {
- if(!empty($value)) {
- $res = new \DateTime($value);
- $summit = $this->getSummit();
- if(!is_null($summit))
- {
- $res = new \DateTime($summit->convertDateFromUTC2TimeZone($value));
- }
- return $res;
- }
- return null;
- }
-
- /**
- * @return \DateTime|null
- */
- public function getEndDateUTCAttribute($value)
- {
- $value = $this->attributes['EndDate'];
- if(!empty($value)) {
- return new \DateTime($value);
- }
- return null;
- }
-
- /**
- * @param bool $allow_feeback
- * @return $this
- */
- public function setAllowFeedBack($allow_feeback)
- {
- $this->AllowFeedBack = $allow_feeback;
- return $this;
- }
-
- /**
- * @param SummitEventType $type
- * @return $this
- */
- public function setType(SummitEventType $type)
- {
- $this->TypeID = $type->ID;
- return $this;
- }
-
- /**
- * @param SummitAbstractLocation $location
- * @return $this
- */
- public function setLocation(SummitAbstractLocation $location)
- {
- $this->LocationID = $location->ID;
- return $this;
- }
-
- /**
- * @return SummitAbstractLocation
- */
- public function getLocation()
- {
- $location = $this->hasOne('models\summit\SummitAbstractLocation', 'ID', 'LocationID')->first();
- if(is_null($location)) return null;
- $class = 'models\\summit\\'.$location->ClassName;
- return $class::find($location->ID);
- }
-
- /**
- * @param Summit $summit
- * @return $this
- */
- public function setSummit(Summit $summit)
- {
- $this->SummitID = $summit->ID;
- return $this;
- }
-
- /**
- * @return array
- */
- public function getSummitTypesIds()
- {
- $ids = array();
- foreach($this->summit_types(array('SummitType.ID')) as $type)
- {
- array_push($ids, intval($type->ID));
- }
- return $ids;
- }
-
- /**
- * @return array
- */
- public function getSponsorsIds()
- {
- $ids = array();
- foreach($this->sponsors(array('Company.ID')) as $company)
- {
- array_push($ids, intval($company->ID));
- }
- return $ids;
- }
-
- /**
- * @param array $fields
- * @return SummitType[]
- */
- public function summit_types(array $fields = array('*'))
- {
- return $this->belongsToMany('models\summit\SummitType','SummitEvent_AllowedSummitTypes', 'SummitEventID','SummitTypeID')->get($fields);
- }
-
- /**
- * @param SummitType $summit_type
- */
- public function addSummitType(SummitType $summit_type)
- {
- $this->belongsToMany('models\summit\SummitType','SummitEvent_AllowedSummitTypes', 'SummitEventID','SummitTypeID')->attach($summit_type->ID);
- }
-
- public function clearSummitTypes()
- {
- $this->belongsToMany('models\summit\SummitType','SummitEvent_AllowedSummitTypes', 'SummitEventID','SummitTypeID')->detach();
- }
-
- /**
- * @param array $fields
- * @return Company[]
- */
- public function sponsors(array $fields = array('*'))
- {
- return $this->belongsToMany('models\main\Company','SummitEvent_Sponsors','SummitEventID', 'CompanyID')->get($fields);
- }
-
- /**
- * @return SummitEventType
- */
- public function getType()
- {
- return $this->hasOne('models\summit\SummitEventType', 'ID', 'TypeID')->first();
- }
-
- /**
- * @return Summit
- */
- public function getSummit()
- {
- return $this->hasOne('models\summit\Summit', 'ID', 'SummitID')->first();
- }
-
- /**
- * @return SummitAttendee[]
- */
- public function attendees()
- {
- return $this->belongsToMany('models\summit\SummitAttendee','SummitAttendee_Schedule','SummitEventID', 'SummitAttendeeID')
- ->where('IsCheckedIn','=',1)
- ->get();
- }
-
- /**
- * @param array $fields
- * @param array $relations
- * @return array
- */
- public function toArray(array $fields = array(), array $relations = array())
- {
- if(!count($fields)) $fields = self::$allowed_fields;
- if(!count($relations)) $relations = self::$allowed_relations;
-
- $values = parent::toArray();
- //check if description is empty, if so, set short description
- $description = $values['description'];
- if(empty($description))
- {
- $values['description'] = JsonUtils::toJsonString($this->ShortDescription);
- }
-
- //check requested fields
-
- foreach($values as $field => $value){
- if(in_array($field, $fields)) continue;
- unset($values[$field]);
- }
-
- if(in_array('summit_types', $relations))
- $values['summit_types'] = $this->getSummitTypesIds();
-
- if(in_array('sponsors', $relations))
- $values['sponsors'] = $this->getSponsorsIds();
-
- if(in_array('tags', $relations))
- {
- $tags = array();
- foreach ($this->tags() as $t) {
- array_push($tags, $t->toArray());
- }
- $values['tags'] = $tags;
- }
-
- return $values;
- }
-
- public function setFromAttendee()
- {
- $this->from_attendee = true;
- $this->array_mappings['IsCheckedIn'] = 'is_checked_in:json_boolean';
- }
-
- /**
- * @param int $page
- * @param int $per_page
- * @param Filter|null $filter
- * @param Order|null $order
- * @return array
- */
- public function feedback($page = 1, $per_page = 100, Filter $filter = null, Order $order = null)
- {
- $rel = $this->hasMany('models\summit\SummitEventFeedback', 'EventID', 'ID')->where('ClassName','=','SummitEventFeedback');
-
- if(!is_null($filter))
- {
- $filter->apply2Relation($rel, array
- (
- 'owner_id' => 'SummitEventFeedback.OwnerID',
- ));
- }
-
- if(!is_null($order))
- {
- $order->apply2Relation($rel, array
- (
- 'created_date' => 'SummitEventFeedback.Created',
- 'owner_id' => 'SummitEventFeedback.OwnerID',
- 'rate' => 'SummitEventFeedback.Rate',
- 'id' => 'SummitEventFeedback.ID',
- ));
- }
- else
- {
- //default order
- $rel = $rel->orderBy('SummitEventFeedback.Created', 'DESC');
- }
-
- $pagination_result = $rel->paginate($per_page);
- $total = $pagination_result->total();
- $items = $pagination_result->items();
- $per_page = $pagination_result->perPage();
- $current_page = $pagination_result->currentPage();
- $last_page = $pagination_result->lastPage();
-
- $feedback = array();
- foreach($items as $e)
- {
- array_push($feedback, $e);
- }
- return array($total,$per_page, $current_page, $last_page, $feedback);
- }
-
- public function addFeedBack(SummitEventFeedback $feedback)
- {
- $this->hasMany('models\summit\SummitEventFeedback', 'EventID', 'ID')->where('ClassName','=','SummitEventFeedback')->save($feedback);
- }
-
- /**
- * @return Tag[]
- */
- public function tags()
- {
- return $this->belongsToMany('models\main\Tag','SummitEvent_Tags','SummitEventID','TagID')
- ->select('Tag.ID','Tag.Tag')
- ->get();
- }
-
- /**
- * @param string $tag
- */
- public function addTag($tag)
- {
- $t = Tag::where('Tag','=', trim($tag))->first();
- if(is_null($t))
- {
- $t = new Tag;
- $t->Tag = trim($tag);
- $t->save();
- }
-
- $this->belongsToMany('models\main\Tag','SummitEvent_Tags','SummitEventID','TagID')->attach($t->ID);
- }
-
- public function clearTags()
- {
- $this->belongsToMany('models\main\Tag','SummitEvent_Tags','SummitEventID','TagID')->detach();
- }
-
- public function publish()
- {
- if($this->Published)
- throw new ValidationException('Already published Summit Event');
-
- if(count($this->summit_types()) === 0)
- throw new EntityValidationException('To publish this event you must associate a valid summit type!');
-
- $start_date = $this->StartDate;
- $end_date = $this->EndDate;
-
- if((is_null($start_date) || is_null($end_date)))
- throw new ValidationException('To publish this event you must define a start/end datetime!');
-
- $summit = $this->getSummit();
-
- if(is_null($summit))
- throw new ValidationException('To publish you must assign a summit');
-
- $timezone = $summit->TimeZone;
- if(empty($timezone)){
- throw new ValidationException('Invalid Summit TimeZone!');
- }
- if($end_date < $start_date)
- throw new ValidationException('start datetime must be greather or equal than end datetime!');
-
- if(!$summit->isEventInsideSummitDuration($this))
- throw new ValidationException
- (
- sprintf
- (
- 'start/end datetime must be between summit start/end datetime! (%s - %s)',
- $summit->getLocalBeginDate(),
- $summit->getLocalEndDate()
- )
- );
-
- $this->Published = true;
- $this->PublishedDate = DateTimeUtils::nowRfc2822();
- }
-
- /**
- * @return bool
- */
- public function isPublished()
- {
- return (bool)$this->Published;
- }
-
- /**
- * @return void
- */
- public function unPublish()
- {
- $this->Published = false;
- $this->PublishedDate = null;
- }
-
-}
\ No newline at end of file
diff --git a/app/Models/summit/SummitEventFeedback.php b/app/Models/summit/SummitEventFeedback.php
deleted file mode 100644
index e8d06897..00000000
--- a/app/Models/summit/SummitEventFeedback.php
+++ /dev/null
@@ -1,89 +0,0 @@
- 'id:json_int',
- 'Rate' => 'rate:json_int',
- 'Note' => 'note:json_string',
- 'OwnerID' => 'owner_id:json_int',
- 'EventID' => 'event_id:json_int',
- 'Created' => 'created_date:datetime_epoch',
- );
-
- /**
- * @return Member
- */
- public function owner()
- {
- return $this->hasOne('models\main\Member', 'ID', 'OwnerID')->first();
- }
-
- /**
- * @return SummitEvent
- */
- public function event()
- {
- return $this->hasOne('models\summit\SummitEvent', 'ID', 'EventID')->first();
- }
-
- /**
- * @param bool|false $expand_owner_info
- * @return array
- */
- public function toArray($expand_owner_info = false)
- {
- $data = parent::toArray();
- $member_id = $data['owner_id'];
- unset($data['owner_id']);
- $member = Member::where('ID', '=', $member_id)->first();
- if(is_null($member)) return $data;
-
- $attendee = SummitAttendee::where('MemberID', '=', $member_id)->first();
-
- if($expand_owner_info){
- $owner = array
- (
- 'id' => intval($member->ID),
- 'first_name' => JsonUtils::toJsonString($member->FirstName),
- 'last_name' => JsonUtils::toJsonString($member->Surname)
- );
- if (!is_null($attendee)) $owner['attendee_id'] = intval($attendee->ID);
-
- $data['owner'] = $owner;
- }
- else
- {
- $data['member_id'] = intval($member->ID);
- if (!is_null($attendee)) $data['attendee_id'] = intval($attendee->ID);
- }
-
- return $data;
- }
-}
diff --git a/app/Models/summit/SummitGeoLocatedLocation.php b/app/Models/summit/SummitGeoLocatedLocation.php
deleted file mode 100644
index 8c5c5496..00000000
--- a/app/Models/summit/SummitGeoLocatedLocation.php
+++ /dev/null
@@ -1,87 +0,0 @@
- 'id:json_int',
- 'Name' => 'name:json_string',
- 'Description' => 'description:json_string',
- 'ClassName' => 'class_name',
- 'LocationType' => 'location_type',
- 'Address1' => 'address_1:json_string',
- 'Address2' => 'address_2:json_string',
- 'ZipCode' => 'zip_code',
- 'City' => 'city:json_string',
- 'State' => 'state:json_string',
- 'Country' => 'country:json_string',
- 'Lng' => 'lng',
- 'Lat' => 'lat',
- );
-
- /**
- * @return SummitLocationMap[]
- */
- public function maps()
- {
- return $this->hasMany('models\summit\SummitLocationImage', 'LocationID', 'ID')
- ->where('ClassName','=', 'SummitLocationMap')
- ->orderBy('Order','ASC')->get();
- }
-
- /**
- * @return SummitLocationImage[]
- */
- public function images()
- {
- return $this->hasMany('models\summit\SummitLocationImage', 'LocationID', 'ID')
- ->where('ClassName','=', 'SummitLocationImage')
- ->orderBy('Order','ASC')->get();
- }
-
- /**
- * @return array
- */
- public function toArray()
- {
- $values = parent::toArray();
-
- $maps = array();
- foreach($this->maps() as $m)
- {
- array_push($maps, $m->toArray());
- }
- $values['maps'] = $maps;
-
-
- $images = array();
- foreach($this->images() as $i)
- {
- array_push($images, $i->toArray());
- }
- $values['images'] = $images;
-
- return $values;
- }
-
-}
\ No newline at end of file
diff --git a/app/Models/summit/SummitLocationImage.php b/app/Models/summit/SummitLocationImage.php
deleted file mode 100644
index eba64596..00000000
--- a/app/Models/summit/SummitLocationImage.php
+++ /dev/null
@@ -1,61 +0,0 @@
- 'id:json_int',
- 'LocationID' => 'location_id:json_int',
- 'Name' => 'name:json_text',
- 'Description' => 'description:json_text',
- 'ClassName' => 'class_name:json_text',
- 'Order' => 'order:json_int',
- );
-
- /**
- * @return Image
- */
- public function picture()
- {
- return $this->hasOne('models\main\Image', 'ID', 'PictureID')->first();
- }
-
- public function toArray()
- {
- $values = parent::toArray();
- $picture = $this->picture();
- if(!is_null($picture))
- {
- $values['image_url'] = Config::get("server.assets_base_url", 'https://www.openstack.org/'). $picture->Filename;
- }
- return $values;
- }
-}
\ No newline at end of file
diff --git a/app/Models/summit/SummitTicketType.php b/app/Models/summit/SummitTicketType.php
deleted file mode 100644
index 5f6c9e8d..00000000
--- a/app/Models/summit/SummitTicketType.php
+++ /dev/null
@@ -1,62 +0,0 @@
- 'id:json_int',
- 'Name' => 'name:json_string',
- 'Description' => 'description:json_string',
- );
-
- public function allowed_summit_types()
- {
- return $this->belongsToMany
- (
- 'models\summit\SummitType',
- 'SummitTicketType_AllowedSummitTypes',
- 'SummitTicketTypeID',
- 'SummitTypeID'
- )->get();
- }
-
-
- private function getAllowedSummitTypeIds()
- {
- $ids = array();
- foreach($this->allowed_summit_types() as $type)
- {
- array_push($ids, intval($type->ID));
- }
- return $ids;
- }
-
- public function toArray()
- {
- $values = parent::toArray();
- $values['allowed_summit_types'] = $this->getAllowedSummitTypeIds();
- return $values;
- }
-}
\ No newline at end of file
diff --git a/app/Models/summit/SummitVenue.php b/app/Models/summit/SummitVenue.php
deleted file mode 100644
index 4837fa9a..00000000
--- a/app/Models/summit/SummitVenue.php
+++ /dev/null
@@ -1,56 +0,0 @@
-rooms, $room);
- }
-
- public function toArray()
- {
- $values = parent::toArray();
-
- $rooms = array();
-
- foreach($this->rooms as $r)
- {
- array_push($rooms, $r->toArray());
- }
-
- if(count($rooms) > 0)
- $values['rooms'] = $rooms;
-
- return $values;
- }
-
- /**
- * @return SummitVenueRoom[]
- */
- public function rooms()
- {
- return $this->hasMany('models\summit\SummitVenueRoom', 'VenueID', 'ID')->get();
- }
-}
\ No newline at end of file
diff --git a/app/Policies/.gitkeep b/app/Policies/.gitkeep
new file mode 100644
index 00000000..8b137891
--- /dev/null
+++ b/app/Policies/.gitkeep
@@ -0,0 +1 @@
+
diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php
index 177c38e6..7db5c985 100644
--- a/app/Providers/AppServiceProvider.php
+++ b/app/Providers/AppServiceProvider.php
@@ -1,17 +1,17 @@
addReplacer('text', function($message, $attribute, $rule, $parameters) use ($validator) {
+ return sprintf("%s should be a valid text", $attribute);
+ });
+
+ return preg_match('/^[^<>\"\']+$/u', $value);
+ });
+
+
Validator::extend('string_array', function($attribute, $value, $parameters, $validator)
{
$validator->addReplacer('string_array', function($message, $attribute, $rule, $parameters) use ($validator) {
@@ -97,5 +110,4 @@ class AppServiceProvider extends ServiceProvider
App::singleton('models\\resource_server\\IApiEndpoint', 'models\\resource_server\\ApiEndpoint');
App::singleton('models\\resource_server\\IApiScope', 'models\\resource_server\\ApiScope');
}
-
-}
\ No newline at end of file
+}
diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php
new file mode 100644
index 00000000..57d88ea3
--- /dev/null
+++ b/app/Providers/AuthServiceProvider.php
@@ -0,0 +1,31 @@
+ 'App\Policies\ModelPolicy',
+ ];
+
+ /**
+ * Register any application authentication / authorization services.
+ *
+ * @param \Illuminate\Contracts\Auth\Access\Gate $gate
+ * @return void
+ */
+ public function boot(GateContract $gate)
+ {
+ $this->registerPolicies($gate);
+
+ //
+ }
+}
diff --git a/app/Providers/BusServiceProvider.php b/app/Providers/BusServiceProvider.php
deleted file mode 100644
index 17778ab6..00000000
--- a/app/Providers/BusServiceProvider.php
+++ /dev/null
@@ -1,34 +0,0 @@
-mapUsing(function($command)
- {
- return Dispatcher::simpleMapping(
- $command, 'App\Commands', 'App\Handlers\Commands'
- );
- });
- }
-
- /**
- * Register any application services.
- *
- * @return void
- */
- public function register()
- {
- //
- }
-
-}
\ No newline at end of file
diff --git a/app/Providers/ConfigServiceProvider.php b/app/Providers/ConfigServiceProvider.php
deleted file mode 100644
index dc9a1269..00000000
--- a/app/Providers/ConfigServiceProvider.php
+++ /dev/null
@@ -1,23 +0,0 @@
- [
+ 'App\Listeners\EventListener',
+ ],
];
- /**
+ /**
* Register any other events for your application.
* @param \Illuminate\Contracts\Events\Dispatcher $events
* @return void
@@ -29,91 +40,159 @@ class EventServiceProvider extends ServiceProvider
{
parent::boot($events);
- Event::listen('App\Events\MyScheduleAdd', function($event)
+
+ Event::listen(\App\Events\MyScheduleAdd::class, function($event)
{
if(!$event instanceof MyScheduleAdd) return;
- $entity_event = new SummitEntityEvent;
- $entity_event->EntityClassName = 'MySchedule';
- $entity_event->EntityID = $event->getEventId();
- $entity_event->Type = 'INSERT';
- $entity_event->OwnerID = $event->getAttendee()->member()->ID;
- $entity_event->SummitID = $event->getAttendee()->getSummit()->ID;
- $entity_event->Metadata = '';
- $entity_event->save();
+ $entity_event = new SummitEntityEvent;
+ $entity_event->setEntityClassName('MySchedule');
+ $entity_event->setEntityId($event->getEventId());
+ $entity_event->setType('INSERT');
+ $entity_event->setOwner($event->getAttendee()->getMember());
+ $entity_event->setSummit($event->getAttendee()->getSummit());
+ $entity_event->setMetadata('');
+
+ $em = Registry::getManager('ss');
+ $em->persist($entity_event);
+ $em->flush();
});
- Event::listen('App\Events\MyScheduleRemove', function($event)
+ Event::listen(\App\Events\MyScheduleRemove::class, function($event)
{
if(!$event instanceof MyScheduleRemove) return;
- $entity_event = new SummitEntityEvent;
- $entity_event->EntityClassName = 'MySchedule';
- $entity_event->EntityID = $event->getEventId();
- $entity_event->Type = 'DELETE';
- $entity_event->OwnerID = $event->getAttendee()->member()->ID;
- $entity_event->SummitID = $event->getAttendee()->getSummit()->ID;
- $entity_event->Metadata = '';
- $entity_event->save();
+ $entity_event = new SummitEntityEvent;
+ $entity_event->setEntityClassName('MySchedule');
+ $entity_event->setEntityId($event->getEventId());
+ $entity_event->setType('DELETE');
+ $entity_event->setOwner($event->getAttendee()->getMember());
+ $entity_event->setSummit($event->getAttendee()->getSummit());
+ $entity_event->setMetadata('');
+
+ $em = Registry::getManager('ss');
+ $em->persist($entity_event);
+ $em->flush();
+
});
- SummitEvent::deleted(function($summit_event){
+ Event::listen(\App\Events\SummitEventCreated::class, function($event)
+ {
+ if(!$event instanceof SummitEventCreated) return;
- if(!$summit_event instanceof SummitEvent) return;
- $resource_server_context = App::make('models\\oauth2\\IResourceServerContext');
- $owner_id = $resource_server_context->getCurrentUserExternalId();
+ $resource_server_context = App::make(\models\oauth2\IResourceServerContext::class);
+ $member_repository = App::make(\Models\foundation\main\repositories\IMemberRepository::class);
+ $owner_id = $resource_server_context->getCurrentUserExternalId();
if(is_null($owner_id)) $owner_id = 0;
$entity_event = new SummitEntityEvent;
- $entity_event->EntityClassName = $summit_event->ClassName;
- $entity_event->EntityID = $summit_event->ID;
- $entity_event->Type = 'DELETE';
- $entity_event->OwnerID = $owner_id;
- $entity_event->SummitID = $summit_event->getSummit()->ID;
- $entity_event->Metadata = '';
- $entity_event->save();
+ $entity_event->setEntityClassName($event->getSummitEvent()->getClassName());
+ $entity_event->setEntityId($event->getSummitEvent()->getId());
+ $entity_event->setType('INSERT');
+
+ if($owner_id > 0){
+ $member = $member_repository->getById($owner_id);
+ $entity_event->setOwner($member);
+ }
+
+ $entity_event->setSummit($event->getSummitEvent()->getSummit());
+ $entity_event->setMetadata( json_encode([ 'pub_new' => intval($event->getSummitEvent()->isPublished())]));
+
+ $em = Registry::getManager('ss');
+ $em->persist($entity_event);
+ $em->flush();
+
});
- SummitEvent::updated(function($summit_event){
+ Event::listen(\App\Events\PresentationMaterialCreated::class, function($event)
+ {
- if(!$summit_event instanceof SummitEvent) return;
-
- $resource_server_context = App::make('models\\oauth2\\IResourceServerContext');
- $owner_id = $resource_server_context->getCurrentUserExternalId();
+ $resource_server_context = App::make(\models\oauth2\IResourceServerContext::class);
+ $member_repository = App::make(\Models\foundation\main\repositories\IMemberRepository::class);
+ $owner_id = $resource_server_context->getCurrentUserExternalId();
if(is_null($owner_id)) $owner_id = 0;
- $original = $summit_event->getOriginal();
$entity_event = new SummitEntityEvent;
- $entity_event->EntityClassName = $summit_event->ClassName;
- $entity_event->EntityID = $summit_event->ID;
- $entity_event->Type = 'UPDATE';
- $entity_event->OwnerID = $owner_id;
- $entity_event->SummitID = $summit_event->getSummit()->ID;
- if(intval($original['Published']) !== intval($summit_event->Published)){
- $entity_event->Metadata = json_encode( array ( 'pub_old'=> intval($original['Published']), 'pub_new' => intval($summit_event->Published)));
+ $entity_event->setEntityClassName($event->getMaterial()->getClassName());
+ $entity_event->setEntityId($event->getMaterial()->getId());
+ $entity_event->setType('INSERT');
+
+ if($owner_id > 0){
+ $member = $member_repository->getById($owner_id);
+ $entity_event->setOwner($member);
+ }
+
+ $entity_event->setSummit($event->getMaterial()->getPresentation()->getSummit());
+
+ $em = Registry::getManager('ss');
+ $em->persist($entity_event);
+ $em->flush();
+
+ });
+
+ Event::listen(\App\Events\SummitEventUpdated::class, function($event)
+ {
+ if(!$event instanceof SummitEventUpdated) return;
+ $args = $event->getArgs();
+ if(!$args instanceof PreUpdateEventArgs) return;
+
+ $resource_server_context = App::make(\models\oauth2\IResourceServerContext::class);
+ $member_repository = App::make(\Models\foundation\main\repositories\IMemberRepository::class);
+
+ $owner_id = $resource_server_context->getCurrentUserExternalId();
+ if(is_null($owner_id)) $owner_id = 0;
+
+ $entity_event = new SummitEntityEvent;
+ $entity_event->setEntityClassName($event->getSummitEvent()->getClassName());
+ $entity_event->setEntityId($event->getSummitEvent()->getId());
+ $entity_event->setType('UPDATE');
+
+ if($owner_id > 0){
+ $member = $member_repository->getById($owner_id);
+ $entity_event->setOwner($member);
+ }
+
+ $entity_event->setSummit($event->getSummitEvent()->getSummit());
+
+ if($args->hasChangedField('published')){
+ $entity_event->setMetadata(json_encode([ 'pub_old'=> intval($args->getOldValue('published')), 'pub_new' => intval($args->getNewValue('published'))]));
}
else
- $entity_event->Metadata = json_encode( array ( 'pub_new' => intval($summit_event->Published)));
- $entity_event->save();
+ $entity_event->setMetadata(json_encode([ 'pub_new' => intval($event->getSummitEvent()->getPublished())]));
+
+ $em = Registry::getManager('ss');
+ $em->persist($entity_event);
+ $em->flush();
});
- SummitEvent::created(function($summit_event){
+ Event::listen(\App\Events\SummitEventDeleted::class, function($event)
+ {
+ if(!$event instanceof SummitEventDeleted) return;
+ $args = $event->getArgs();
+ if(!$args instanceof PreRemoveEventArgs) return;
- if(!$summit_event instanceof SummitEvent) return;
-
- $resource_server_context = App::make('models\\oauth2\\IResourceServerContext');
- $owner_id = $resource_server_context->getCurrentUserExternalId();
+ $resource_server_context = App::make(\models\oauth2\IResourceServerContext::class);
+ $member_repository = App::make(\Models\foundation\main\repositories\IMemberRepository::class);
+ $owner_id = $resource_server_context->getCurrentUserExternalId();
if(is_null($owner_id)) $owner_id = 0;
+ $params = $args->getParams();
- $entity_event = new SummitEntityEvent;
- $entity_event->EntityClassName = $summit_event->ClassName;
- $entity_event->EntityID = $summit_event->ID;
- $entity_event->Type = 'INSERT';
- $entity_event->OwnerID = $owner_id;
- $entity_event->SummitID = $summit_event->getSummit()->ID;
- $entity_event->Metadata = json_encode( array ( 'pub_new' => intval($summit_event->Published)));
- $entity_event->save();
+ $entity_event = new SummitEntityEvent;
+ $entity_event->setEntityClassName($params['class_name']);
+ $entity_event->setEntityId($params['id']);
+ $entity_event->setType('DELETE');
+
+ if($owner_id > 0){
+ $member = $member_repository->getById($owner_id);
+ $entity_event->setOwner($member);
+ }
+
+ $entity_event->setSummit($params['summit']);
+ $entity_event->setMetadata('');
+
+ $em = Registry::getManager('ss');
+ $em->persist($entity_event);
+ $em->flush();
});
}
-
-}
\ No newline at end of file
+}
diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php
index 05e22c86..f7c28e92 100644
--- a/app/Providers/RouteServiceProvider.php
+++ b/app/Providers/RouteServiceProvider.php
@@ -1,44 +1,57 @@
-group(['namespace' => $this->namespace], function ($router) {
- require app_path('Http/routes.php');
- });
+ $this->mapWebRoutes($router);
+
+ //
}
-}
\ No newline at end of file
+ /**
+ * Define the "web" routes for the application.
+ *
+ * These routes all receive session state, CSRF protection, etc.
+ *
+ * @param \Illuminate\Routing\Router $router
+ * @return void
+ */
+ protected function mapWebRoutes(Router $router)
+ {
+ require app_path('Http/routes.php');
+ }
+}
diff --git a/app/Repositories/DoctrineRepository.php b/app/Repositories/DoctrineRepository.php
new file mode 100644
index 00000000..c84fb874
--- /dev/null
+++ b/app/Repositories/DoctrineRepository.php
@@ -0,0 +1,71 @@
+EntityRepository.
+ *
+ * @param EntityManager $em The EntityManager to use.
+ * @param ClassMetadata $class The class descriptor.
+ */
+ public function __construct($em, ClassMetadata $class)
+ {
+ $em = Registry::getManager(static::$em_name);
+ parent::__construct($em, $class);
+ }
+
+ public function getById($id)
+ {
+ return $this->find($id);
+ }
+
+ /**
+ * @param IEntity $entity
+ * @return void
+ */
+ public function add($entity)
+ {
+ $this->_em->persist($entity);
+ }
+
+ /**
+ * @param IEntity $entity
+ * @return void
+ */
+ public function delete($entity)
+ {
+ $this->_em->remove($entity);
+ }
+
+ /**
+ * @return IEntity[]
+ */
+ public function getAll()
+ {
+ return $this->findAll();
+ }
+
+}
\ No newline at end of file
diff --git a/app/Repositories/marketplace/EloquentCompanyServiceRepository.php b/app/Repositories/Marketplace/EloquentCompanyServiceRepository.php
similarity index 100%
rename from app/Repositories/marketplace/EloquentCompanyServiceRepository.php
rename to app/Repositories/Marketplace/EloquentCompanyServiceRepository.php
diff --git a/app/Repositories/marketplace/EloquentConsultantRepository.php b/app/Repositories/Marketplace/EloquentConsultantRepository.php
similarity index 100%
rename from app/Repositories/marketplace/EloquentConsultantRepository.php
rename to app/Repositories/Marketplace/EloquentConsultantRepository.php
diff --git a/app/Repositories/marketplace/EloquentPrivateCloudServiceRepository.php b/app/Repositories/Marketplace/EloquentPrivateCloudServiceRepository.php
similarity index 100%
rename from app/Repositories/marketplace/EloquentPrivateCloudServiceRepository.php
rename to app/Repositories/Marketplace/EloquentPrivateCloudServiceRepository.php
diff --git a/app/Repositories/marketplace/EloquentPublicCloudServiceRepository.php b/app/Repositories/Marketplace/EloquentPublicCloudServiceRepository.php
similarity index 100%
rename from app/Repositories/marketplace/EloquentPublicCloudServiceRepository.php
rename to app/Repositories/Marketplace/EloquentPublicCloudServiceRepository.php
diff --git a/app/Repositories/RepositoriesProvider.php b/app/Repositories/RepositoriesProvider.php
index 6b7f7b3c..a4e10fbb 100644
--- a/app/Repositories/RepositoriesProvider.php
+++ b/app/Repositories/RepositoriesProvider.php
@@ -15,6 +15,7 @@
use Illuminate\Support\Facades\App;
use Illuminate\Support\ServiceProvider;
+use LaravelDoctrine\ORM\Facades\EntityManager;
/**
* Class RepositoriesProvider
@@ -34,6 +35,7 @@ class RepositoriesProvider extends ServiceProvider
'models\marketplace\IPublicCloudServiceRepository',
'repositories\marketplace\EloquentPublicCloudServiceRepository'
);
+
App::singleton(
'models\marketplace\IPrivateCloudServiceRepository',
'repositories\marketplace\EloquentPrivateCloudServiceRepository'
@@ -49,17 +51,52 @@ class RepositoriesProvider extends ServiceProvider
App::singleton(
'models\summit\ISummitRepository',
- 'repositories\summit\EloquentSummitRepository'
- );
+ function(){
+ return EntityManager::getRepository(\models\summit\Summit::class);
+ });
+
+ App::singleton(
+ 'models\summit\IEventFeedbackRepository',
+ function(){
+ return EntityManager::getRepository(\models\summit\SummitEventFeedback::class);
+ });
App::singleton(
'models\summit\ISpeakerRepository',
- 'repositories\summit\EloquentSpeakerRepository'
- );
+ function(){
+ return EntityManager::getRepository(\models\summit\PresentationSpeaker::class);
+ });
App::singleton(
'models\summit\ISummitEventRepository',
- 'repositories\summit\EloquentSummitEventRepository'
- );
+ function(){
+ return EntityManager::getRepository(\models\summit\SummitEvent::class);
+ });
+
+ App::singleton(
+ 'models\summit\ISummitEntityEventRepository',
+ function(){
+ return EntityManager::getRepository(\models\summit\SummitEntityEvent::class);
+ });
+
+
+
+ App::singleton(
+ 'Models\foundation\main\repositories\IMemberRepository',
+ function(){
+ return EntityManager::getRepository(\models\main\Member::class);
+ });
+
+ App::singleton(
+ 'models\summit\ISummitAttendeeRepository',
+ function(){
+ return EntityManager::getRepository(\models\summit\SummitAttendee::class);
+ });
+
+ App::singleton(
+ 'models\summit\ISummitAttendeeTicketRepository',
+ function(){
+ return EntityManager::getRepository(\models\summit\SummitAttendeeTicket::class);
+ });
}
}
\ No newline at end of file
diff --git a/app/Repositories/resource_server/EloquentApiEndpointRepository.php b/app/Repositories/ResourceServer/EloquentApiEndpointRepository.php
similarity index 100%
rename from app/Repositories/resource_server/EloquentApiEndpointRepository.php
rename to app/Repositories/ResourceServer/EloquentApiEndpointRepository.php
diff --git a/app/Repositories/SilverStripeDoctrineRepository.php b/app/Repositories/SilverStripeDoctrineRepository.php
new file mode 100644
index 00000000..0cd49e70
--- /dev/null
+++ b/app/Repositories/SilverStripeDoctrineRepository.php
@@ -0,0 +1,23 @@
+getEntityManager()->createQueryBuilder()
+ ->select("f")
+ ->from(\models\summit\SummitEventFeedback::class, "f")
+ ->join('f.event', 'e', Join::WITH, " e.id = :event_id")
+ ->join('f.owner', 'o')
+ ->setParameter('event_id', $event->getId());
+
+
+ if(!is_null($filter)){
+
+ $filter->apply2Query($query, array
+ (
+ 'owner_id' => 'o.id',
+ ));
+ }
+
+ if(!is_null($order))
+ {
+
+ $order->apply2Query($query, array
+ (
+ 'created_date' => 'f.created',
+ 'owner_id' => 'o.id',
+ 'rate' => 'f.rate',
+ 'id' => 'f.id',
+ ));
+ }
+ else
+ {
+ //default order
+ $query = $query->orderBy('f.created' , Criteria::DESC);
+ }
+
+ $query= $query
+ ->setFirstResult($paging_info->getOffset())
+ ->setMaxResults($paging_info->getPerPage());
+
+ $paginator = new Paginator($query, $fetchJoinCollection = true);
+ $total = $paginator->count();
+ $data = array();
+
+ foreach($paginator as $entity)
+ array_push($data, $entity);
+
+ return new PagingResponse
+ (
+ $total,
+ $paging_info->getPerPage(),
+ $paging_info->getCurrentPage(),
+ $paging_info->getLastPage($total),
+ $data
+ );
+ }
+}
\ No newline at end of file
diff --git a/app/Repositories/Summit/Doctrine/DoctrineMemberRepository.php b/app/Repositories/Summit/Doctrine/DoctrineMemberRepository.php
new file mode 100644
index 00000000..b74efe6a
--- /dev/null
+++ b/app/Repositories/Summit/Doctrine/DoctrineMemberRepository.php
@@ -0,0 +1,34 @@
+entity = $speaker;
- }
-
/**
* @param Summit $summit
* @param PagingInfo $paging_info
@@ -68,12 +57,12 @@ final class EloquentSpeakerRepository extends EloquentBaseRepository implements
{
$extra_orders = $order->toRawSQL(array
(
- 'first_name' => 'FirstName',
- 'last_name' => 'LastName',
+ 'first_name' => 'FirstName',
+ 'last_name' => 'LastName',
));
}
-$query_count = <<ID} AND E.Published = 1 AND PS.PresentationSpeakerID = S.ID
+ WHERE E.SummitID = {$summit->getId()} AND E.Published = 1 AND PS.PresentationSpeakerID = S.ID
)
UNION
SELECT S.ID,
@@ -105,15 +94,17 @@ FROM (
SELECT E.ID FROM SummitEvent E
INNER JOIN Presentation P ON E.ID = P.ID
INNER JOIN Presentation_Speakers PS ON PS.PresentationID = P.ID
- WHERE E.SummitID = {$summit->ID} AND E.Published = 1 AND P.ModeratorID = S.ID
+ WHERE E.SummitID = {$summit->getId()} AND E.Published = 1 AND P.ModeratorID = S.ID
)
)
SUMMIT_SPEAKERS
{$extra_filters}
SQL;
- $total = DB::connection('ss')->select($query_count, $bindings);
- $total = intval($total[0]->QTY);
+
+ $stm = $this->_em->getConnection()->executeQuery($query_count, $bindings);
+
+ $total = intval($stm->fetchColumn(0));
$bindings = array_merge( $bindings, array
(
@@ -121,7 +112,7 @@ SQL;
'offset' => $paging_info->getOffset(),
));
-$query = <<ID} AND E.Published = 1 AND PS.PresentationSpeakerID = S.ID
+ WHERE E.SummitID = {$summit->getId()} AND E.Published = 1 AND PS.PresentationSpeakerID = S.ID
)
UNION
SELECT
- S.ID,
+ S.ID,
S.ClassName,
S.Created,
S.LastEdited,
- S.Title,
+ S.Title AS SpeakerTitle,
S.Bio,
S.IRCHandle,
S.AvailableForBureau,
S.FundedTravel,
S.Country,
- S.PhotoID,
S.MemberID,
S.WillingToTravel,
S.WillingToPresentVideo,
@@ -175,35 +166,53 @@ FROM (
S.TwitterName,
IFNULL(M.FirstName, S.FirstName) AS FirstName,
IFNULL(M.Surname,S.LastName) AS LastName,
- IFNULL(M.Email,R.Email) AS Email
- FROM PresentationSpeaker S
+ IFNULL(M.Email,R.Email) AS Email,
+ S.PhotoID
+ FROM PresentationSpeaker S
LEFT JOIN Member M ON M.ID = S.MemberID
LEFT JOIN SpeakerRegistrationRequest R ON R.SpeakerID = S.ID
- WHERE
+ WHERE
EXISTS
(
SELECT E.ID FROM SummitEvent E
INNER JOIN Presentation P ON E.ID = P.ID
INNER JOIN Presentation_Speakers PS ON PS.PresentationID = P.ID
- WHERE E.SummitID = {$summit->ID} AND E.Published = 1 AND P.ModeratorID = S.ID
+ WHERE E.SummitID = {$summit->getId()} AND E.Published = 1 AND P.ModeratorID = S.ID
)
)
SUMMIT_SPEAKERS
{$extra_filters} {$extra_orders} limit :per_page offset :offset;
SQL;
- $rows = DB::connection('ss')->select($query, $bindings);
+ /*$rsm = new ResultSetMapping();
+ $rsm->addEntityResult(\models\summit\PresentationSpeaker::class, 's');
+ $rsm->addJoinedEntityResult(\models\main\File::class,'p', 's', 'photo');
+ $rsm->addJoinedEntityResult(\models\main\Member::class,'m', 's', 'member');
- $items = array();
- foreach($rows as $row)
- {
- $instance = new PresentationSpeaker();
- $instance->setRawAttributes((array)$row, true);
- array_push($items, $instance);
- }
+ $rsm->addFieldResult('s', 'ID', 'id');
+ $rsm->addFieldResult('s', 'FirstName', 'first_name');
+ $rsm->addFieldResult('s', 'LastName', 'last_name');
+ $rsm->addFieldResult('s', 'Bio', 'last_name');
+ $rsm->addFieldResult('s', 'SpeakerTitle', 'title' );
+ $rsm->addFieldResult('p', 'PhotoID', 'id');
+ $rsm->addFieldResult('p', 'PhotoTitle', 'title');
+ $rsm->addFieldResult('p', 'PhotoFileName', 'filename');
+ $rsm->addFieldResult('p', 'PhotoName', 'name');
+ $rsm->addFieldResult('m', 'MemberID', 'id');*/
+
+ $rsm = new ResultSetMappingBuilder($this->_em);
+ $rsm->addRootEntityFromClassMetadata(\models\summit\PresentationSpeaker::class, 's', ['Title' => 'SpeakerTitle']);
+
+ // build rsm here
+ $native_query = $this->_em->createNativeQuery($query, $rsm);
+
+ foreach($bindings as $k => $v)
+ $native_query->setParameter($k, $v);
+
+ $speakers = $native_query->getResult();
$last_page = (int) ceil($total / $paging_info->getPerPage());
- return new PagingResponse($total, $paging_info->getPerPage(), $paging_info->getCurrentPage(), $last_page, $items);
+ return new PagingResponse($total, $paging_info->getPerPage(), $paging_info->getCurrentPage(), $last_page, $speakers);
}
}
\ No newline at end of file
diff --git a/app/Repositories/Summit/Doctrine/DoctrineSummitAttendeeRepository.php b/app/Repositories/Summit/Doctrine/DoctrineSummitAttendeeRepository.php
new file mode 100644
index 00000000..b4117775
--- /dev/null
+++ b/app/Repositories/Summit/Doctrine/DoctrineSummitAttendeeRepository.php
@@ -0,0 +1,26 @@
+getEntityManager()->createQueryBuilder()
+ ->select("t")
+ ->from(\models\summit\SummitAttendeeTicket::class, "t");
+
+ $tickets = $query
+ ->where('t.external_order_id = :external_order_id')
+ ->andWhere('t.external_attendee_id = :external_attendee_id')
+ ->setParameter('external_order_id', $external_order_id)
+ ->setParameter('external_attendee_id', $external_attendee_id)->getQuery()->getResult();
+
+ return count($tickets) > 0 ? $tickets[0] : null;
+ }
+}
\ No newline at end of file
diff --git a/app/Repositories/Summit/Doctrine/DoctrineSummitEntityEventRepository.php b/app/Repositories/Summit/Doctrine/DoctrineSummitEntityEventRepository.php
new file mode 100644
index 00000000..f7dde968
--- /dev/null
+++ b/app/Repositories/Summit/Doctrine/DoctrineSummitEntityEventRepository.php
@@ -0,0 +1,138 @@
+ {$from_id} ";
+ }
+
+ if(!is_null($from_date))
+ {
+ $str_date = $from_date->format("Y-m-d H:i:s");
+ // CDT TO UTC
+ $filters .= " AND DATE_ADD(SummitEntityEvent.Created,INTERVAL + 5 HOUR) >= '{$str_date}' ";
+ }
+
+ $query = << 'MySchedule' AND EntityClassName <> 'SummitAttendee')
+ -- GLOBAL TRUNCATE
+ OR (EntityClassName = 'WipeData' AND EntityID = 0)
+ )
+ AND SummitID = {$summit->getId()}
+ {$filters}
+ LIMIT {$limit}
+)
+AS GLOBAL_EVENTS
+SQL;
+
+ if(!is_null($member_id)){
+ $query .= <<getId()}
+ {$filters}
+ LIMIT {$limit}
+)
+AS MY_SCHEDULE
+UNION
+SELECT * FROM
+(
+ SELECT * FROM SummitEntityEvent
+ WHERE
+ (
+ EntityClassName = 'WipeData' AND EntityID = {$member_id}
+ )
+ AND SummitID = {$summit->getId()}
+ {$filters}
+ LIMIT {$limit}
+) AS USER_WIPE_DATA
+SQL;
+ }
+
+ $query .= <<_em);
+ $rsm->addRootEntityFromClassMetadata(\models\summit\SummitEntityEvent::class, 'e');
+ // build rsm here
+ $native_query = $this->_em->createNativeQuery($query, $rsm);
+
+ $entity_events = $native_query->getResult();
+
+ if($detach) $this->_em ->clear(\models\summit\SummitEntityEvent::class);
+
+ return $entity_events;
+ }
+
+ /**
+ * @param Summit $summit
+ * @return int
+ */
+ public function getLastEntityEventId(Summit $summit)
+ {
+ $query = <<getId()} ORDER BY ID DESC LIMIT 1;
+SQL;
+
+ return intval($this->_em->getConnection()->executeQuery($query)->fetchColumn(0));
+ }
+}
\ No newline at end of file
diff --git a/app/Repositories/Summit/Doctrine/DoctrineSummitEventRepository.php b/app/Repositories/Summit/Doctrine/DoctrineSummitEventRepository.php
new file mode 100644
index 00000000..fdec7022
--- /dev/null
+++ b/app/Repositories/Summit/Doctrine/DoctrineSummitEventRepository.php
@@ -0,0 +1,154 @@
+getSummit();
+ $end_date = $event->getEndDate();
+ $start_date = $event->getStartDate();
+
+ return $this->getEntityManager()->createQueryBuilder()
+ ->select("e")
+ ->from(\models\summit\SummitEvent::class, "e")
+ ->join('e.summit', 's', Join::WITH, " s.id = :summit_id")
+ ->where('e.published = 1')
+ ->andWhere('e.start_date <= :end_date')
+ ->andWhere('e.end_date >= :start_date')
+ ->setParameter('summit_id', $summit->getId())
+ ->setParameter('start_date', $start_date)
+ ->setParameter('end_date', $end_date)->getQuery()->getResult();
+ }
+
+
+ /**
+ * @param PagingInfo $paging_info
+ * @param Filter $filter
+ * @return PagingResponse
+ */
+ public function getAllByPage(PagingInfo $paging_info, Filter $filter)
+ {
+ $class = count($filter->getFilter('speaker')) > 0? \models\summit\Presentation::class : \models\summit\SummitEvent::class;
+ $query = $this->getEntityManager()->createQueryBuilder()
+ ->select("e")
+ ->from($class, "e");
+
+ if(!is_null($filter)){
+
+ $filter->apply2Query($query, array
+ (
+ 'title' => 'e.title',
+ 'published' => 'e.published',
+ 'start_date' => 'e.start_date:datetime_epoch',
+ 'end_date' => 'e.end_date:datetime_epoch',
+ 'tags' => new DoctrineJoinFilterMapping
+ (
+ 'e.tags',
+ 't',
+ "t.tag :operator ':value'"
+ ),
+ 'summit_type_id'=> new DoctrineJoinFilterMapping
+ (
+ 'e.summit_types',
+ 'st',
+ "st.id :operator :value"
+ ),
+ 'location_id'=> new DoctrineJoinFilterMapping
+ (
+ 'e.location',
+ 'l',
+ "l.id :operator :value"
+ ),
+ 'summit_id'=> new DoctrineJoinFilterMapping
+ (
+ 'e.summit',
+ 's',
+ "s.id :operator :value"
+ ),
+ 'event_type_id' => new DoctrineJoinFilterMapping
+ (
+ 'e.type',
+ 'et',
+ "et.id :operator :value"
+ ),
+ 'track_id' => new DoctrineJoinFilterMapping
+ (
+ 'e.category',
+ 'c',
+ "c.id :operator :value"
+ ),
+ 'speaker' => new DoctrineJoinFilterMapping
+ (
+ 'e.speakers',
+ 'sp',
+ "concat(sp.first_name, ' ', sp.last_name) :operator ':value'"
+ ),
+ ));
+ }
+
+ $query= $query
+ ->addOrderBy("e.start_date",'ASC')
+ ->addOrderBy("e.end_date", 'ASC')
+ ->setFirstResult($paging_info->getOffset())
+ ->setMaxResults($paging_info->getPerPage());
+
+ $paginator = new Paginator($query, $fetchJoinCollection = true);
+ $total = $paginator->count();
+ $data = array();
+
+ foreach($paginator as $entity)
+ array_push($data, $entity);
+
+ return new PagingResponse
+ (
+ $total,
+ $paging_info->getPerPage(),
+ $paging_info->getCurrentPage(),
+ $paging_info->getLastPage($total),
+ $data
+ );
+ }
+
+
+ /**
+ * @param int $event_id
+ */
+ public function cleanupAttendeesScheduleForEvent($event_id){
+
+ $query = "DELETE SummitAttendee_Schedule FROM SummitAttendee_Schedule WHERE SummitEventID = {$event_id};";
+ $this->_em->getConnection()->executeUpdate($query);
+ }
+
+}
\ No newline at end of file
diff --git a/app/Repositories/Summit/Doctrine/DoctrineSummitRepository.php b/app/Repositories/Summit/Doctrine/DoctrineSummitRepository.php
new file mode 100644
index 00000000..f0bbbfe7
--- /dev/null
+++ b/app/Repositories/Summit/Doctrine/DoctrineSummitRepository.php
@@ -0,0 +1,47 @@
+getEntityManager()->createQueryBuilder()
+ ->select("s")
+ ->from(\models\summit\Summit::class, "s")
+ ->where('s.active = 1')
+ ->orderBy('s.begin_date','DESC')
+ ->getQuery()->getResult();
+ if(count($res) == 0) return null;
+ return $res[0];
+ }
+}
\ No newline at end of file
diff --git a/app/Repositories/summit/EloquentSummitEventRepository.php b/app/Repositories/summit/EloquentSummitEventRepository.php
deleted file mode 100644
index 543d498c..00000000
--- a/app/Repositories/summit/EloquentSummitEventRepository.php
+++ /dev/null
@@ -1,143 +0,0 @@
-entity = $event;
- }
-
- /**
- * @param SummitEvent $event
- * @return SummitEvent[]
- */
- public function getPublishedOnSameTimeFrame(SummitEvent $event)
- {
- $summit = $event->getSummit();
- $end_date = $event->EndDateUTC;
- $start_date = $event->StartDateUTC;
- return $this->entity
- ->where('SummitID', '=', $summit->getIdentifier())
- ->where('Published', '=', 1)
- ->where('StartDate', '<=', $end_date->format('Y-m-d H:i:s'))
- ->where('EndDate', '>=', $start_date->format('Y-m-d H:i:s'))
- ->get();
- }
-
- /**
- * @param int $page
- * @param int $per_page
- * @param Filter $filter
- * @return array
- */
- public function getAllByPage($page, $per_page, Filter $filter)
- {
- return $this->_getAllByPage($page, $per_page, $filter);
- }
-
- /**
- * @param int $page
- * @param int $per_page
- * @param Filter $filter
- * @return array
- */
- public function getAllPublishedByPage($page, $per_page, Filter $filter)
- {
- return $this->_getAllByPage($page, $per_page, $filter, true);
- }
-
- /**
- * @param $page
- * @param $per_page
- * @param Filter $filter
- * @param bool|false $published
- * @return array
- */
- private function _getAllByPage($page, $per_page, Filter $filter, $published = false)
- {
- $rel = $this->entity->newQuery();
-
- if($published)
- {
- $rel = $rel->where('Published','=','1');
- }
-
- if(!is_null($filter))
- {
- $filter->apply2Relation($rel, array
- (
- 'title' => 'SummitEvent.Title',
- 'summit_id' => 'SummitEvent.SummitID',
- 'start_date' => 'SummitEvent.StartDate:datetime_epoch',
- 'end_date' => 'SummitEvent.EndDate:datetime_epoch',
- 'tags' => new ExistsFilterManyManyMapping
- (
- 'Tag',
- 'SummitEvent_Tags',
- 'SummitEvent_Tags.TagID = Tag.ID',
- "SummitEvent_Tags.SummitEventID = SummitEvent.ID AND Tag.Tag :operator ':value'"
- ),
- 'summit_type_id'=> new ExistsFilterManyManyMapping
- (
- 'SummitType',
- 'SummitEvent_AllowedSummitTypes',
- 'SummitType.ID = SummitEvent_AllowedSummitTypes.SummitTypeID',
- 'SummitEvent_AllowedSummitTypes.SummitEventID = SummitEvent.ID AND SummitType.ID :operator :value'
- ),
- 'event_type_id' => new ExistsFilterManyToOneMapping
- (
- 'SummitEventType',
- 'SummitEventType.ID = SummitEvent.TypeID AND SummitEventType.ID :operator :value'
- ),
- ));
- }
-
- $rel = $rel->orderBy('StartDate','asc')->orderBy('EndDate','asc');
-
- $pagination_result = $rel->paginate($per_page);
- $total = $pagination_result->total();
- $items = $pagination_result->items();
- $per_page = $pagination_result->perPage();
- $current_page = $pagination_result->currentPage();
- $last_page = $pagination_result->lastPage();
- $events = array();
- foreach($items as $e)
- {
- $class = 'models\\summit\\'.$e->ClassName;
- $entity = $class::find($e->ID);
- array_push($events, $entity);
- }
- return array($total,$per_page, $current_page, $last_page, $events);
- }
-
-}
\ No newline at end of file
diff --git a/app/Services/apis/EventbriteAPI.php b/app/Services/Apis/EventbriteAPI.php
similarity index 100%
rename from app/Services/apis/EventbriteAPI.php
rename to app/Services/Apis/EventbriteAPI.php
diff --git a/app/Services/apis/IEventbriteAPI.php b/app/Services/Apis/IEventbriteAPI.php
similarity index 100%
rename from app/Services/apis/IEventbriteAPI.php
rename to app/Services/Apis/IEventbriteAPI.php
diff --git a/app/Services/Model/IPresentationService.php b/app/Services/Model/IPresentationService.php
new file mode 100644
index 00000000..69bec8b2
--- /dev/null
+++ b/app/Services/Model/IPresentationService.php
@@ -0,0 +1,30 @@
+presentation_repository = $presentation_repository;
+ $this->video_factory = $video_factory;
+ $this->tx_service = $tx_service;
+ }
+
+ /**
+ * @param int $presentation_id
+ * @param array $video_data
+ * @return PresentationVideo
+ */
+ public function addVideoTo($presentation_id, array $video_data)
+ {
+ $video = $this->tx_service->transaction(function() use($presentation_id, $video_data){
+
+ $presentation = $this->presentation_repository->getById($presentation_id);
+
+ if(is_null($presentation))
+ throw new EntityNotFoundException('presentation not found!');
+
+ if($presentation->hasVideos())
+ throw new ValidationException(sprintf('presentation %s already has a video!', $presentation_id));
+
+ if(!isset($video_data['name'])) $video_data['name'] = $presentation->getTitle();
+
+ $video = $this->video_factory->build($video_data);
+
+ $presentation->addVideo($video);
+
+ return $video;
+ });
+
+ return $video;
+ }
+}
\ No newline at end of file
diff --git a/app/Services/Model/SummitService.php b/app/Services/Model/SummitService.php
new file mode 100644
index 00000000..3d36c62a
--- /dev/null
+++ b/app/Services/Model/SummitService.php
@@ -0,0 +1,761 @@
+event_repository = $event_repository;
+ $this->speaker_repository = $speaker_repository;
+ $this->entity_events_repository = $entity_events_repository;
+ $this->ticket_repository = $ticket_repository;
+ $this->member_repository = $member_repository;
+ $this->attendee_repository = $attendee_repository;
+ $this->eventbrite_api = $eventbrite_api;
+ $this->tx_service = $tx_service;
+ }
+
+ /**
+ * @param Summit $summit
+ * @param SummitAttendee $attendee
+ * @param int $event_id
+ * @return void
+ * @throws EntityNotFoundException
+ */
+ public function addEventToAttendeeSchedule(Summit $summit, SummitAttendee $attendee, $event_id)
+ {
+ $this->tx_service->transaction(function () use ($summit, $attendee, $event_id) {
+ $event = $summit->getScheduleEvent($event_id);
+ if (is_null($event)) {
+ throw new EntityNotFoundException('event not found on summit!');
+ }
+ $attendee->add2Schedule($event);
+ });
+ Event::fire(new MyScheduleAdd($attendee, $event_id));
+ }
+
+ /**
+ * @param Summit $summit
+ * @param SummitAttendee $attendee
+ * @param $event_id
+ * @return void
+ * @throws EntityNotFoundException
+ */
+ public function checkInAttendeeOnEvent(Summit $summit, SummitAttendee $attendee, $event_id)
+ {
+ $this->tx_service->transaction(function () use ($summit, $attendee, $event_id) {
+ $event = $summit->getScheduleEvent($event_id);
+ if (is_null($event)) throw new EntityNotFoundException('event not found on summit!');
+ $attendee->checkIn($event);
+ });
+ }
+
+ /**
+ * @param Summit $summit
+ * @param SummitAttendee $attendee
+ * @param int $event_id
+ * @return void
+ * @throws \Exception
+ */
+ public function removeEventFromAttendeeSchedule(Summit $summit, SummitAttendee $attendee, $event_id)
+ {
+ $this->tx_service->transaction(function () use ($summit, $attendee, $event_id) {
+ $event = $summit->getScheduleEvent($event_id);
+ if (is_null($event)) throw new EntityNotFoundException('event not found on summit!');
+ $attendee->removeFromSchedule($event);
+ });
+ Event::fire(new MyScheduleRemove($attendee, $event_id));
+ }
+
+ /**
+ * @param Summit $summit
+ * @param SummitEvent $event
+ * @param array $feedback
+ * @return SummitEventFeedback
+ */
+ public function addEventFeedback(Summit $summit, SummitEvent $event, array $feedback)
+ {
+
+ return $this->tx_service->transaction(function () use ($summit, $event, $feedback) {
+
+ if (!$event->isAllowFeedback())
+ throw new ValidationException(sprintf("event id %s does not allow feedback", $event->getIdentifier()));
+
+ $member = null;
+
+ // check for attendee
+ $attendee_id = isset($feedback['attendee_id']) ? intval($feedback['attendee_id']) : null;
+ $member_id = isset($feedback['member_id']) ? intval($feedback['member_id']) : null;
+ if(!is_null($attendee_id)) {
+ $attendee = $summit->getAttendeeById($attendee_id);
+ if (!$attendee) throw new EntityNotFoundException();
+ $member = $attendee->getMember();
+ }
+
+ // check by member
+ if(!is_null($member_id)) {
+ $member = $this->member_repository->getById($member_id);
+ }
+
+ if (is_null($member)) throw new EntityNotFoundException();
+
+ $newFeedback = new SummitEventFeedback();
+ $newFeedback->setRate(intval($feedback['rate']));
+ $newFeedback->setNote(trim($feedback['note']));
+ $newFeedback->setOwner($member);
+ $event->addFeedBack($newFeedback);
+
+ return $newFeedback;
+ });
+ }
+
+ /**
+ * @param Summit $summit
+ * @param null|int $member_id
+ * @param null|\DateTime $from_date
+ * @param null|int $from_id
+ * @param int $limit
+ * @return array
+ */
+ public function getSummitEntityEvents(Summit $summit, $member_id = null, DateTime $from_date = null, $from_id = null, $limit = 25)
+ {
+ return $this->tx_service->transaction(function () use ($summit, $member_id, $from_date, $from_id, $limit) {
+
+ $global_last_id = $this->entity_events_repository->getLastEntityEventId($summit);
+ $from_id = !is_null($from_id) ? intval($from_id) : null;
+ $ctx = new SummitEntityEventProcessContext($member_id);
+
+ do {
+
+ $last_event_id = 0;
+ $last_event_date = 0;
+ // if we got a from id and its greater than the last one, then break
+ if (!is_null($from_id) && $global_last_id <= $from_id) break;
+
+ $events = $this->entity_events_repository->getEntityEvents
+ (
+ $summit,
+ $member_id,
+ $from_id,
+ $from_date,
+ $limit
+ );
+
+ foreach ($events as $e) {
+ if ($ctx->getListSize() === $limit) break;
+ $last_event_id = $e->getId();
+ $last_event_date = $e->getCreated();
+ try {
+ $entity_event_type_processor = EntityEventTypeFactory::getInstance()->build($e, $ctx);
+ $entity_event_type_processor->process();
+ }
+ catch(\InvalidArgumentException $ex1){
+ Log::info($ex1);
+ }
+ catch(\Exception $ex){
+ Log::error($ex);
+ }
+ }
+ // reset if we do not get any data so far, to get next batch
+ $from_id = $last_event_id;
+ $from_date = null;
+ //post process for summit events , we should send only te last one
+ $ctx->postProcessList();
+ // we do not have any any to process
+ if ($last_event_id == 0 || $global_last_id <= $last_event_id) break;
+ } while ($ctx->getListSize() < $limit);
+
+ return array($last_event_id, $last_event_date, $ctx->getListValues());
+ });
+ }
+
+ /**
+ * @param Summit $summit
+ * @param array $data
+ * @return SummitEvent
+ */
+ public function addEvent(Summit $summit, array $data)
+ {
+ return $this->saveOrUpdateEvent($summit, $data);
+ }
+
+ /**
+ * @param Summit $summit
+ * @param int $event_id
+ * @param array $data
+ * @return SummitEvent
+ */
+ public function updateEvent(Summit $summit, $event_id, array $data)
+ {
+ return $this->saveOrUpdateEvent($summit, $data, $event_id);
+ }
+
+ /**
+ * @param Summit $summit
+ * @param array $data
+ * @param null|int $event_id
+ * @return SummitEvent
+ */
+ private function saveOrUpdateEvent(Summit $summit, array $data, $event_id = null)
+ {
+ $event_repository = $this->event_repository;
+
+ return $this->tx_service->transaction(function () use ($summit, $data, $event_id, $event_repository) {
+
+ $start_datetime = null;
+ $end_datetime = null;
+
+ if (isset($data['start_date']) && isset($data['end_date'])) {
+ $start_datetime = intval($data['start_date']);
+ $start_datetime = new \DateTime("@$start_datetime");
+ $end_datetime = intval($data['end_date']);
+ $end_datetime = new \DateTime("@$end_datetime");
+ $interval_seconds = $end_datetime->getTimestamp() - $start_datetime->getTimestamp();
+ $minutes = $interval_seconds / 60;
+ if ($minutes < self::MIN_EVENT_MINUTES)
+ throw new ValidationException
+ (
+ sprintf
+ (
+ "event should last at lest %s minutes - current duration %s",
+ self::MIN_EVENT_MINUTES,
+ $minutes
+ )
+ );
+ }
+
+ $event_type = null;
+ if (isset($data['type_id'])) {
+ $event_type = $summit->getEventType(intval($data['type_id']));
+ if (is_null($event_type)) {
+ throw new EntityNotFoundException(sprintf("event type id %s does not exists!", $data['type_id']));
+ }
+ }
+
+ $location = null;
+ if (isset($data['location_id'])) {
+ $location = $summit->getLocation(intval($data['location_id']));
+ if (is_null($location)) {
+ throw new EntityNotFoundException(sprintf("location id %s does not exists!", $data['location_id']));
+ }
+ }
+
+ $summit_types = array();
+ if (isset($data['summit_types_id'])) {
+ foreach ($data['summit_types_id'] as $summit_type_id) {
+ $summit_type = $summit->getSummitType($summit_type_id);
+ if (is_null($summit_type)) {
+ throw new ValidationException(sprintf("summit type id %s does not exists!", $summit_type_id));
+ }
+ array_push($summit_types, $summit_type);
+ }
+ }
+
+ if (is_null($event_id)) {
+ $event = SummitEventFactory::build($event_type);
+ } else {
+ $event = $event_repository->getById($event_id);
+ if (is_null($event))
+ throw new ValidationException(sprintf("event id %s does not exists!", $event_id));
+ $event_type = $event->getType();
+ }
+
+ if (isset($data['title']))
+ $event->setTitle($data['title']);
+
+ if (isset($data['description']))
+ $event->setDescription($data['description']);
+
+ if (isset($data['allow_feedback']))
+ $event->setAllowFeedBack($data['allow_feedback']);
+
+ if (!is_null($event_type))
+ $event->setType($event_type);
+
+ if(is_null($event_id) && is_null($event_type)){
+ // is event is new one and we dont provide an event type ...
+ throw new ValidationException('type_id is mandatory!');
+ }
+
+ // is event is new and we dont provide speakers ...
+ if(is_null($event_id) && !is_null($event_type) && $event_type->isPresentationType() && !isset($data['speakers']))
+ throw new ValidationException('speakers data is required for presentations!');
+
+ $event->setSummit($summit);
+
+ if (!is_null($location))
+ $event->setLocation($location);
+
+ // check start/end datetime with summit
+ if (!is_null($start_datetime) && !is_null($end_datetime)) {
+ // set local time from UTC
+ $event->setStartDate($start_datetime);
+ $event->setEndDate($end_datetime);
+
+ if (!$summit->isEventInsideSummitDuration($event))
+ throw new ValidationException
+ (
+ sprintf
+ (
+ "event start/end (%s - %s) does not match with summit start/end (%s - %s)",
+ $start_datetime->format('Y-m-d H:i:s'),
+ $end_datetime->format('Y-m-d H:i:s'),
+ $summit->getLocalBeginDate()->format('Y-m-d H:i:s'),
+ $summit->getLocalEndDate()->format('Y-m-d H:i:s')
+ )
+ );
+ }
+
+ if (count($summit_types) > 0) {
+ $event->clearSummitTypes();
+ foreach ($summit_types as $summit_type) {
+ $event->addSummitType($summit_type);
+ }
+ }
+
+ if (isset($data['tags']) && count($data['tags']) > 0) {
+ $event->clearTags();
+ foreach ($data['tags'] as $tag) {
+ $event->addTag($tag);
+ }
+ }
+
+ if (isset($data['speakers']) && !is_null($event_type) && $event_type->isPresentationType()) {
+ $event->clearSpeakers();
+ foreach ($data['speakers'] as $speaker_id) {
+ $speaker = $this->speaker_repository->getById(intval($speaker_id));
+ if(is_null($speaker)) throw new EntityNotFoundException(sprintf('speaker id %s', $speaker_id));
+ $event->addSpeaker($speaker);
+ }
+ }
+
+ if(isset($data['moderator_speaker_id']) && !is_null($event_type) && $event_type->allowsModerator()){
+ $speaker_id = intval($data['moderator_speaker_id']);
+ if($speaker_id === 0) $event->unsetModerator();
+ else
+ {
+ $moderator = $this->speaker_repository->getById($speaker_id);
+ if (is_null($moderator)) throw new EntityNotFoundException(sprintf('speaker id %s', $speaker_id));
+ $event->setModerator($speaker);
+ }
+ }
+
+ $event_repository->add($event);
+
+ return $event;
+ });
+ }
+
+ /**
+ * @param Summit $summit
+ * @param int $event_id
+ * @param array $data
+ * @return SummitEvent
+ */
+ public function publishEvent(Summit $summit, $event_id, array $data)
+ {
+ $event_repository = $this->event_repository;
+
+ return $this->tx_service->transaction(function () use ($summit, $data, $event_id, $event_repository) {
+
+ $event = $event_repository->getById($event_id);
+
+ if (is_null($event))
+ throw new EntityNotFoundException(sprintf("event id %s does not exists!", $event_id));
+
+ if (is_null($event->getType()))
+ throw new EntityNotFoundException(sprintf("event type its not assigned to event id %s!", $event_id));
+
+ if (is_null($event->getSummit()))
+ throw new EntityNotFoundException(sprintf("summit its not assigned to event id %s!", $event_id));
+
+ if ($event->getSummit()->getIdentifier() !== $summit->getIdentifier())
+ throw new ValidationException(sprintf("event %s does not belongs to summit id %s", $event_id, $summit->getIdentifier()));
+
+ $start_datetime = $event->getStartDate();
+ $end_datetime = $event->getEndDate();
+
+ if (isset($data['start_date']) && isset($data['end_date'])) {
+ $start_datetime = intval($data['start_date']);
+ $start_datetime = new \DateTime("@$start_datetime");
+ $end_datetime = intval($data['end_date']);
+ $end_datetime = new \DateTime("@$end_datetime");
+ }
+
+ if (is_null($start_datetime))
+ throw new ValidationException(sprintf("start_date its not assigned to event id %s!", $event_id));
+
+ if (is_null($end_datetime))
+ throw new ValidationException(sprintf("end_date its not assigned to event id %s!", $event_id));
+
+ if (isset($data['location_id'])) {
+ $location = $summit->getLocation(intval($data['location_id']));
+ if (is_null($location))
+ throw new EntityNotFoundException(sprintf("location id %s does not exists!", $data['location_id']));
+
+ $event->setLocation($location);
+ }
+
+ $current_event_location = $event->getLocation();
+
+ // validate blackout times
+ $conflict_events = $event_repository->getPublishedOnSameTimeFrame($event);
+ if (!is_null($conflict_events)) {
+ foreach ($conflict_events as $c_event) {
+ // if the published event is BlackoutTime or if there is a BlackoutTime event in this timeframe
+ if (($event->getType()->isBlackoutTimes() || $c_event->getType()->isBlackoutTimes()) && $event->getId() != $c_event->getId()) {
+ throw new ValidationException(sprintf("You can't publish on this time frame, it conflicts with event id %s",
+ $c_event->getId()));
+ }
+ // if trying to publish an event on a slot occupied by another event
+ if ($current_event_location->getId() == $c_event->getLocation()->getId() && $event->getId() != $c_event->getId()) {
+ throw new ValidationException(sprintf("You can't publish on this time frame, it conflicts with event id %s",
+ $c_event->getId()));
+ }
+
+ // check speakers collisions
+ if ($event->getClassName() == 'Presentation' && $c_event->getClassName() == 'Presentation' && $event->getId() != $c_event->getId()) {
+ foreach ($event->getSpeakers() as $current_speaker) {
+ foreach ($c_event->getSpeakers() as $c_speaker) {
+ if (intval($c_speaker->getId()) === intval($current_speaker->getId())) {
+ throw new ValidationException
+ (
+ sprintf
+ (
+ 'speaker id % belongs already to another event ( %s) on that time frame',
+ $c_speaker->getId(),
+ $c_event->getId()
+ )
+ );
+ }
+ }
+ }
+ }
+
+ }
+ }
+
+ $event->unPublish();
+ $event->publish();
+
+ $event_repository->add($event);
+ return $event;
+ });
+ }
+
+ /**
+ * @param Summit $summit
+ * @param int $event_id
+ * @return mixed
+ */
+ public function unPublishEvent(Summit $summit, $event_id)
+ {
+ $event_repository = $this->event_repository;
+
+ return $this->tx_service->transaction(function () use ($summit, $event_id, $event_repository) {
+
+ $event = $event_repository->getById($event_id);
+
+ if (is_null($event))
+ throw new EntityNotFoundException(sprintf("event id %s does not exists!", $event_id));
+
+ if ($event->getSummit()->getIdentifier() !== $summit->getIdentifier())
+ throw new ValidationException(sprintf("event %s does not belongs to summit id %s", $event_id, $summit->getIdentifier()));
+
+ $event->unPublish();
+ $event_repository->add($event);
+ $event_repository->cleanupAttendeesScheduleForEvent($event_id);
+ return $event;
+ });
+ }
+
+ /**
+ * @param Summit $summit
+ * @param int $event_id
+ * @return mixed
+ */
+ public function deleteEvent(Summit $summit, $event_id)
+ {
+ $event_repository = $this->event_repository;
+
+ return $this->tx_service->transaction(function () use ($summit, $event_id, $event_repository) {
+
+ $event = $event_repository->getById($event_id);
+
+ if (is_null($event))
+ throw new EntityNotFoundException(sprintf("event id %s does not exists!", $event_id));
+
+ if ($event->getSummit()->getIdentifier() !== $summit->getIdentifier())
+ throw new ValidationException(sprintf("event %s does not belongs to summit id %s", $event_id, $summit->getIdentifier()));
+
+ $event_repository->delete($event);
+ // clean up summit attendees schedule
+ $event_repository->cleanupAttendeesScheduleForEvent($event_id);
+ return true;
+ });
+ }
+
+ /**
+ * @param Summit $summit
+ * @param $external_order_id
+ * @return array
+ * @throws ValidationException
+ * @throws EntityNotFoundException
+ * @throws Exception
+ */
+ public function getExternalOrder(Summit $summit, $external_order_id)
+ {
+ try {
+ $external_order = $this->eventbrite_api->getOrder($external_order_id);
+
+ if (isset($external_order['attendees'])) {
+ $status = $external_order['status'];
+ $summit_external_id = $external_order['event_id'];
+
+ if (intval($summit->getSummitExternalId()) !== intval($summit_external_id))
+ throw new ValidationException('order %s does not belongs to current summit!', $external_order_id);
+
+ if ($status !== 'placed')
+ throw new ValidationException(sprintf('invalid order status %s for order %s', $status, $external_order_id));
+
+ $attendees = array();
+ foreach ($external_order['attendees'] as $a) {
+
+ $ticket_external_id = intval($a['ticket_class_id']);
+ $ticket_type = $summit->getTicketTypeByExternalId($ticket_external_id);
+ $external_attendee_id = $a['id'];
+
+ if (is_null($ticket_type))
+ throw new EntityNotFoundException(sprintf('external ticket type %s not found!', $ticket_external_id));
+
+ $old_ticket = $this->ticket_repository->getByExternalOrderIdAndExternalAttendeeId
+ (
+ trim($external_order_id), $external_attendee_id
+ );
+
+ if (!is_null($old_ticket)) continue;
+
+ array_push($attendees, array(
+ 'external_id' => intval($a['id']),
+ 'first_name' => $a['profile']['first_name'],
+ 'last_name' => $a['profile']['last_name'],
+ 'company' => $a['profile']['company'],
+ 'email' => $a['profile']['email'],
+ 'job_title' => $a['profile']['job_title'],
+ 'status' => $a['status'],
+ 'ticket_type' => array
+ (
+ 'id' => intval($ticket_type->getId()),
+ 'name' => $ticket_type->getName(),
+ 'external_id' => $ticket_external_id,
+ )
+ ));
+ }
+ if (count($attendees) === 0)
+ throw new ValidationException(sprintf('order %s already redeem!', $external_order_id));
+
+ return array('id' => intval($external_order_id), 'attendees' => $attendees);
+ }
+ } catch (ClientException $ex1) {
+ if ($ex1->getCode() === 400)
+ throw new EntityNotFoundException('external order does not exists!');
+ if ($ex1->getCode() === 403)
+ throw new EntityNotFoundException('external order does not exists!');
+ throw $ex1;
+ } catch (Exception $ex) {
+ throw $ex;
+ }
+ }
+
+ /**
+ * @param ConfirmationExternalOrderRequest $request
+ * @return SummitAttendee
+ */
+ public function confirmExternalOrderAttendee(ConfirmationExternalOrderRequest $request)
+ {
+ return $this->tx_service->transaction(function () use ($request) {
+
+ try {
+
+ $external_order = $this->eventbrite_api->getOrder($request->getExternalOrderId());
+
+ if (isset($external_order['attendees'])) {
+
+ $summit_external_id = $external_order['event_id'];
+
+ if (intval($request->getSummit()->getSummitExternalId()) !== intval($summit_external_id))
+ throw new ValidationException('order %s does not belongs to current summit!', $request->getExternalOrderId());
+
+ $external_attendee = null;
+ foreach ($external_order['attendees'] as $a) {
+ if (intval($a['id']) === intval($request->getExternalAttendeeId())) {
+ $external_attendee = $a;
+ break;
+ }
+ }
+
+ if (is_null($external_attendee))
+ throw new EntityNotFoundException(sprintf('attendee %s not found!', $request->getExternalAttendeeId()));
+
+ $ticket_external_id = intval($external_attendee['ticket_class_id']);
+ $ticket_type = $request->getSummit()->getTicketTypeByExternalId($ticket_external_id);
+
+ if (is_null($ticket_type))
+ throw new EntityNotFoundException(sprintf('ticket type %s not found!', $ticket_external_id));;
+
+ $status = $external_order['status'];
+ if ($status !== 'placed')
+ throw new ValidationException(sprintf('invalid order status %s for order %s', $status, $request->getExternalOrderId()));
+
+ $old_attendee = $request->getSummit()->getAttendeeByMemberId($request->getMemberId());
+
+ if (!is_null($old_attendee))
+ throw new ValidationException
+ (
+ 'attendee already exists for current summit!'
+ );
+
+ $old_ticket = $this->ticket_repository->getByExternalOrderIdAndExternalAttendeeId(
+ $request->getExternalOrderId(),
+ $request->getExternalAttendeeId()
+ );
+
+ if (!is_null($old_ticket))
+ throw new ValidationException
+ (
+ sprintf
+ (
+ 'order %s already redeem for attendee id %s !',
+ $request->getExternalOrderId(),
+ $request->getExternalAttendeeId()
+ )
+ );
+
+ $ticket = new SummitAttendeeTicket;
+ $ticket->setExternalOrderId( $request->getExternalOrderId());
+ $ticket->setExternalAttendeeId($request->getExternalAttendeeId());
+ $ticket->setBoughtDate(new DateTime($external_attendee['created']));
+ $ticket->setChangedDate(new DateTime($external_attendee['changed']));
+ $ticket->setTicketType($ticket_type);
+
+ $attendee = new SummitAttendee;
+ $attendee->setMember($this->member_repository->getById($request->getMemberId()));
+ $attendee->setSummit($request->getSummit());
+ $attendee->addTicket($ticket);
+
+ $this->attendee_repository->add($attendee);
+
+ return $attendee;
+ }
+ } catch (ClientException $ex1) {
+ if ($ex1->getCode() === 400)
+ throw new EntityNotFoundException('external order does not exists!');
+ if ($ex1->getCode() === 403)
+ throw new EntityNotFoundException('external order does not exists!');
+ throw $ex1;
+ } catch (Exception $ex) {
+ throw $ex;
+ }
+
+ });
+ }
+
+}
\ No newline at end of file
diff --git a/app/Services/ServicesProvider.php b/app/Services/ServicesProvider.php
index 54830f2c..bb10113a 100644
--- a/app/Services/ServicesProvider.php
+++ b/app/Services/ServicesProvider.php
@@ -33,8 +33,11 @@ class ServicesProvider extends ServiceProvider
public function register()
{
App::singleton('libs\utils\ICacheService', 'services\utils\RedisCacheService');
- App::singleton('libs\utils\ITransactionService', 'services\utils\EloquentTransactionService');
+ App::singleton(\libs\utils\ITransactionService::class, function(){
+ return new \services\utils\DoctrineTransactionService('ss');
+ });
App::singleton('services\model\ISummitService', 'services\model\SummitService');
+ App::singleton('services\model\IPresentationService', 'services\model\PresentationService');
App::singleton('services\apis\IEventbriteAPI', function(){
$api = new EventbriteAPI();
$api->setCredentials(array('token' => Config::get("server.eventbrite_oauth2_personal_token", null)));
diff --git a/app/Services/Utils/DoctrineTransactionService.php b/app/Services/Utils/DoctrineTransactionService.php
new file mode 100644
index 00000000..da26eaae
--- /dev/null
+++ b/app/Services/Utils/DoctrineTransactionService.php
@@ -0,0 +1,61 @@
+manager_name = $manager_name;
+ }
+
+ /**
+ * Execute a Closure within a transaction.
+ *
+ * @param Closure $callback
+ * @return mixed
+ *
+ * @throws \Exception
+ */
+ public function transaction(Closure $callback)
+ {
+ $em = Registry::getManager($this->manager_name);
+ try {
+ $em->getConnection()->beginTransaction(); // suspend auto-commit
+ $result = $callback($this);
+ $em->flush();
+ $em->getConnection()->commit();
+ } catch (\Exception $e) {
+ $em->getConnection()->rollBack();
+ throw $e;
+ }
+ return $result;
+ }
+}
\ No newline at end of file
diff --git a/app/Services/utils/EloquentTransactionService.php b/app/Services/Utils/EloquentTransactionService.php
similarity index 100%
rename from app/Services/utils/EloquentTransactionService.php
rename to app/Services/Utils/EloquentTransactionService.php
diff --git a/app/Services/utils/RedisCacheService.php b/app/Services/Utils/RedisCacheService.php
similarity index 100%
rename from app/Services/utils/RedisCacheService.php
rename to app/Services/Utils/RedisCacheService.php
diff --git a/app/Services/model/SummitService.php b/app/Services/model/SummitService.php
deleted file mode 100644
index 352589b1..00000000
--- a/app/Services/model/SummitService.php
+++ /dev/null
@@ -1,1296 +0,0 @@
-container = $values;
- }
-
- /**
- * @return array
- */
- public function values(){
- return array_values($this->container);
- }
-
- /**
- * @return int
- */
- public function size(){
- return count($this->container);
- }
- /**
- * @return int
- */
- public function getIdx(){ return $this->idx; }
-
- /**
- * Whether a offset exists
- * @link http://php.net/manual/en/arrayaccess.offsetexists.php
- * @param mixed $offset
- * An offset to check for.
- *
- * @return boolean true on success or false on failure.
- *
- *
- * The return value will be casted to boolean if non-boolean was returned.
- * @since 5.0.0
- */
- public function offsetExists($offset)
- {
- return isset($this->container[$offset]);
- }
-
- /**
- * Offset to retrieve
- * @link http://php.net/manual/en/arrayaccess.offsetget.php
- * @param mixed $offset
- * The offset to retrieve.
- *
- * @return mixed Can return all value types.
- * @since 5.0.0
- */
- public function offsetGet($offset)
- {
- return isset($this->container[$offset]) ? $this->container[$offset] : null;
- }
-
- /**
- * Offset to set
- * @link http://php.net/manual/en/arrayaccess.offsetset.php
- * @param mixed $offset
- * The offset to assign the value to.
- *
- * @param mixed $value
- * The value to set.
- *
- * @return void
- * @since 5.0.0
- */
- public function offsetSet($offset, $value)
- {
- if (is_null($offset)) {
- ++$this->idx;
- $this->container[] = $value;
- } else {
- $this->container[$offset] = $value;
- }
- }
-
- /**
- * Offset to unset
- * @link http://php.net/manual/en/arrayaccess.offsetunset.php
- * @param mixed $offset
- * The offset to unset.
- *
- * @return void
- * @since 5.0.0
- */
- public function offsetUnset($offset)
- {
- unset($this->container[$offset]);
- }
-}
-/**
- * Class SummitService
- * @package services\model
- */
-final class SummitService implements ISummitService
-{
-
- /**
- * minimun number of minutes that an event must last
- */
- const MIN_EVENT_MINUTES = 15;
- /**
- * @var ITransactionService
- */
- private $tx_service;
-
- /**
- * @var ISummitEventRepository
- */
- private $event_repository;
-
- /**
- * @var IEventbriteAPI
- */
- private $eventbrite_api;
-
- /**
- * @var ISpeakerRepository
- */
- private $speaker_repository;
-
-
- /**
- * SummitService constructor.
- * @param ISummitEventRepository $event_repository
- * @param ISpeakerRepository $speaker_repository
- * @param IEventbriteAPI $eventbrite_api
- * @param ITransactionService $tx_service
- */
- public function __construct
- (
- ISummitEventRepository $event_repository,
- ISpeakerRepository $speaker_repository,
- IEventbriteAPI $eventbrite_api,
- ITransactionService $tx_service
- )
- {
- $this->event_repository = $event_repository;
- $this->speaker_repository = $speaker_repository;
- $this->eventbrite_api = $eventbrite_api;
- $this->tx_service = $tx_service;
- }
-
- /**
- * @param Summit $summit
- * @param SummitAttendee $attendee
- * @param int $event_id
- * @return bool
- * @throws EntityNotFoundException
- */
- public function addEventToAttendeeSchedule(Summit $summit, SummitAttendee $attendee, $event_id)
- {
- $res = $this->tx_service->transaction(function() use($summit, $attendee, $event_id) {
- $event = $summit->getScheduleEvent($event_id);
- if (is_null($event)) {
- throw new EntityNotFoundException('event not found on summit!');
- }
-
- return $attendee->add2Schedule($event);
- });
- Event::fire(new MyScheduleAdd($attendee, $event_id));
- return $res;
- }
-
- /**
- * @param Summit $summit
- * @param SummitAttendee $attendee
- * @param $event_id
- * @return bool
- * @throws EntityNotFoundException
- */
- public function checkInAttendeeOnEvent(Summit $summit, SummitAttendee $attendee, $event_id)
- {
- return $this->tx_service->transaction(function() use($summit, $attendee, $event_id) {
- $event = $summit->getScheduleEvent($event_id);
- if(is_null($event)) throw new EntityNotFoundException('event not found on summit!');
- return $attendee->checkIn($event);
- });
- }
-
- /**
- * @param Summit $summit
- * @param SummitAttendee $attendee
- * @param int $event_id
- * @return bool
- * @throws \Exception
- */
- public function removeEventFromAttendeeSchedule(Summit $summit, SummitAttendee $attendee, $event_id)
- {
- $res = $this->tx_service->transaction(function() use($summit, $attendee, $event_id) {
- $event = $summit->getScheduleEvent($event_id);
- if(is_null($event)) throw new EntityNotFoundException('event not found on summit!');
- return $attendee->removeFromSchedule($event);
- });
- Event::fire(new MyScheduleRemove($attendee, $event_id));
- return $res;
- }
-
- /**
- * @param Summit $summit
- * @param SummitEvent $event
- * @param array $feedback
- * @return SummitEventFeedback
- */
- public function addEventFeedback(Summit $summit, SummitEvent $event, array $feedback)
- {
-
- return $this->tx_service->transaction(function() use($summit, $event, $feedback) {
-
- if(!$event->AllowFeedBack)
- throw new ValidationException(sprintf("event id %s dont allow feedback", $event->ID));
-
- $attendee_id = intval($feedback['attendee_id']);
- $attendee = SummitAttendee::find($attendee_id);
- if(is_null($attendee)) throw new EntityNotFoundException();
-
- $newFeedback = new SummitEventFeedback();
- $newFeedback->Rate = $feedback['rate'];
- $newFeedback->Note = $feedback['note'];
- $newFeedback->OwnerID = $attendee->MemberID;
- $newFeedback->EventID = $event->ID;
-
- $event->addFeedBack($newFeedback);
-
- return $newFeedback;
- });
- }
-
- /**
- * @param Summit $summit
- * @param null|int $member_id
- * @param null|\DateTime $from_date
- * @param null|int $from_id
- * @param int $limit
- * @return array
- */
- public function getSummitEntityEvents(Summit $summit, $member_id = null, \DateTime $from_date = null, $from_id = null, $limit = 25)
- {
- return $this->tx_service->transaction(function() use($summit, $member_id, $from_date, $from_id, $limit) {
-
- $global_last_id = $summit->getLastEntityEventId();
- $from_id = !is_null($from_id)? intval($from_id) : null;
- $list = new EntityEventList;
- $ops_dictionary = array();
-
- $ops_dictionary['UPDATE'] = array();
- $ops_dictionary['DELETE'] = array();
- $ops_dictionary['INSERT'] = array();
- //special treatement for summit events
- $summit_events_ops = array();
- do {
-
- $last_event_id = 0;
- $last_event_date = 0;
-
-
- // if we got a from id and its greater than the last one, then break
- if(!is_null($from_id) && $global_last_id <= $from_id) break;
-
- $events = $summit->getEntityEvents($member_id, $from_id, $from_date, $limit);
-
- foreach ($events as $e) {
- if($list->size() === $limit) break;
- $last_event_id = intval($e->ID);
- $last_event_date = $e->Created;
- $metadata = $e->Metadata;
- $key = $e->EntityClassName.'.'.$e->EntityID;
-
- switch ($e->EntityClassName) {
- case 'Presentation':
- case 'SummitEvent':
- {
- $entity = $summit->getScheduleEvent($e->EntityID);
-
- if ($e->Type === 'UPDATE' || $e->Type === "INSERT") {
- $metadata = !empty($metadata) ? json_decode($metadata, true) : array();
- $published_old = isset($metadata['pub_old']) ? (bool)intval($metadata['pub_old']) : false;
- $published_current = isset($metadata['pub_new']) ? (bool)intval($metadata['pub_new']) : false;
-
- // the event was not published at the moment of UPDATE .. then skip it!
- if (!$published_old && !$published_current) continue;
-
- if (!is_null($entity)) // if event exists its bc its published
- {
- $type = $published_current && isset($metadata['pub_old']) && !$published_old ? 'INSERT' : $e->Type;
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, $type, $entity);
- if(!isset($summit_events_ops[$key])) $summit_events_ops[$key] = array();
- array_push($summit_events_ops[$key], array('idx' => $list->getIdx() - 1 , 'op' => $type));
- continue;
- }
- // if does not exists on schedule delete it
-
- if (in_array($e->EntityClassName . $e->EntityID, $ops_dictionary['DELETE'])) continue;
- array_push($ops_dictionary['DELETE'], $e->EntityClassName . $e->EntityID);
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, 'DELETE');
- }
- else if ($e->Type === 'DELETE') {
- if (in_array($e->EntityClassName . $e->EntityID, $ops_dictionary[$e->Type])) continue;
- array_push($ops_dictionary[$e->Type], $e->EntityClassName . $e->EntityID);
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, $e->Type);
- }
- }
- break;
- case 'MySchedule': {
- if (!is_null($member_id) && intval($member_id) === intval($e->OwnerID)) {
- if ($e->Type === 'INSERT') {
- $entity = $summit->getScheduleEvent($e->EntityID);
- if (is_null($entity)) continue;
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, $e->Type);
- } else if ($e->Type === 'DELETE') {
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, $e->Type);
- }
- }
- }
- break;
- case 'Summit': {
- if (in_array($e->EntityClassName . $e->EntityID, $ops_dictionary[$e->Type])) continue;
- if (intval($e->EntityID) !== intval($summit->ID)) continue; // only current summit
- array_push($ops_dictionary[$e->Type], $e->EntityClassName . $e->EntityID);
- if ($e->Type === 'UPDATE' || $e->Type === "INSERT") {
- $entity = Summit::find(intval($e->EntityID));
- if (is_null($entity)) continue;
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, $e->Type, $entity);
-
- } else if ($e->Type === 'DELETE') {
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, $e->Type);
- }
- }
- break;
- case 'SummitType': {
- if (in_array($e->EntityClassName . $e->EntityID, $ops_dictionary[$e->Type])) continue;
- array_push($ops_dictionary[$e->Type], $e->EntityClassName . $e->EntityID);
-
- if ($e->Type === 'UPDATE' || $e->Type === "INSERT") {
- $entity = SummitType::find(intval($e->EntityID));
- if (is_null($entity)) continue;
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, $e->Type, $entity);
-
- } else if ($e->Type === 'DELETE') {
-
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, $e->Type);
- }
- }
- break;
- case 'SummitEventType': {
- if (in_array($e->EntityClassName . $e->EntityID, $ops_dictionary[$e->Type])) continue;
- array_push($ops_dictionary[$e->Type], $e->EntityClassName . $e->EntityID);
-
- if ($e->Type === 'UPDATE' || $e->Type === "INSERT") {
- $entity = SummitEventType::find(intval($e->EntityID));
- if (is_null($entity)) continue;
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, $e->Type, $entity);
-
- } else if ($e->Type === 'DELETE') {
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, $e->Type);
- }
- }
- break;
- case 'PresentationSpeaker': {
- if (in_array($e->EntityClassName . $e->EntityID, $ops_dictionary[$e->Type])) continue;
- array_push($ops_dictionary[$e->Type], $e->EntityClassName . $e->EntityID);
-
- if ($e->Type === 'UPDATE' || $e->Type === "INSERT") {
- $entity = PresentationSpeaker::find(intval($e->EntityID));
- if (is_null($entity)) continue;
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, $e->Type, $entity);
-
- } else if ($e->Type === 'DELETE') {
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, $e->Type);
- }
- }
- break;
- case 'SummitTicketType': {
- if (in_array($e->EntityClassName . $e->EntityID, $ops_dictionary[$e->Type])) continue;
- array_push($ops_dictionary[$e->Type], $e->EntityClassName . $e->EntityID);
-
- if ($e->Type === 'UPDATE' || $e->Type === "INSERT") {
- $entity = SummitTicketType::find(intval($e->EntityID));
- if (is_null($entity)) continue;
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, $e->Type, $entity);
-
- } else if ($e->Type === 'DELETE') {
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, $e->Type);
- }
- }
- break;
- case 'SummitVenueRoom': {
- if (in_array($e->EntityClassName . $e->EntityID, $ops_dictionary[$e->Type])) continue;
- array_push($ops_dictionary[$e->Type], $e->EntityClassName . $e->EntityID);
-
- if ($e->Type === 'UPDATE' || $e->Type === "INSERT") {
- $entity = SummitVenueRoom::find(intval($e->EntityID));
- if (is_null($entity)) continue;
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, $e->Type, $entity);
-
- } else if ($e->Type === 'DELETE') {
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, $e->Type);
- }
- }
- break;
- case 'SummitVenue': {
- if (in_array($e->EntityClassName . $e->EntityID, $ops_dictionary[$e->Type])) continue;
- array_push($ops_dictionary[$e->Type], $e->EntityClassName . $e->EntityID);
-
- if ($e->Type === 'UPDATE' || $e->Type === "INSERT") {
- $entity = SummitVenue::find(intval($e->EntityID));
- if (is_null($entity)) continue;
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, $e->Type, $entity);
-
- } else if ($e->Type === 'DELETE') {
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, $e->Type);
- }
- }
- break;
- case 'SummitLocationMap': {
- if (in_array($e->EntityClassName . $e->EntityID, $ops_dictionary[$e->Type])) continue;
- array_push($ops_dictionary[$e->Type], $e->EntityClassName . $e->EntityID);
-
- if ($e->Type === 'UPDATE' || $e->Type === "INSERT") {
- $entity = SummitLocationImage::find(intval($e->EntityID));
- if (is_null($entity)) continue;
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, $e->Type, $entity);
-
- } else if ($e->Type === 'DELETE') {
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, $e->Type);
- }
- }
- break;
- case 'SummitLocationImage': {
- if (in_array($e->EntityClassName . $e->EntityID, $ops_dictionary[$e->Type])) continue;
- array_push($ops_dictionary[$e->Type], $e->EntityClassName . $e->EntityID);
-
- if ($e->Type === 'UPDATE' || $e->Type === "INSERT") {
- $entity = SummitLocationImage::find(intval($e->EntityID));
- if (is_null($entity)) continue;
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, $e->Type, $entity);
-
- } else if ($e->Type === 'DELETE') {
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, $e->Type);
- }
- }
- break;
- case 'SummitHotel': {
- if (in_array($e->EntityClassName . $e->EntityID, $ops_dictionary[$e->Type])) continue;
- array_push($ops_dictionary[$e->Type], $e->EntityClassName . $e->EntityID);
-
- if ($e->Type === 'UPDATE' || $e->Type === "INSERT") {
- $entity = SummitHotel::find(intval($e->EntityID));
- if (is_null($entity)) continue;
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, $e->Type, $entity);
-
- } else if ($e->Type === 'DELETE') {
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, $e->Type);
- }
- }
- break;
- case 'SummitAirport': {
- if (in_array($e->EntityClassName . $e->EntityID, $ops_dictionary[$e->Type])) continue;
- array_push($ops_dictionary[$e->Type], $e->EntityClassName . $e->EntityID);
-
- if ($e->Type === 'UPDATE' || $e->Type === "INSERT") {
- $entity = SummitAirport::find(intval($e->EntityID));
- if (is_null($entity)) continue;
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, $e->Type, $entity);
-
- } else if ($e->Type === 'DELETE') {
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, $e->Type);
- }
- }
- break;
- case 'PresentationCategory': {
- if (in_array($e->EntityClassName . $e->EntityID, $ops_dictionary[$e->Type])) continue;
- array_push($ops_dictionary[$e->Type], $e->EntityClassName . $e->EntityID);
-
- if ($e->Type === 'UPDATE' || $e->Type === "INSERT") {
- $entity = PresentationCategory::find(intval($e->EntityID));
- if (is_null($entity)) continue;
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, $e->Type, $entity);
-
- } else if ($e->Type === 'DELETE') {
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, $e->Type);
- }
- }
- break;
- case 'PresentationCategoryGroup': {
- if (in_array($e->EntityClassName . $e->EntityID, $ops_dictionary[$e->Type])) continue;
- array_push($ops_dictionary[$e->Type], $e->EntityClassName . $e->EntityID);
-
- if ($e->Type === 'UPDATE' || $e->Type === "INSERT") {
- $entity = PresentationCategoryGroup::find(intval($e->EntityID));
- if (is_null($entity)) continue;
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, $e->Type, $entity);
-
- } else if ($e->Type === 'DELETE') {
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, $e->Type);
- }
- }
- break;
- case 'TrackFromTrackGroup': {
- $metadata = !empty($metadata) ? json_decode($metadata, true) : array();
- if (count($metadata) === 0) continue;
- $group_id = isset($metadata['group_id']) ? intval($metadata['group_id']) : null;
- if (is_null($group_id)) continue;
- $entity = $summit->getCategoryGroup($group_id);
- if (is_null($entity)) continue;
- if (in_array('PresentationCategoryGroup' . $group_id, $ops_dictionary['UPDATE'])) continue;
- array_push($ops_dictionary['UPDATE'], 'PresentationCategoryGroup' . $group_id);
- $list[] = $this->serializeSummitEntityEvent($e, 'PresentationCategoryGroup', 'UPDATE', $entity);
- }
- break;
- case 'PresentationSlide': {
- if (in_array($e->EntityClassName . $e->EntityID, $ops_dictionary[$e->Type])) continue;
- array_push($ops_dictionary[$e->Type], $e->EntityClassName . $e->EntityID);
- if ($e->Type === 'UPDATE' || $e->Type === "INSERT") {
- $entity = PresentationSlide::find(intval($e->EntityID));
- if (is_null($entity)) continue;
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, $e->Type, $entity);
- } else if ($e->Type === 'DELETE') {
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, $e->Type);
- }
- }
- break;
- case 'PresentationVideo': {
- if (in_array($e->EntityClassName . $e->EntityID, $ops_dictionary[$e->Type])) continue;
- array_push($ops_dictionary[$e->Type], $e->EntityClassName . $e->EntityID);
-
- if ($e->Type === 'UPDATE' || $e->Type === "INSERT") {
- $entity = PresentationVideo::find(intval($e->EntityID));
- if (is_null($entity)) continue;
- $this->serializeSummitEntityEvent($e, $e->EntityClassName, $e->Type, $entity);
- } else if ($e->Type === 'DELETE') {
- $list[] = $this->serializeSummitEntityEvent($e, $e->EntityClassName, $e->Type);
- }
- }
- break;
- case 'SpeakerFromPresentation': {
- $metadata = !empty($metadata) ? json_decode($metadata, true) : array();
- if (count($metadata) === 0) continue;
- $presentation_id = isset($metadata['presentation_id']) ? intval($metadata['presentation_id']) : null;
- if (is_null($presentation_id)) continue;
- $entity = $summit->getScheduleEvent($presentation_id);
- if (is_null($entity)) continue;
- if (in_array('Presentation' . $presentation_id, $ops_dictionary['UPDATE'])) continue;
- array_push($ops_dictionary['UPDATE'], 'Presentation' . $presentation_id);
- $list[] = $this->serializeSummitEntityEvent($e, 'Presentation', 'UPDATE', $entity);
- }
- break;
- case 'SummitTypeFromEvent': {
- $metadata = !empty($metadata) ? json_decode($metadata, true) : array();
- if (count($metadata) === 0) continue;
- $event_id = isset($metadata['event_id']) ? intval($metadata['event_id']) : null;
- if (is_null($event_id)) continue;
- $entity = $summit->getScheduleEvent($event_id);
- if (is_null($entity)) continue;
- if (in_array('SummitEvent' . $event_id, $ops_dictionary['UPDATE'])) continue;
- array_push($ops_dictionary['UPDATE'], 'SummitEvent' . $event_id);
- $list[] = $this->serializeSummitEntityEvent($e, 'SummitEvent', 'UPDATE', $entity);
- }
- break;
- case 'SponsorFromEvent': {
- $metadata = !empty($metadata) ? json_decode($metadata, true) : array();
- if (count($metadata) === 0) continue;
- $event_id = isset($metadata['event_id']) ? intval($metadata['event_id']) : null;
- if (is_null($event_id)) continue;
- $entity = $summit->getScheduleEvent($event_id);
- if (is_null($entity)) continue;
- if (in_array('SummitEvent' . $event_id, $ops_dictionary['UPDATE'])) continue;
- array_push($ops_dictionary['UPDATE'], 'SummitEvent' . $event_id);
- $list[] = $this->serializeSummitEntityEvent($e, 'SummitEvent', 'UPDATE', $entity);
- }
- break;
- case 'WipeData': {
- // if event is for a particular user
- if (intval($e->EntityID) > 0) {
- // if we are not the recipient or its already processed then continue
- if (intval($member_id) !== intval($e->EntityID))
- continue;
- }
- $list[] = $this->serializeSummitEntityEvent($e, 'TRUNCATE', 'TRUNCATE');
- }
- break;
- }
- }
-
- // reset if we do not get any data so far, to get next batch
- $from_id = $last_event_id;
- $from_date = null;
- //post process for summit events , we should send only te last one
- foreach($summit_events_ops as $key => $ops)
- {
- $last_idx = null;
- $last_op = null;
- $must_insert = false;
- foreach($ops as $op)
- {
- if(!is_null($last_idx))
- unset($list[$last_idx]);
- $last_op = $op['op'];
- $last_idx = intval($op['idx']);
- $must_insert = !$must_insert && $last_op === 'INSERT' ? true : $must_insert;
- }
- $last_op = $must_insert && $last_op !== 'DELETE' ? 'INSERT' : $last_op;
- $summit_events_ops[$key] = array([ 'idx' => $last_idx, 'op' => ( $last_op ) ]);
- // element update
- $e = $list[$last_idx];
- $e['type'] = $last_op;
- $list[$last_idx] = $e;
- }
- // we do not have any any to process
- if($last_event_id == 0 || $global_last_id <= $last_event_id) break;
- } while($list->size() < $limit);
- return array($last_event_id, $last_event_date, $list->values());
- });
- }
-
- /**
- * @param SummitEntityEvent $e
- * @param $class_name
- * @param $type
- * @param null $entity
- * @return array
- */
- private function serializeSummitEntityEvent(SummitEntityEvent $e, $class_name, $type, $entity = null)
- {
- $row = array
- (
- 'id' => intval($e->ID),
- 'created' => JsonUtils::toEpoch($e->Created),
- 'class_name' => $class_name,
- 'entity_id' => intval($e->EntityID),
- 'type' => $type,
- );
-
- if(!is_null($entity))
- {
- $data = $entity->toArray();
- if(isset($data['speakers']))
- {
- unset($data['speakers']);
- $speakers = array();
- foreach($entity->speakers() as $speaker)
- {
- array_push($speakers, $speaker->toArray());
- }
- $data['speakers'] = $speakers;
- }
-
- if(isset($data['sponsors']))
- {
- unset($data['sponsors']);
- $sponsors = array();
- foreach($entity->sponsors() as $sponsor)
- {
- array_push($sponsors, $sponsor->toArray());
- }
- $data['sponsors'] = $sponsors;
- }
-
- if($entity instanceof PresentationCategoryGroup)
- {
- $categories = array();
- foreach($entity->categories() as $c)
- {
- array_push($categories, $c->toArray());
- }
- $data['tracks'] = $categories;
- }
-
- $row['entity'] = $data;
- }
-
- return $row;
- }
-
- /**
- * @param Summit $summit
- * @param array $data
- * @return SummitEvent
- */
- public function addEvent(Summit $summit, array $data)
- {
- return $this->saveOrUpdateEvent($summit, $data);
- }
-
- /**
- * @param Summit $summit
- * @param int $event_id
- * @param array $data
- * @return SummitEvent
- */
- public function updateEvent(Summit $summit, $event_id, array $data)
- {
- return $this->saveOrUpdateEvent($summit, $data, $event_id);
- }
-
- /**
- * @param Summit $summit
- * @param array $data
- * @param null|int $event_id
- * @return SummitEvent
- */
- private function saveOrUpdateEvent(Summit $summit, array $data, $event_id = null)
- {
- $event_repository = $this->event_repository;
-
- return $this->tx_service->transaction(function() use($summit, $data, $event_id, $event_repository) {
-
- $start_datetime = null;
- $end_datetime = null;
-
- if(isset($data['start_date']) && isset($data['end_date']))
- {
- $start_datetime = intval($data['start_date']);
- $start_datetime = new \DateTime("@$start_datetime");
- $end_datetime = intval($data['end_date']);
- $end_datetime = new \DateTime("@$end_datetime");
- $interval = $end_datetime->diff($start_datetime);
- if($interval->i < self::MIN_EVENT_MINUTES )
- throw new ValidationException
- (
- sprintf
- (
- "event should last at lest %s minutes - current duration %s",
- self::MIN_EVENT_MINUTES,
- $interval->i
- )
- );
- }
-
- // check start/end datetime with summit
- $event_type = null;
- if(isset($data['type_id'])) {
- $event_type = $summit->getEventType(intval($data['type_id']));
- if (is_null($event_type)) {
- throw new EntityNotFoundException(sprintf("event type id %s does not exists!", $data['type_id']));
- }
- }
-
- $location = null;
- if(isset($data['location_id'])) {
- $location = $summit->getLocation(intval($data['location_id']));
- if (is_null($location)) {
- throw new EntityNotFoundException(sprintf("location id %s does not exists!", $data['location_id']));
- }
- }
-
- $summit_types = array();
- if(isset($data['summit_types_id'])) {
- foreach ($data['summit_types_id'] as $summit_type_id) {
- $summit_type = $summit->getSummitType($summit_type_id);
- if (is_null($summit_type)) {
- throw new ValidationException(sprintf("summit type id %s does not exists!", $summit_type_id));
- }
- array_push($summit_types, $summit_type);
- }
- }
-
- if(is_null($event_id)){
- $event = SummitEventFactory::build($event_type);
- }
- else
- {
- $event = $event_repository->getById($event_id);
- if(is_null($event))
- throw new ValidationException(sprintf("event id %s does not exists!", $event_id));
- }
-
- if(isset($data['title']))
- $event->setTitle($data['title']);
-
- if(isset($data['description']))
- $event->setDescription($data['description']);
-
- if(isset($data['allow_feedback']))
- $event->setAllowFeedBack($data['allow_feedback']);
-
- if(!is_null($event_type))
- $event->setType($event_type);
-
- $event->setSummit($summit);
-
- if(!is_null($location))
- $event->setLocation($location);
-
- if(!is_null($start_datetime) && !is_null($end_datetime)) {
- $event->StartDate = $start_datetime;
- $event->EndDate = $end_datetime;
-
- if(!$summit->isEventInsideSummitDuration($event))
- throw new ValidationException
- (
- sprintf
- (
- "event start/end (%s - %s) does not match with summit start/end (%s - %s)",
- $start_datetime->format('Y-m-d H:i:s'),
- $end_datetime->format('Y-m-d H:i:s'),
- $summit->getLocalBeginDate()>format('Y-m-d H:i:s'),
- $summit->getLocalEndDate()>format('Y-m-d H:i:s')
- )
- );
- }
-
- $event_repository->add($event);
-
- if(count($summit_types) > 0) {
- $event->clearSummitTypes();
- foreach ($summit_types as $summit_type) {
- $event->addSummitType($summit_type);
- }
- }
-
- if(isset($data['tags']) && count($data['tags']) > 0) {
- $event->clearTags();
- foreach ($data['tags'] as $tag) {
- $event->addTag($tag);
- }
- }
-
- return $event;
- });
- }
-
- /**
- * @param Summit $summit
- * @param int $event_id
- * @param array $data
- * @return SummitEvent
- */
- public function publishEvent(Summit $summit, $event_id, array $data)
- {
- $event_repository = $this->event_repository;
-
- return $this->tx_service->transaction(function () use ($summit, $data, $event_id, $event_repository) {
-
- $event = $event_repository->getById($event_id);
-
- if(is_null($event))
- throw new EntityNotFoundException(sprintf("event id %s does not exists!", $event_id));
-
- if(is_null($event->getType()))
- throw new EntityNotFoundException(sprintf("event type its not assigned to event id %s!", $event_id));
-
- if(is_null($event->getSummit()))
- throw new EntityNotFoundException(sprintf("summit its not assigned to event id %s!", $event_id));
-
- if($event->getSummit()->getIdentifier() !== $summit->getIdentifier())
- throw new ValidationException(sprintf("event %s does not belongs to summit id %s", $event_id, $summit->getIdentifier()));
-
- $start_datetime = $event->StartDate;
- $end_datetime = $event->EndDate;
-
- if(isset($data['start_date']) && isset($data['end_date'])) {
- $start_datetime = intval($data['start_date']);
- $start_datetime = new \DateTime("@$start_datetime");
- $end_datetime = intval($data['end_date']);
- $end_datetime = new \DateTime("@$end_datetime");
- }
-
- if(is_null($start_datetime))
- throw new ValidationException(sprintf("start_date its not assigned to event id %s!", $event_id));
-
- if(is_null($end_datetime))
- throw new ValidationException(sprintf("end_date its not assigned to event id %s!", $event_id));
-
- if(isset($data['location_id']))
- {
- $location = $summit->getLocation(intval($data['location_id']));
- if(is_null($location))
- throw new EntityNotFoundException(sprintf("location id %s does not exists!", $data['location_id']));
-
- $event->setLocation($location);
- }
-
- $current_event_location = $event->getLocation();
-
- // validate blackout times
- $conflict_events = $event_repository->getPublishedOnSameTimeFrame($event);
- if(!is_null($conflict_events)) {
- foreach ($conflict_events as $c_event) {
- // if the published event is BlackoutTime or if there is a BlackoutTime event in this timeframe
- if (($event->getType()->BlackoutTimes || $c_event->getType()->BlackoutTimes) && $event->ID != $c_event->ID) {
- throw new ValidationException(sprintf("You can't publish on this time frame, it conflicts with event id %s",
- $c_event->ID));
- }
- // if trying to publish an event on a slot occupied by another event
- if ($current_event_location->getIdentifier() == $c_event->getLocation()->getIdentifier() && $event->ID != $c_event->ID) {
- throw new ValidationException(sprintf("You can't publish on this time frame, it conflicts with event id %s",
- $c_event->ID));
- }
-
- // check speakers collisions
- if ($event instanceof Presentation && $c_event instanceof Presentation && $event->ID != $c_event->ID) {
- foreach ($event->speakers() as $current_speaker) {
- foreach ($c_event->speakers() as $c_speaker) {
- if (intval($c_speaker->ID) === intval($current_speaker->ID)) {
- throw new ValidationException
- (
- sprintf
- (
- 'speaker id % belongs already to another event ( %s) on that time frame',
- $c_speaker->ID,
- $c_event->ID
- )
- );
- }
- }
- }
- }
-
- }
- }
-
- $event->unPublish();
- $event->publish();
- $event_repository->add($event);
- return $event;
- });
- }
- /**
- * @param Summit $summit
- * @param int $event_id
- * @return mixed
- */
- public function unPublishEvent(Summit $summit, $event_id)
- {
- $event_repository = $this->event_repository;
-
- return $this->tx_service->transaction(function () use ($summit, $event_id, $event_repository) {
-
- $event = $event_repository->getById($event_id);
-
- if(is_null($event))
- throw new EntityNotFoundException(sprintf("event id %s does not exists!", $event_id));
-
- if($event->getSummit()->getIdentifier() !== $summit->getIdentifier())
- throw new ValidationException(sprintf("event %s does not belongs to summit id %s", $event_id, $summit->getIdentifier()));
-
- $event->unPublish();
- $event_repository->add($event);
- $this->cleanupAttendeesSchedule($event_id);
- return $event;
- });
- }
-
- /**
- * @param Summit $summit
- * @param int $event_id
- * @return mixed
- */
- public function deleteEvent(Summit $summit, $event_id)
- {
- $event_repository = $this->event_repository;
-
- return $this->tx_service->transaction(function () use ($summit, $event_id, $event_repository) {
-
- $event = $event_repository->getById($event_id);
-
- if(is_null($event))
- throw new EntityNotFoundException(sprintf("event id %s does not exists!", $event_id));
-
- if($event->getSummit()->getIdentifier() !== $summit->getIdentifier())
- throw new ValidationException(sprintf("event %s does not belongs to summit id %s", $event_id, $summit->getIdentifier()));
-
- $event_repository->delete($event);
- // clean up summit attendees schedule
- $this->cleanupAttendeesSchedule($event_id);
- return true;
- });
- }
-
- /**
- * @param int $event_id
- */
- private function cleanupAttendeesSchedule($event_id){
- DB::connection('ss')->delete("DELETE SummitAttendee_Schedule FROM SummitAttendee_Schedule WHERE SummitEventID = {$event_id};");
- }
- /**
- * @param Summit $summit
- * @param $external_order_id
- * @return array
- * @throws ValidationException
- * @throws EntityNotFoundException
- * @throws Exception
- */
- public function getExternalOrder(Summit $summit, $external_order_id)
- {
- try{
- $external_order = $this->eventbrite_api->getOrder($external_order_id);
- if (isset($external_order['attendees']))
- {
- $status = $external_order['status'];
- $summit_external_id = $external_order['event_id'];
- $order_summit = Summit::where('ExternalEventId', '=', $summit_external_id)->first();
- if(is_null($summit))
- throw new EntityNotFoundException('summit does not exists!');
- if(intval($summit->ID) !== intval($order_summit->ID))
- throw new ValidationException('order %s does not belongs to current summit!', $external_order_id);
- if($status !== 'placed')
- throw new ValidationException(sprintf('invalid order status %s for order %s',$status, $external_order_id));
- $attendees = array();
- foreach($external_order['attendees'] as $a)
- {
-
- $ticket_external_id = intval($a['ticket_class_id']);
- $ticket_type = SummitTicketType::where('ExternalId', '=', $ticket_external_id)->first();
- $redeem_attendee = SummitAttendeeTicket::where('ExternalOrderId', '=' , trim($external_order_id))
- ->where('ExternalAttendeeId','=',$a['id'])
- ->first();;
-
- if(!is_null($redeem_attendee)) continue;
- if(is_null($ticket_type))
- throw new EntityNotFoundException(sprintf('external ticket type %s not found!', $ticket_external_id));
-
- array_push($attendees, array(
- 'external_id' => intval($a['id']),
- 'first_name' => $a['profile']['first_name'],
- 'last_name' => $a['profile']['last_name'],
- 'company' => $a['profile']['company'],
- 'email' => $a['profile']['email'],
- 'job_title' => $a['profile']['job_title'],
- 'status' => $a['status'],
- 'ticket_type' => array
- (
- 'id' => intval($ticket_type->ID),
- 'name' => $ticket_type->Name,
- 'external_id' => $ticket_external_id,
- )
- ));
- }
- if(count($attendees) === 0)
- throw new ValidationException(sprintf('order %s already redeem!', $external_order_id));
-
- return array('id' => intval($external_order_id), 'attendees' => $attendees);
- }
- }
- catch(ClientException $ex1){
- if($ex1->getCode() === 400)
- throw new EntityNotFoundException('external order does not exists!');
- if($ex1->getCode() === 403)
- throw new EntityNotFoundException('external order does not exists!');
- throw $ex1;
- }
- catch(Exception $ex){
- throw $ex;
- }
- }
-
- /**
- * @param Summit $summit
- * @param int $me_id
- * @param int $external_order_id
- * @param int $external_attendee_id
- * @return SummitAttendee
- */
- public function confirmExternalOrderAttendee(Summit $summit, $me_id, $external_order_id, $external_attendee_id)
- {
- return $this->tx_service->transaction(function () use ($summit, $me_id, $external_order_id, $external_attendee_id){
-
- try{
- $external_order = $this->eventbrite_api->getOrder($external_order_id);
- if (isset($external_order['attendees']))
- {
- $external_attendee = null;
- foreach($external_order['attendees'] as $a)
- {
- if(intval($a['id']) === intval($external_attendee_id)) {
- $external_attendee = $a;
- break;
- }
- }
-
- if(is_null($external_attendee))
- throw new EntityNotFoundException(sprintf('attendee %s not found!', $external_attendee_id));
-
- $ticket_external_id = intval($external_attendee['ticket_class_id']);
- $ticket_type = SummitTicketType::where('ExternalId', '=', $ticket_external_id)->first();
- if(is_null($ticket_type))
- throw new EntityNotFoundException(sprintf('ticket type %s not found!', $ticket_external_id));;
-
- $status = $external_order['status'];
- $summit_external_id = $external_order['event_id'];
- $order_summit = Summit::where('ExternalEventId', '=', $summit_external_id)->first();
- if(is_null($summit))
- throw new EntityNotFoundException('summit does not exists!');
- if(intval($summit->ID) !== intval($order_summit->ID))
- throw new ValidationException('order %s does not belongs to current summit!', $external_order_id);
- if($status !== 'placed')
- throw new ValidationException(sprintf('invalid order status %s for order %s',$status, $external_order_id));
-
- $old_attendee = SummitAttendee::where('MemberID', '=', $me_id)->where('SummitID','=', $summit->ID)->first();
-
- if(!is_null($old_attendee))
- throw new ValidationException
- (
- 'attendee already exist for current summit!'
- );
-
- $old_ticket = SummitAttendeeTicket
- ::where('ExternalOrderId','=', $external_order_id)
- ->where('ExternalAttendeeId','=', $external_attendee_id)->first();
-
- if(!is_null($old_ticket))
- throw new ValidationException
- (
- sprintf
- (
- 'order %s already redeem for attendee id %s !',
- $external_order_id,
- $external_attendee_id
- )
- );
-
- $attendee = new SummitAttendee;
- $attendee->MemberID = $me_id;
- $attendee->SummitID = $summit->ID;
- $attendee->save();
-
- $ticket = new SummitAttendeeTicket;
- $ticket->ExternalOrderId = intval($external_order_id);
- $ticket->ExternalAttendeeId = intval($external_attendee_id);
- $ticket->TicketBoughtDate = $external_attendee['created'];
- $ticket->TicketChangedDate = $external_attendee['changed'];
- $ticket->TicketTypeID = $ticket_type->getIdentifier();
- $ticket->OwnerID = $attendee->ID;
- $ticket->save();
-
- return $attendee;
- }
- }
- catch(ClientException $ex1){
- if($ex1->getCode() === 400)
- throw new EntityNotFoundException('external order does not exists!');
- if($ex1->getCode() === 403)
- throw new EntityNotFoundException('external order does not exists!');
- throw $ex1;
- }
- catch(Exception $ex){
- throw $ex;
- }
-
- });
- }
-
- /**
- * @param Summit $summit
- * @param string $expand
- * @return array
- */
- public function getSummitData(Summit $summit, $expand)
- {
- $data = $summit->toArray();
- // summit types
- $summit_types = array();
- foreach ($summit->summit_types() as $type) {
- array_push($summit_types, $type->toArray());
- }
- $data['summit_types'] = $summit_types;
- // tickets
- $ticket_types = array();
- foreach ($summit->ticket_types() as $ticket) {
- array_push($ticket_types, $ticket->toArray());
- }
- $data['ticket_types'] = $ticket_types;
- //locations
- $locations = array();
- foreach ($summit->locations() as $location) {
- array_push($locations, $location->toArray());
- }
- $data['locations'] = $locations;
-
- $data['ticket_types'] = $ticket_types;
- if (!empty($expand)) {
- $expand = explode(',', $expand);
- foreach ($expand as $relation) {
- switch (trim($relation)) {
- case 'schedule': {
- $event_types = array();
- foreach ($summit->event_types() as $event_type) {
- array_push($event_types, $event_type->toArray());
- }
- $data['event_types'] = $event_types;
-
- $sponsors = array();
- foreach ($summit->sponsors() as $company) {
- array_push($sponsors, $company->toArray());
- }
- $data['sponsors'] = $sponsors;
-
- $speakers = array();
- $res = $this->speaker_repository->getSpeakersBySummit($summit, new PagingInfo(1 , PHP_INT_MAX));
- foreach ($res->getItems() as $speaker) {
- array_push($speakers, $speaker->toArray($summit->ID));
- }
- $data['speakers'] = $speakers;
-
- $presentation_categories = array();
- foreach ($summit->presentation_categories() as $cat) {
- array_push($presentation_categories, $cat->toArray());
- }
- $data['tracks'] = $presentation_categories;
-
- // track_groups
- $track_groups = array();
- foreach ($summit->category_groups() as $group) {
- array_push($track_groups, $group->toArray());
- }
- $data['track_groups'] = $track_groups;
- $schedule = array();
- list($total, $per_page, $current_page, $last_page, $items) = $summit->schedule(1,
- PHP_INT_MAX);
- foreach ($items as $event) {
- array_push($schedule, $event->toArray());
- }
- $data['schedule'] = $schedule;
-
- }
- break;
- }
- }
- }
- $data['timestamp'] = time();
- return $data;
- }
-}
\ No newline at end of file
diff --git a/artisan b/artisan
old mode 100755
new mode 100644
index eb5e2bb6..df630d0d
--- a/artisan
+++ b/artisan
@@ -28,11 +28,11 @@ $app = require_once __DIR__.'/bootstrap/app.php';
|
*/
-$kernel = $app->make('Illuminate\Contracts\Console\Kernel');
+$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
$status = $kernel->handle(
- $input = new Symfony\Component\Console\Input\ArgvInput,
- new Symfony\Component\Console\Output\ConsoleOutput
+ $input = new Symfony\Component\Console\Input\ArgvInput,
+ new Symfony\Component\Console\Output\ConsoleOutput
);
/*
diff --git a/bootstrap/app.php b/bootstrap/app.php
index f9e94b4b..f2801adf 100644
--- a/bootstrap/app.php
+++ b/bootstrap/app.php
@@ -12,7 +12,7 @@
*/
$app = new Illuminate\Foundation\Application(
- realpath(__DIR__.'/../')
+ realpath(__DIR__.'/../')
);
/*
@@ -27,21 +27,20 @@ $app = new Illuminate\Foundation\Application(
*/
$app->singleton(
- 'Illuminate\Contracts\Http\Kernel',
- 'App\Http\Kernel'
+ Illuminate\Contracts\Http\Kernel::class,
+ App\Http\Kernel::class
);
$app->singleton(
- 'Illuminate\Contracts\Console\Kernel',
- 'App\Console\Kernel'
+ Illuminate\Contracts\Console\Kernel::class,
+ App\Console\Kernel::class
);
$app->singleton(
- 'Illuminate\Contracts\Debug\ExceptionHandler',
- 'App\Exceptions\Handler'
+ Illuminate\Contracts\Debug\ExceptionHandler::class,
+ App\Exceptions\Handler::class
);
-
/*
|--------------------------------------------------------------------------
| Return The Application
@@ -53,5 +52,4 @@ $app->singleton(
|
*/
-
-return $app;
\ No newline at end of file
+return $app;
diff --git a/bootstrap/autoload.php b/bootstrap/autoload.php
index 17718f5d..38301379 100644
--- a/bootstrap/autoload.php
+++ b/bootstrap/autoload.php
@@ -27,9 +27,8 @@ require __DIR__.'/../vendor/autoload.php';
|
*/
-$compiledPath = __DIR__.'/../vendor/compiled.php';
+$compiledPath = __DIR__.'/cache/compiled.php';
-if (file_exists($compiledPath))
-{
- require $compiledPath;
-}
\ No newline at end of file
+if (file_exists($compiledPath)) {
+ require $compiledPath;
+}
diff --git a/bootstrap/cache/.gitignore b/bootstrap/cache/.gitignore
new file mode 100644
index 00000000..d6b7ef32
--- /dev/null
+++ b/bootstrap/cache/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore
diff --git a/clear_logs.sh b/clear_logs.sh
new file mode 100755
index 00000000..a8e1de13
--- /dev/null
+++ b/clear_logs.sh
@@ -0,0 +1,2 @@
+#!/usr/bin/env bash
+sudo rm -R storage/logs/*
diff --git a/composer.json b/composer.json
index 270c2788..65c4077c 100644
--- a/composer.json
+++ b/composer.json
@@ -1,56 +1,63 @@
{
- "name": "openstack-infra/openstackid-resources",
- "description": "The OpenStackId Resource Server.",
- "keywords": [
- "framework",
- "laravel"
- ],
- "license": "MIT",
- "type": "project",
- "require": {
- "laravel/framework": "5.0.*",
- "predis/predis": "1.0.1",
- "php": ">=5.4.0",
- "guzzlehttp/guzzle": "5.3.0",
- "ezyang/htmlpurifier": "4.7.0"
- },
- "require-dev": {
- "phpunit/phpunit": "4.6.6",
- "phpspec/phpspec": "~2.1",
- "mockery/mockery": "0.9.4",
- "squizlabs/php_codesniffer": "2.*",
- "pragmarx/laravelcs": "*",
- "glenscott/url-normalizer" : "1.4.0"
- },
- "autoload": {
- "classmap": [
- "database",
- "app"
+ "name": "openstack-infra/openstackid-resources",
+ "description": "The OpenStackId Resource Server.",
+ "keywords": [
+ "framework",
+ "laravel"
],
- "psr-4": {
- "App\\": "app/"
+ "license": "MIT",
+ "type": "project",
+ "require": {
+ "php": ">=5.5.9",
+ "laravel/framework": "5.2.*",
+ "predis/predis": "1.0.1",
+ "guzzlehttp/guzzle": "5.3.0",
+ "ezyang/htmlpurifier": "4.7.0",
+ "glenscott/url-normalizer" : "^1.4",
+ "laravel-doctrine/orm":"1.1.*",
+ "laravel-doctrine/extensions": "^1.0",
+ "cocur/slugify": "^2.3"
+ },
+ "require-dev": {
+ "fzaninotto/faker": "~1.4",
+ "mockery/mockery": "0.9.*",
+ "phpunit/phpunit": "~4.0",
+ "symfony/css-selector": "2.8.*|3.0.*",
+ "symfony/dom-crawler": "2.8.*|3.0.*"
+ },
+ "autoload": {
+ "classmap": [
+ "database",
+ "app",
+ "tests",
+ "Libs"
+ ],
+ "psr-4": {
+ "App\\": "app/"
+ }
+ },
+ "autoload-dev": {
+ "classmap": [
+ "tests/TestCase.php"
+ ]
+ },
+ "scripts": {
+ "post-root-package-install": [
+ "php -r \"copy('.env.example', '.env');\""
+ ],
+ "post-create-project-cmd": [
+ "php artisan key:generate"
+ ],
+ "post-install-cmd": [
+ "Illuminate\\Foundation\\ComposerScripts::postInstall",
+ "php artisan optimize"
+ ],
+ "post-update-cmd": [
+ "Illuminate\\Foundation\\ComposerScripts::postUpdate",
+ "php artisan optimize"
+ ]
+ },
+ "config": {
+ "preferred-install": "dist"
}
- },
- "autoload-dev": {
- "classmap": [
- "tests"
- ]
- },
- "scripts": {
- "post-install-cmd": [
- "php artisan clear-compiled",
- "php artisan optimize"
- ],
- "post-update-cmd": [
- "php artisan clear-compiled",
- "php artisan optimize"
- ],
- "post-create-project-cmd": [
- "php -r \"copy('.env.example', '.env');\"",
- "php artisan key:generate"
- ]
- },
- "config": {
- "preferred-install": "dist"
- }
}
diff --git a/config/app.php b/config/app.php
index 39704521..519db62c 100644
--- a/config/app.php
+++ b/config/app.php
@@ -1,202 +1,217 @@
env('APP_OAUTH_2_0_CLIENT_ID'),
- 'openstackid_client_secret' => env('APP_OAUTH_2_0_CLIENT_SECRET'),
- 'openstackid_base_url' => env('APP_OAUTH_2_0_AUTH_SERVER_BASE_URL'),
- /*
- |--------------------------------------------------------------------------
- | Application Debug Mode
- |--------------------------------------------------------------------------
- |
- | When your application is in debug mode, detailed error messages with
- | stack traces will be shown on every error that occurs within your
- | application. If disabled, a simple generic error page is shown.
- |
- */
+ 'openstackid_client_secret' => env('APP_OAUTH_2_0_CLIENT_SECRET'),
+ 'openstackid_base_url' => env('APP_OAUTH_2_0_AUTH_SERVER_BASE_URL'),
+ /*
+ |--------------------------------------------------------------------------
+ | Application Environment
+ |--------------------------------------------------------------------------
+ |
+ | This value determines the "environment" your application is currently
+ | running in. This may determine how you prefer to configure various
+ | services your application utilizes. Set this in your ".env" file.
+ |
+ */
- 'debug' => env('APP_DEBUG', false),
+ 'env' => env('APP_ENV', 'dev'),
- /*
- |--------------------------------------------------------------------------
- | Application URL
- |--------------------------------------------------------------------------
- |
- | This URL is used by the console to properly generate URLs when using
- | the Artisan command line tool. You should set this to the root of
- | your application so that it is used when running Artisan tasks.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Application Debug Mode
+ |--------------------------------------------------------------------------
+ |
+ | When your application is in debug mode, detailed error messages with
+ | stack traces will be shown on every error that occurs within your
+ | application. If disabled, a simple generic error page is shown.
+ |
+ */
- 'url' => env('APP_URL', 'http://localhost'),
+ 'debug' => env('APP_DEBUG', true),
- /*
- |--------------------------------------------------------------------------
- | Application Timezone
- |--------------------------------------------------------------------------
- |
- | Here you may specify the default timezone for your application, which
- | will be used by the PHP date and date-time functions. We have gone
- | ahead and set this to a sensible default for you out of the box.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Application URL
+ |--------------------------------------------------------------------------
+ |
+ | This URL is used by the console to properly generate URLs when using
+ | the Artisan command line tool. You should set this to the root of
+ | your application so that it is used when running Artisan tasks.
+ |
+ */
- 'timezone' => 'UTC',
+ 'url' => env('APP_URL', 'http://localhost'),
- /*
- |--------------------------------------------------------------------------
- | Application Locale Configuration
- |--------------------------------------------------------------------------
- |
- | The application locale determines the default locale that will be used
- | by the translation service provider. You are free to set this value
- | to any of the locales which will be supported by the application.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Application Timezone
+ |--------------------------------------------------------------------------
+ |
+ | Here you may specify the default timezone for your application, which
+ | will be used by the PHP date and date-time functions. We have gone
+ | ahead and set this to a sensible default for you out of the box.
+ |
+ */
- 'locale' => 'en',
+ 'timezone' => 'UTC',
- /*
- |--------------------------------------------------------------------------
- | Application Fallback Locale
- |--------------------------------------------------------------------------
- |
- | The fallback locale determines the locale to use when the current one
- | is not available. You may change the value to correspond to any of
- | the language folders that are provided through your application.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Application Locale Configuration
+ |--------------------------------------------------------------------------
+ |
+ | The application locale determines the default locale that will be used
+ | by the translation service provider. You are free to set this value
+ | to any of the locales which will be supported by the application.
+ |
+ */
- 'fallback_locale' => 'en',
+ 'locale' => 'en',
- /*
- |--------------------------------------------------------------------------
- | Encryption Key
- |--------------------------------------------------------------------------
- |
- | This key is used by the Illuminate encrypter service and should be set
- | to a random, 32 character string, otherwise these encrypted strings
- | will not be safe. Please do this before deploying an application!
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Application Fallback Locale
+ |--------------------------------------------------------------------------
+ |
+ | The fallback locale determines the locale to use when the current one
+ | is not available. You may change the value to correspond to any of
+ | the language folders that are provided through your application.
+ |
+ */
- 'key' => env('APP_KEY', 'SomeRandomString'),
+ 'fallback_locale' => 'en',
- 'cipher' => MCRYPT_RIJNDAEL_128,
+ /*
+ |--------------------------------------------------------------------------
+ | Encryption Key
+ |--------------------------------------------------------------------------
+ |
+ | This key is used by the Illuminate encrypter service and should be set
+ | to a random, 32 character string, otherwise these encrypted strings
+ | will not be safe. Please do this before deploying an application!
+ |
+ */
- /*
- |--------------------------------------------------------------------------
- | Logging Configuration
- |--------------------------------------------------------------------------
- |
- | Here you may configure the log settings for your application. Out of
- | the box, Laravel uses the Monolog PHP logging library. This gives
- | you a variety of powerful log handlers / formatters to utilize.
- |
- | Available Settings: "single", "daily", "syslog", "errorlog"
- |
- */
+ 'key' => env('APP_KEY'),
- 'log' => 'daily',
+ 'cipher' => 'AES-256-CBC',
- /*
- |--------------------------------------------------------------------------
- | Autoloaded Service Providers
- |--------------------------------------------------------------------------
- |
- | The service providers listed here will be automatically loaded on the
- | request to your application. Feel free to add your own services to
- | this array to grant expanded functionality to your applications.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Logging Configuration
+ |--------------------------------------------------------------------------
+ |
+ | Here you may configure the log settings for your application. Out of
+ | the box, Laravel uses the Monolog PHP logging library. This gives
+ | you a variety of powerful log handlers / formatters to utilize.
+ |
+ | Available Settings: "single", "daily", "syslog", "errorlog"
+ |
+ */
- 'providers' => [
+ 'log' => env('APP_LOG', 'daily'),
- /*
- * Laravel Framework Service Providers...
- */
- 'Illuminate\Foundation\Providers\ArtisanServiceProvider',
- 'Illuminate\Auth\AuthServiceProvider',
- 'Illuminate\Bus\BusServiceProvider',
- 'Illuminate\Cache\CacheServiceProvider',
- 'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider',
- 'Illuminate\Routing\ControllerServiceProvider',
- 'Illuminate\Cookie\CookieServiceProvider',
- 'Illuminate\Database\DatabaseServiceProvider',
- 'Illuminate\Encryption\EncryptionServiceProvider',
- 'Illuminate\Filesystem\FilesystemServiceProvider',
- 'Illuminate\Foundation\Providers\FoundationServiceProvider',
- 'Illuminate\Hashing\HashServiceProvider',
- 'Illuminate\Mail\MailServiceProvider',
- 'Illuminate\Pagination\PaginationServiceProvider',
- 'Illuminate\Pipeline\PipelineServiceProvider',
- 'Illuminate\Queue\QueueServiceProvider',
- 'Illuminate\Redis\RedisServiceProvider',
- 'Illuminate\Auth\Passwords\PasswordResetServiceProvider',
- 'Illuminate\Session\SessionServiceProvider',
- 'Illuminate\Translation\TranslationServiceProvider',
- 'Illuminate\Validation\ValidationServiceProvider',
- 'Illuminate\View\ViewServiceProvider',
+ /*
+ |--------------------------------------------------------------------------
+ | Autoloaded Service Providers
+ |--------------------------------------------------------------------------
+ |
+ | The service providers listed here will be automatically loaded on the
+ | request to your application. Feel free to add your own services to
+ | this array to grant expanded functionality to your applications.
+ |
+ */
- /*
- * Application Service Providers...
- */
- 'App\Providers\AppServiceProvider',
- 'App\Providers\BusServiceProvider',
- 'App\Providers\ConfigServiceProvider',
- 'App\Providers\EventServiceProvider',
- 'App\Providers\RouteServiceProvider',
- 'repositories\RepositoriesProvider',
- 'services\ServicesProvider',
- ],
+ 'providers' => [
- /*
- |--------------------------------------------------------------------------
- | Class Aliases
- |--------------------------------------------------------------------------
- |
- | This array of class aliases will be registered when this application
- | is started. However, feel free to register as many as you wish as
- | the aliases are "lazy" loaded so they don't hinder performance.
- |
- */
+ /*
+ * Laravel Framework Service Providers...
+ */
+ Illuminate\Auth\AuthServiceProvider::class,
+ Illuminate\Broadcasting\BroadcastServiceProvider::class,
+ Illuminate\Bus\BusServiceProvider::class,
+ Illuminate\Cache\CacheServiceProvider::class,
+ Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
+ Illuminate\Cookie\CookieServiceProvider::class,
+ Illuminate\Database\DatabaseServiceProvider::class,
+ Illuminate\Encryption\EncryptionServiceProvider::class,
+ Illuminate\Filesystem\FilesystemServiceProvider::class,
+ Illuminate\Foundation\Providers\FoundationServiceProvider::class,
+ Illuminate\Hashing\HashServiceProvider::class,
+ Illuminate\Mail\MailServiceProvider::class,
+ Illuminate\Pagination\PaginationServiceProvider::class,
+ Illuminate\Pipeline\PipelineServiceProvider::class,
+ Illuminate\Queue\QueueServiceProvider::class,
+ Illuminate\Redis\RedisServiceProvider::class,
+ Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
+ Illuminate\Session\SessionServiceProvider::class,
+ Illuminate\Translation\TranslationServiceProvider::class,
+ Illuminate\Validation\ValidationServiceProvider::class,
+ Illuminate\View\ViewServiceProvider::class,
- 'aliases' => [
+ /*
+ * Application Service Providers...
+ */
+ App\Providers\AppServiceProvider::class,
+ App\Providers\AuthServiceProvider::class,
+ App\Providers\EventServiceProvider::class,
+ App\Providers\RouteServiceProvider::class,
+ \repositories\RepositoriesProvider::class,
+ \services\ServicesProvider::class,
+ \factories\FactoriesProvider::class,
+ \LaravelDoctrine\ORM\DoctrineServiceProvider::class,
+ \LaravelDoctrine\Extensions\BeberleiExtensionsServiceProvider::class,
+ ],
- 'App' => 'Illuminate\Support\Facades\App',
- 'Artisan' => 'Illuminate\Support\Facades\Artisan',
- 'Auth' => 'Illuminate\Support\Facades\Auth',
- 'Blade' => 'Illuminate\Support\Facades\Blade',
- 'Bus' => 'Illuminate\Support\Facades\Bus',
- 'Cache' => 'Illuminate\Support\Facades\Cache',
- 'Config' => 'Illuminate\Support\Facades\Config',
- 'Cookie' => 'Illuminate\Support\Facades\Cookie',
- 'Crypt' => 'Illuminate\Support\Facades\Crypt',
- 'DB' => 'Illuminate\Support\Facades\DB',
- 'Eloquent' => 'Illuminate\Database\Eloquent\Model',
- 'Event' => 'Illuminate\Support\Facades\Event',
- 'File' => 'Illuminate\Support\Facades\File',
- 'Hash' => 'Illuminate\Support\Facades\Hash',
- 'Input' => 'Illuminate\Support\Facades\Input',
- 'Inspiring' => 'Illuminate\Foundation\Inspiring',
- 'Lang' => 'Illuminate\Support\Facades\Lang',
- 'Log' => 'Illuminate\Support\Facades\Log',
- 'Mail' => 'Illuminate\Support\Facades\Mail',
- 'Password' => 'Illuminate\Support\Facades\Password',
- 'Queue' => 'Illuminate\Support\Facades\Queue',
- 'Redirect' => 'Illuminate\Support\Facades\Redirect',
- 'Redis' => 'Illuminate\Support\Facades\Redis',
- 'Request' => 'Illuminate\Support\Facades\Request',
- 'Response' => 'Illuminate\Support\Facades\Response',
- 'Route' => 'Illuminate\Support\Facades\Route',
- 'Schema' => 'Illuminate\Support\Facades\Schema',
- 'Session' => 'Illuminate\Support\Facades\Session',
- 'Storage' => 'Illuminate\Support\Facades\Storage',
- 'URL' => 'Illuminate\Support\Facades\URL',
- 'Validator' => 'Illuminate\Support\Facades\Validator',
- 'View' => 'Illuminate\Support\Facades\View',
+ /*
+ |--------------------------------------------------------------------------
+ | Class Aliases
+ |--------------------------------------------------------------------------
+ |
+ | This array of class aliases will be registered when this application
+ | is started. However, feel free to register as many as you wish as
+ | the aliases are "lazy" loaded so they don't hinder performance.
+ |
+ */
- ],
+ 'aliases' => [
-];
\ No newline at end of file
+ 'App' => Illuminate\Support\Facades\App::class,
+ 'Artisan' => Illuminate\Support\Facades\Artisan::class,
+ 'Auth' => Illuminate\Support\Facades\Auth::class,
+ 'Blade' => Illuminate\Support\Facades\Blade::class,
+ 'Cache' => Illuminate\Support\Facades\Cache::class,
+ 'Config' => Illuminate\Support\Facades\Config::class,
+ 'Cookie' => Illuminate\Support\Facades\Cookie::class,
+ 'Crypt' => Illuminate\Support\Facades\Crypt::class,
+ 'DB' => Illuminate\Support\Facades\DB::class,
+ 'Eloquent' => Illuminate\Database\Eloquent\Model::class,
+ 'Event' => Illuminate\Support\Facades\Event::class,
+ 'File' => Illuminate\Support\Facades\File::class,
+ 'Gate' => Illuminate\Support\Facades\Gate::class,
+ 'Hash' => Illuminate\Support\Facades\Hash::class,
+ 'Lang' => Illuminate\Support\Facades\Lang::class,
+ 'Log' => Illuminate\Support\Facades\Log::class,
+ 'Mail' => Illuminate\Support\Facades\Mail::class,
+ 'Password' => Illuminate\Support\Facades\Password::class,
+ 'Queue' => Illuminate\Support\Facades\Queue::class,
+ 'Redirect' => Illuminate\Support\Facades\Redirect::class,
+ 'Redis' => Illuminate\Support\Facades\Redis::class,
+ 'Request' => Illuminate\Support\Facades\Request::class,
+ 'Response' => Illuminate\Support\Facades\Response::class,
+ 'Route' => Illuminate\Support\Facades\Route::class,
+ 'Schema' => Illuminate\Support\Facades\Schema::class,
+ 'Session' => Illuminate\Support\Facades\Session::class,
+ 'Storage' => Illuminate\Support\Facades\Storage::class,
+ 'URL' => Illuminate\Support\Facades\URL::class,
+ 'Validator' => Illuminate\Support\Facades\Validator::class,
+ 'View' => Illuminate\Support\Facades\View::class,
+ 'EntityManager' => LaravelDoctrine\ORM\Facades\EntityManager::class,
+ 'Registry' => LaravelDoctrine\ORM\Facades\Registry::class,
+ 'Doctrine' => LaravelDoctrine\ORM\Facades\Doctrine::class,
+ ],
+
+];
diff --git a/config/auth.php b/config/auth.php
index ee6316fd..c25b92e2 100644
--- a/config/auth.php
+++ b/config/auth.php
@@ -2,66 +2,106 @@
return [
- /*
- |--------------------------------------------------------------------------
- | Default Authentication Driver
- |--------------------------------------------------------------------------
- |
- | This option controls the authentication driver that will be utilized.
- | This driver manages the retrieval and authentication of the users
- | attempting to get access to protected areas of your application.
- |
- | Supported: "database", "eloquent"
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Authentication Defaults
+ |--------------------------------------------------------------------------
+ |
+ | This option controls the default authentication "guard" and password
+ | reset options for your application. You may change these defaults
+ | as required, but they're a perfect start for most applications.
+ |
+ */
- 'driver' => 'eloquent',
+ 'defaults' => [
+ 'guard' => 'web',
+ 'passwords' => 'users',
+ ],
- /*
- |--------------------------------------------------------------------------
- | Authentication Model
- |--------------------------------------------------------------------------
- |
- | When using the "Eloquent" authentication driver, we need to know which
- | Eloquent model should be used to retrieve your users. Of course, it
- | is often just the "User" model but you may use whatever you like.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Authentication Guards
+ |--------------------------------------------------------------------------
+ |
+ | Next, you may define every authentication guard for your application.
+ | Of course, a great default configuration has been defined for you
+ | here which uses session storage and the Eloquent user provider.
+ |
+ | All authentication drivers have a user provider. This defines how the
+ | users are actually retrieved out of your database or other storage
+ | mechanisms used by this application to persist your user's data.
+ |
+ | Supported: "session", "token"
+ |
+ */
- 'model' => 'App\User',
+ 'guards' => [
+ 'web' => [
+ 'driver' => 'session',
+ 'provider' => 'users',
+ ],
- /*
- |--------------------------------------------------------------------------
- | Authentication Table
- |--------------------------------------------------------------------------
- |
- | When using the "Database" authentication driver, we need to know which
- | table should be used to retrieve your users. We have chosen a basic
- | default value but you may easily change it to any table you like.
- |
- */
+ 'api' => [
+ 'driver' => 'token',
+ 'provider' => 'users',
+ ],
+ ],
- 'table' => 'users',
+ /*
+ |--------------------------------------------------------------------------
+ | User Providers
+ |--------------------------------------------------------------------------
+ |
+ | All authentication drivers have a user provider. This defines how the
+ | users are actually retrieved out of your database or other storage
+ | mechanisms used by this application to persist your user's data.
+ |
+ | If you have multiple user tables or models you may configure multiple
+ | sources which represent each model / table. These sources may then
+ | be assigned to any extra authentication guards you have defined.
+ |
+ | Supported: "database", "eloquent"
+ |
+ */
- /*
- |--------------------------------------------------------------------------
- | Password Reset Settings
- |--------------------------------------------------------------------------
- |
- | Here you may set the options for resetting passwords including the view
- | that is your password reset e-mail. You can also set the name of the
- | table that maintains all of the reset tokens for your application.
- |
- | The expire time is the number of minutes that the reset token should be
- | considered valid. This security feature keeps tokens short-lived so
- | they have less time to be guessed. You may change this as needed.
- |
- */
+ 'providers' => [
+ 'users' => [
+ 'driver' => 'eloquent',
+ //'model' => App\User::class,
+ ],
- 'password' => [
- 'email' => 'emails.password',
- 'table' => 'password_resets',
- 'expire' => 60,
- ],
+ // 'users' => [
+ // 'driver' => 'database',
+ // 'table' => 'users',
+ // ],
+ ],
-];
\ No newline at end of file
+ /*
+ |--------------------------------------------------------------------------
+ | Resetting Passwords
+ |--------------------------------------------------------------------------
+ |
+ | Here you may set the options for resetting passwords including the view
+ | that is your password reset e-mail. You may also set the name of the
+ | table that maintains all of the reset tokens for your application.
+ |
+ | You may specify multiple password reset configurations if you have more
+ | than one user table or model in the application and you want to have
+ | separate password reset settings based on the specific user types.
+ |
+ | The expire time is the number of minutes that the reset token should be
+ | considered valid. This security feature keeps tokens short-lived so
+ | they have less time to be guessed. You may change this as needed.
+ |
+ */
+
+ 'passwords' => [
+ 'users' => [
+ 'provider' => 'users',
+ 'email' => 'auth.emails.password',
+ 'table' => 'password_resets',
+ 'expire' => 60,
+ ],
+ ],
+
+];
diff --git a/config/broadcasting.php b/config/broadcasting.php
new file mode 100644
index 00000000..abaaac32
--- /dev/null
+++ b/config/broadcasting.php
@@ -0,0 +1,52 @@
+ env('BROADCAST_DRIVER', 'pusher'),
+
+ /*
+ |--------------------------------------------------------------------------
+ | Broadcast Connections
+ |--------------------------------------------------------------------------
+ |
+ | Here you may define all of the broadcast connections that will be used
+ | to broadcast events to other systems or over websockets. Samples of
+ | each available type of connection are provided inside this array.
+ |
+ */
+
+ 'connections' => [
+
+ 'pusher' => [
+ 'driver' => 'pusher',
+ 'key' => env('PUSHER_KEY'),
+ 'secret' => env('PUSHER_SECRET'),
+ 'app_id' => env('PUSHER_APP_ID'),
+ 'options' => [
+ //
+ ],
+ ],
+
+ 'redis' => [
+ 'driver' => 'redis',
+ 'connection' => 'default',
+ ],
+
+ 'log' => [
+ 'driver' => 'log',
+ ],
+
+ ],
+
+];
diff --git a/config/cache.php b/config/cache.php
index f9f5b576..3ffa840b 100644
--- a/config/cache.php
+++ b/config/cache.php
@@ -2,49 +2,80 @@
return [
- /*
- |--------------------------------------------------------------------------
- | Default Cache Store
- |--------------------------------------------------------------------------
- |
- | This option controls the default cache connection that gets used while
- | using this caching library. This connection is used when another is
- | not explicitly specified when executing a given caching function.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Default Cache Store
+ |--------------------------------------------------------------------------
+ |
+ | This option controls the default cache connection that gets used while
+ | using this caching library. This connection is used when another is
+ | not explicitly specified when executing a given caching function.
+ |
+ */
- 'default' => env('CACHE_DRIVER', 'redis'),
+ 'default' => env('CACHE_DRIVER', 'file'),
- /*
- |--------------------------------------------------------------------------
- | Cache Stores
- |--------------------------------------------------------------------------
- |
- | Here you may define all of the cache "stores" for your application as
- | well as their drivers. You may even define multiple stores for the
- | same cache driver to group types of items stored in your caches.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Cache Stores
+ |--------------------------------------------------------------------------
+ |
+ | Here you may define all of the cache "stores" for your application as
+ | well as their drivers. You may even define multiple stores for the
+ | same cache driver to group types of items stored in your caches.
+ |
+ */
- 'stores' => [
- 'redis' => [
- 'driver' => 'redis',
- 'connection' => 'default',
- ],
+ 'stores' => [
- ],
+ 'apc' => [
+ 'driver' => 'apc',
+ ],
- /*
- |--------------------------------------------------------------------------
- | Cache Key Prefix
- |--------------------------------------------------------------------------
- |
- | When utilizing a RAM based store such as APC or Memcached, there might
- | be other applications utilizing the same cache. So, we'll specify a
- | value to get prefixed to all our keys so we can avoid collisions.
- |
- */
+ 'array' => [
+ 'driver' => 'array',
+ ],
- 'prefix' => 'laravel',
+ 'database' => [
+ 'driver' => 'database',
+ 'table' => 'cache',
+ 'connection' => null,
+ ],
-];
\ No newline at end of file
+ 'file' => [
+ 'driver' => 'file',
+ 'path' => storage_path('framework/cache'),
+ ],
+
+ 'memcached' => [
+ 'driver' => 'memcached',
+ 'servers' => [
+ [
+ 'host' => env('MEMCACHED_HOST', '127.0.0.1'),
+ 'port' => env('MEMCACHED_PORT', 11211),
+ 'weight' => 100,
+ ],
+ ],
+ ],
+
+ 'redis' => [
+ 'driver' => 'redis',
+ 'connection' => 'default',
+ ],
+
+ ],
+
+ /*
+ |--------------------------------------------------------------------------
+ | Cache Key Prefix
+ |--------------------------------------------------------------------------
+ |
+ | When utilizing a RAM based store such as APC or Memcached, there might
+ | be other applications utilizing the same cache. So, we'll specify a
+ | value to get prefixed to all our keys so we can avoid collisions.
+ |
+ */
+
+ 'prefix' => 'laravel',
+
+];
diff --git a/config/compile.php b/config/compile.php
index fc20d82c..04807eac 100644
--- a/config/compile.php
+++ b/config/compile.php
@@ -2,40 +2,34 @@
return [
- /*
- |--------------------------------------------------------------------------
- | Additional Compiled Classes
- |--------------------------------------------------------------------------
- |
- | Here you may specify additional classes to include in the compiled file
- | generated by the `artisan optimize` command. These should be classes
- | that are included on basically every request into the application.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Additional Compiled Classes
+ |--------------------------------------------------------------------------
+ |
+ | Here you may specify additional classes to include in the compiled file
+ | generated by the `artisan optimize` command. These should be classes
+ | that are included on basically every request into the application.
+ |
+ */
- 'files' => [
+ 'files' => [
+ //
+ ],
- realpath(__DIR__.'/../app/Providers/AppServiceProvider.php'),
- realpath(__DIR__.'/../app/Providers/BusServiceProvider.php'),
- realpath(__DIR__.'/../app/Providers/ConfigServiceProvider.php'),
- realpath(__DIR__.'/../app/Providers/EventServiceProvider.php'),
- realpath(__DIR__.'/../app/Providers/RouteServiceProvider.php'),
+ /*
+ |--------------------------------------------------------------------------
+ | Compiled File Providers
+ |--------------------------------------------------------------------------
+ |
+ | Here you may list service providers which define a "compiles" function
+ | that returns additional files that should be compiled, providing an
+ | easy way to get common files from any packages you are utilizing.
+ |
+ */
- ],
+ 'providers' => [
+ //
+ ],
- /*
- |--------------------------------------------------------------------------
- | Compiled File Providers
- |--------------------------------------------------------------------------
- |
- | Here you may list service providers which define a "compiles" function
- | that returns additional files that should be compiled, providing an
- | easy way to get common files from any packages you are utilizing.
- |
- */
-
- 'providers' => [
- //
- ],
-
-];
\ No newline at end of file
+];
diff --git a/config/database.php b/config/database.php
index ccc9bdac..86fbc787 100644
--- a/config/database.php
+++ b/config/database.php
@@ -2,110 +2,112 @@
return [
- /*
- |--------------------------------------------------------------------------
- | PDO Fetch Style
- |--------------------------------------------------------------------------
- |
- | By default, database results will be returned as instances of the PHP
- | stdClass object; however, you may desire to retrieve records in an
- | array format for simplicity. Here you can tweak the fetch style.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | PDO Fetch Style
+ |--------------------------------------------------------------------------
+ |
+ | By default, database results will be returned as instances of the PHP
+ | stdClass object; however, you may desire to retrieve records in an
+ | array format for simplicity. Here you can tweak the fetch style.
+ |
+ */
- 'fetch' => PDO::FETCH_CLASS,
+ 'fetch' => PDO::FETCH_CLASS,
- /*
- |--------------------------------------------------------------------------
- | Default Database Connection Name
- |--------------------------------------------------------------------------
- |
- | Here you may specify which of the database connections below you wish
- | to use as your default connection for all database work. Of course
- | you may use many connections at once using the Database library.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Default Database Connection Name
+ |--------------------------------------------------------------------------
+ |
+ | Here you may specify which of the database connections below you wish
+ | to use as your default connection for all database work. Of course
+ | you may use many connections at once using the Database library.
+ |
+ */
- 'default' => 'openstackid_resources',
+ 'default' => env('DB_CONNECTION', 'openstackid_resources'),
- /*
- |--------------------------------------------------------------------------
- | Database Connections
- |--------------------------------------------------------------------------
- |
- | Here are each of the database connections setup for your application.
- | Of course, examples of configuring each database platform that is
- | supported by Laravel is shown below to make development simple.
- |
- |
- | All database work in Laravel is done through the PHP PDO facilities
- | so make sure you have the driver for your particular database of
- | choice installed on your machine before you begin development.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Database Connections
+ |--------------------------------------------------------------------------
+ |
+ | Here are each of the database connections setup for your application.
+ | Of course, examples of configuring each database platform that is
+ | supported by Laravel is shown below to make development simple.
+ |
+ |
+ | All database work in Laravel is done through the PHP PDO facilities
+ | so make sure you have the driver for your particular database of
+ | choice installed on your machine before you begin development.
+ |
+ */
- 'connections' => [
- //primary DB
- 'openstackid_resources' => array(
- 'driver' => 'mysql',
- 'host' => env('DB_HOST'),
- 'database' => env('DB_DATABASE'),
- 'username' => env('DB_USERNAME'),
- 'password' => env('DB_PASSWORD'),
+ 'connections' => [
+
+ //primary DB
+ 'openstackid_resources' => array(
+ 'driver' => 'mysql',
+ 'host' => env('DB_HOST'),
+ 'database' => env('DB_DATABASE'),
+ 'username' => env('DB_USERNAME'),
+ 'password' => env('DB_PASSWORD'),
'port' => env('DB_PORT', 3306),
- 'charset' => 'utf8',
- 'collation' => 'utf8_unicode_ci',
- 'prefix' => '',
- ),
- //secondary DB (SS OS)
- 'ss' => array(
- 'driver' => 'mysql',
- 'host' => env('SS_DB_HOST'),
- 'database' => env('SS_DATABASE'),
- 'username' => env('SS_DB_USERNAME'),
- 'password' => env('SS_DB_PASSWORD'),
+ 'charset' => 'utf8',
+ 'collation' => 'utf8_unicode_ci',
+ 'prefix' => '',
+ ),
+ //secondary DB (SS OS)
+ 'ss' => array(
+ 'driver' => 'mysql',
+ 'host' => env('SS_DB_HOST'),
+ 'database' => env('SS_DATABASE'),
+ 'username' => env('SS_DB_USERNAME'),
+ 'password' => env('SS_DB_PASSWORD'),
'port' => env('SS_DB_PORT', 3306),
- 'charset' => 'utf8',
- 'collation' => 'utf8_unicode_ci',
- 'prefix' => '',
- ),
- ],
+ 'charset' => 'utf8',
+ 'collation' => 'utf8_unicode_ci',
+ 'prefix' => '',
+ ),
- /*
- |--------------------------------------------------------------------------
- | Migration Repository Table
- |--------------------------------------------------------------------------
- |
- | This table keeps track of all the migrations that have already run for
- | your application. Using this information, we can determine which of
- | the migrations on disk haven't actually been run in the database.
- |
- */
+ ],
- 'migrations' => 'migrations',
+ /*
+ |--------------------------------------------------------------------------
+ | Migration Repository Table
+ |--------------------------------------------------------------------------
+ |
+ | This table keeps track of all the migrations that have already run for
+ | your application. Using this information, we can determine which of
+ | the migrations on disk haven't actually been run in the database.
+ |
+ */
- /*
- |--------------------------------------------------------------------------
- | Redis Databases
- |--------------------------------------------------------------------------
- |
- | Redis is an open source, fast, and advanced key-value store that also
- | provides a richer set of commands than a typical key-value systems
- | such as APC or Memcached. Laravel makes it easy to dig right in.
- |
- */
+ 'migrations' => 'migrations',
- 'redis' => [
+ /*
+ |--------------------------------------------------------------------------
+ | Redis Databases
+ |--------------------------------------------------------------------------
+ |
+ | Redis is an open source, fast, and advanced key-value store that also
+ | provides a richer set of commands than a typical key-value systems
+ | such as APC or Memcached. Laravel makes it easy to dig right in.
+ |
+ */
- 'cluster' => false,
+ 'redis' => [
- 'default' => [
- 'host' => env('REDIS_HOST'),
- 'port' => env('REDIS_PORT'),
- 'database' => env('REDIS_DB'),
+ 'cluster' => false,
+
+ 'default' => [
+ 'host' => env('REDIS_HOST'),
+ 'port' => env('REDIS_PORT'),
+ 'database' => env('REDIS_DB'),
'password' => env('REDIS_PASSWORD'),
- ],
+ ],
- ],
+ ],
-];
\ No newline at end of file
+];
diff --git a/config/doctrine.php b/config/doctrine.php
new file mode 100644
index 00000000..a16cc165
--- /dev/null
+++ b/config/doctrine.php
@@ -0,0 +1,231 @@
+ Warning: Proxy auto generation should only be enabled in dev!
+ |
+ */
+ 'managers' => [
+ 'default' => [
+ 'dev' => env('APP_DEBUG'),
+ 'meta' => env('DOCTRINE_METADATA', 'annotations'),
+ 'connection' => env('DB_CONNECTION', 'openstackid_resources'),
+ 'namespaces' => [
+ 'App'
+ ],
+ 'paths' => [
+ base_path('app/Models/ResourceServer')
+ ],
+ 'repository' => Doctrine\ORM\EntityRepository::class,
+ 'proxies' => [
+ 'namespace' => false,
+ 'path' => storage_path('proxies'),
+ 'auto_generate' => env('DOCTRINE_PROXY_AUTOGENERATE', false)
+ ],
+ /*
+ |--------------------------------------------------------------------------
+ | Doctrine events
+ |--------------------------------------------------------------------------
+ |
+ | The listener array expects the key to be a Doctrine event
+ | e.g. Doctrine\ORM\Events::onFlush
+ |
+ */
+ 'events' => [
+ 'listeners' => [],
+ 'subscribers' => []
+ ],
+ 'filters' => [],
+ /*
+ |--------------------------------------------------------------------------
+ | Doctrine mapping types
+ |--------------------------------------------------------------------------
+ |
+ | Link a Database Type to a Local Doctrine Type
+ |
+ | Using 'enum' => 'string' is the same of:
+ | $doctrineManager->extendAll(function (\Doctrine\ORM\Configuration $configuration,
+ | \Doctrine\DBAL\Connection $connection,
+ | \Doctrine\Common\EventManager $eventManager) {
+ | $connection->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
+ | });
+ |
+ | References:
+ | http://doctrine-orm.readthedocs.org/en/latest/cookbook/custom-mapping-types.html
+ | http://doctrine-dbal.readthedocs.org/en/latest/reference/types.html#custom-mapping-types
+ | http://doctrine-orm.readthedocs.org/en/latest/cookbook/advanced-field-value-conversion-using-custom-mapping-types.html
+ | http://doctrine-orm.readthedocs.org/en/latest/reference/basic-mapping.html#reference-mapping-types
+ | http://symfony.com/doc/current/cookbook/doctrine/dbal.html#registering-custom-mapping-types-in-the-schematool
+ |--------------------------------------------------------------------------
+ */
+ 'mapping_types' => [
+ //'enum' => 'string'
+ ]
+ ],
+ 'ss' => [
+ 'dev' => env('APP_DEBUG'),
+ 'meta' => env('DOCTRINE_METADATA', 'annotations'),
+ 'connection' => 'ss',
+ 'namespaces' => [
+ 'App'
+ ],
+ 'paths' => [
+ base_path('app/Models/Foundation')
+ ],
+ 'repository' => Doctrine\ORM\EntityRepository::class,
+ 'proxies' => [
+ 'namespace' => false,
+ 'path' => storage_path('proxies'),
+ 'auto_generate' => env('DOCTRINE_PROXY_AUTOGENERATE', false)
+ ],
+ /*
+ |--------------------------------------------------------------------------
+ | Doctrine events
+ |--------------------------------------------------------------------------
+ |
+ | The listener array expects the key to be a Doctrine event
+ | e.g. Doctrine\ORM\Events::onFlush
+ |
+ */
+ 'events' => [
+ 'listeners' => [],
+ 'subscribers' => []
+ ],
+ 'filters' => [],
+ /*
+ |--------------------------------------------------------------------------
+ | Doctrine mapping types
+ |--------------------------------------------------------------------------
+ |
+ | Link a Database Type to a Local Doctrine Type
+ |
+ | Using 'enum' => 'string' is the same of:
+ | $doctrineManager->extendAll(function (\Doctrine\ORM\Configuration $configuration,
+ | \Doctrine\DBAL\Connection $connection,
+ | \Doctrine\Common\EventManager $eventManager) {
+ | $connection->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
+ | });
+ |
+ | References:
+ | http://doctrine-orm.readthedocs.org/en/latest/cookbook/custom-mapping-types.html
+ | http://doctrine-dbal.readthedocs.org/en/latest/reference/types.html#custom-mapping-types
+ | http://doctrine-orm.readthedocs.org/en/latest/cookbook/advanced-field-value-conversion-using-custom-mapping-types.html
+ | http://doctrine-orm.readthedocs.org/en/latest/reference/basic-mapping.html#reference-mapping-types
+ | http://symfony.com/doc/current/cookbook/doctrine/dbal.html#registering-custom-mapping-types-in-the-schematool
+ |--------------------------------------------------------------------------
+ */
+ 'mapping_types' => [
+ //'enum' => 'string'
+ ]
+ ]
+ ],
+ /*
+ |--------------------------------------------------------------------------
+ | Doctrine Extensions
+ |--------------------------------------------------------------------------
+ |
+ | Enable/disable Doctrine Extensions by adding or removing them from the list
+ |
+ | If you want to require custom extensions you will have to require
+ | laravel-doctrine/extensions in your composer.json
+ |
+ */
+ 'extensions' => [
+ //LaravelDoctrine\ORM\Extensions\TablePrefix\TablePrefixExtension::class,
+ //LaravelDoctrine\Extensions\Timestamps\TimestampableExtension::class,
+ //LaravelDoctrine\Extensions\SoftDeletes\SoftDeleteableExtension::class,
+ //LaravelDoctrine\Extensions\Sluggable\SluggableExtension::class,
+ //LaravelDoctrine\Extensions\Sortable\SortableExtension::class,
+ //LaravelDoctrine\Extensions\Tree\TreeExtension::class,
+ //LaravelDoctrine\Extensions\Loggable\LoggableExtension::class,
+ //LaravelDoctrine\Extensions\Blameable\BlameableExtension::class,
+ //LaravelDoctrine\Extensions\IpTraceable\IpTraceableExtension::class,
+ //LaravelDoctrine\Extensions\Translatable\TranslatableExtension::class
+ ],
+ /*
+ |--------------------------------------------------------------------------
+ | Doctrine custom types
+ |--------------------------------------------------------------------------
+ |
+ | Create a custom or override a Doctrine Type
+ |--------------------------------------------------------------------------
+ */
+ 'custom_types' => [
+ 'json' => LaravelDoctrine\ORM\Types\Json::class
+ ],
+ /*
+ |--------------------------------------------------------------------------
+ | DQL custom datetime functions
+ |--------------------------------------------------------------------------
+ */
+ 'custom_datetime_functions' => [],
+ /*
+ |--------------------------------------------------------------------------
+ | DQL custom numeric functions
+ |--------------------------------------------------------------------------
+ */
+ 'custom_numeric_functions' => [],
+ /*
+ |--------------------------------------------------------------------------
+ | DQL custom string functions
+ |--------------------------------------------------------------------------
+ */
+ 'custom_string_functions' => [],
+ /*
+ |--------------------------------------------------------------------------
+ | Enable query logging with laravel file logging,
+ | debugbar, clockwork or an own implementation.
+ | Setting it to false, will disable logging
+ |
+ | Available:
+ | - LaravelDoctrine\ORM\Loggers\LaravelDebugbarLogger
+ | - LaravelDoctrine\ORM\Loggers\ClockworkLogger
+ | - LaravelDoctrine\ORM\Loggers\FileLogger
+ |--------------------------------------------------------------------------
+ */
+ 'logger' => env('DOCTRINE_LOGGER', 'LaravelDoctrine\ORM\Loggers\FileLogger'),
+ /*
+ |--------------------------------------------------------------------------
+ | Cache
+ |--------------------------------------------------------------------------
+ |
+ | Configure meta-data, query and result caching here.
+ | Optionally you can enable second level caching.
+ |
+ | Available: acp|array|file|memcached|redis|void
+ |
+ */
+ 'cache' => [
+ 'default' => env('DOCTRINE_CACHE', 'redis'),
+ 'namespace' => null,
+ 'second_level' => true,
+ ],
+ /*
+ |--------------------------------------------------------------------------
+ | Gedmo extensions
+ |--------------------------------------------------------------------------
+ |
+ | Settings for Gedmo extensions
+ | If you want to use this you will have to require
+ | laravel-doctrine/extensions in your composer.json
+ |
+ */
+ 'gedmo' => [
+ 'all_mappings' => false
+ ]
+];
diff --git a/config/filesystems.php b/config/filesystems.php
index 300b790b..75b50022 100644
--- a/config/filesystems.php
+++ b/config/filesystems.php
@@ -2,70 +2,66 @@
return [
- /*
- |--------------------------------------------------------------------------
- | Default Filesystem Disk
- |--------------------------------------------------------------------------
- |
- | Here you may specify the default filesystem disk that should be used
- | by the framework. A "local" driver, as well as a variety of cloud
- | based drivers are available for your choosing. Just store away!
- |
- | Supported: "local", "s3", "rackspace"
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Default Filesystem Disk
+ |--------------------------------------------------------------------------
+ |
+ | Here you may specify the default filesystem disk that should be used
+ | by the framework. A "local" driver, as well as a variety of cloud
+ | based drivers are available for your choosing. Just store away!
+ |
+ | Supported: "local", "ftp", "s3", "rackspace"
+ |
+ */
- 'default' => 'local',
+ 'default' => 'local',
- /*
- |--------------------------------------------------------------------------
- | Default Cloud Filesystem Disk
- |--------------------------------------------------------------------------
- |
- | Many applications store files both locally and in the cloud. For this
- | reason, you may specify a default "cloud" driver here. This driver
- | will be bound as the Cloud disk implementation in the container.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Default Cloud Filesystem Disk
+ |--------------------------------------------------------------------------
+ |
+ | Many applications store files both locally and in the cloud. For this
+ | reason, you may specify a default "cloud" driver here. This driver
+ | will be bound as the Cloud disk implementation in the container.
+ |
+ */
- 'cloud' => 's3',
+ 'cloud' => 's3',
- /*
- |--------------------------------------------------------------------------
- | Filesystem Disks
- |--------------------------------------------------------------------------
- |
- | Here you may configure as many filesystem "disks" as you wish, and you
- | may even configure multiple disks of the same driver. Defaults have
- | been setup for each driver as an example of the required options.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Filesystem Disks
+ |--------------------------------------------------------------------------
+ |
+ | Here you may configure as many filesystem "disks" as you wish, and you
+ | may even configure multiple disks of the same driver. Defaults have
+ | been setup for each driver as an example of the required options.
+ |
+ */
- 'disks' => [
+ 'disks' => [
- 'local' => [
- 'driver' => 'local',
- 'root' => storage_path().'/app',
- ],
+ 'local' => [
+ 'driver' => 'local',
+ 'root' => storage_path('app'),
+ ],
- 's3' => [
- 'driver' => 's3',
- 'key' => 'your-key',
- 'secret' => 'your-secret',
- 'region' => 'your-region',
- 'bucket' => 'your-bucket',
- ],
+ 'public' => [
+ 'driver' => 'local',
+ 'root' => storage_path('app/public'),
+ 'visibility' => 'public',
+ ],
- 'rackspace' => [
- 'driver' => 'rackspace',
- 'username' => 'your-username',
- 'key' => 'your-key',
- 'container' => 'your-container',
- 'endpoint' => 'https://identity.api.rackspacecloud.com/v2.0/',
- 'region' => 'IAD',
- 'url_type' => 'publicURL'
- ],
+ 's3' => [
+ 'driver' => 's3',
+ 'key' => 'your-key',
+ 'secret' => 'your-secret',
+ 'region' => 'your-region',
+ 'bucket' => 'your-bucket',
+ ],
- ],
+ ],
-];
\ No newline at end of file
+];
diff --git a/config/mail.php b/config/mail.php
index 5905b1dd..a0765885 100644
--- a/config/mail.php
+++ b/config/mail.php
@@ -2,123 +2,111 @@
return [
- /*
- |--------------------------------------------------------------------------
- | Mail Driver
- |--------------------------------------------------------------------------
- |
- | Laravel supports both SMTP and PHP's "mail" function as drivers for the
- | sending of e-mail. You may specify which one you're using throughout
- | your application here. By default, Laravel is setup for SMTP mail.
- |
- | Supported: "smtp", "mail", "sendmail", "mailgun", "mandrill", "log"
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Mail Driver
+ |--------------------------------------------------------------------------
+ |
+ | Laravel supports both SMTP and PHP's "mail" function as drivers for the
+ | sending of e-mail. You may specify which one you're using throughout
+ | your application here. By default, Laravel is setup for SMTP mail.
+ |
+ | Supported: "smtp", "mail", "sendmail", "mailgun", "mandrill",
+ | "ses", "sparkpost", "log"
+ |
+ */
- 'driver' => env('MAIL_DRIVER', 'smtp'),
+ 'driver' => env('MAIL_DRIVER', 'smtp'),
- /*
- |--------------------------------------------------------------------------
- | SMTP Host Address
- |--------------------------------------------------------------------------
- |
- | Here you may provide the host address of the SMTP server used by your
- | applications. A default option is provided that is compatible with
- | the Mailgun mail service which will provide reliable deliveries.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | SMTP Host Address
+ |--------------------------------------------------------------------------
+ |
+ | Here you may provide the host address of the SMTP server used by your
+ | applications. A default option is provided that is compatible with
+ | the Mailgun mail service which will provide reliable deliveries.
+ |
+ */
- 'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
+ 'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
- /*
- |--------------------------------------------------------------------------
- | SMTP Host Port
- |--------------------------------------------------------------------------
- |
- | This is the SMTP port used by your application to deliver e-mails to
- | users of the application. Like the host we have set this value to
- | stay compatible with the Mailgun e-mail application by default.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | SMTP Host Port
+ |--------------------------------------------------------------------------
+ |
+ | This is the SMTP port used by your application to deliver e-mails to
+ | users of the application. Like the host we have set this value to
+ | stay compatible with the Mailgun e-mail application by default.
+ |
+ */
- 'port' => env('MAIL_PORT', 587),
+ 'port' => env('MAIL_PORT', 587),
- /*
- |--------------------------------------------------------------------------
- | Global "From" Address
- |--------------------------------------------------------------------------
- |
- | You may wish for all e-mails sent by your application to be sent from
- | the same address. Here, you may specify a name and address that is
- | used globally for all e-mails that are sent by your application.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Global "From" Address
+ |--------------------------------------------------------------------------
+ |
+ | You may wish for all e-mails sent by your application to be sent from
+ | the same address. Here, you may specify a name and address that is
+ | used globally for all e-mails that are sent by your application.
+ |
+ */
- 'from' => ['address' => null, 'name' => null],
+ 'from' => ['address' => null, 'name' => null],
- /*
- |--------------------------------------------------------------------------
- | E-Mail Encryption Protocol
- |--------------------------------------------------------------------------
- |
- | Here you may specify the encryption protocol that should be used when
- | the application send e-mail messages. A sensible default using the
- | transport layer security protocol should provide great security.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | E-Mail Encryption Protocol
+ |--------------------------------------------------------------------------
+ |
+ | Here you may specify the encryption protocol that should be used when
+ | the application send e-mail messages. A sensible default using the
+ | transport layer security protocol should provide great security.
+ |
+ */
- 'encryption' => 'tls',
+ 'encryption' => env('MAIL_ENCRYPTION', 'tls'),
- /*
- |--------------------------------------------------------------------------
- | SMTP Server Username
- |--------------------------------------------------------------------------
- |
- | If your SMTP server requires a username for authentication, you should
- | set it here. This will get used to authenticate with your server on
- | connection. You may also set the "password" value below this one.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | SMTP Server Username
+ |--------------------------------------------------------------------------
+ |
+ | If your SMTP server requires a username for authentication, you should
+ | set it here. This will get used to authenticate with your server on
+ | connection. You may also set the "password" value below this one.
+ |
+ */
- 'username' => env('MAIL_USERNAME'),
+ 'username' => env('MAIL_USERNAME'),
- /*
- |--------------------------------------------------------------------------
- | SMTP Server Password
- |--------------------------------------------------------------------------
- |
- | Here you may set the password required by your SMTP server to send out
- | messages from your application. This will be given to the server on
- | connection so that the application will be able to send messages.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | SMTP Server Password
+ |--------------------------------------------------------------------------
+ |
+ | Here you may set the password required by your SMTP server to send out
+ | messages from your application. This will be given to the server on
+ | connection so that the application will be able to send messages.
+ |
+ */
- 'password' => env('MAIL_PASSWORD'),
+ 'password' => env('MAIL_PASSWORD'),
- /*
- |--------------------------------------------------------------------------
- | Sendmail System Path
- |--------------------------------------------------------------------------
- |
- | When using the "sendmail" driver to send e-mails, we will need to know
- | the path to where Sendmail lives on this server. A default path has
- | been provided here, which will work well on most of your systems.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Sendmail System Path
+ |--------------------------------------------------------------------------
+ |
+ | When using the "sendmail" driver to send e-mails, we will need to know
+ | the path to where Sendmail lives on this server. A default path has
+ | been provided here, which will work well on most of your systems.
+ |
+ */
- 'sendmail' => '/usr/sbin/sendmail -bs',
+ 'sendmail' => '/usr/sbin/sendmail -bs',
- /*
- |--------------------------------------------------------------------------
- | Mail "Pretend"
- |--------------------------------------------------------------------------
- |
- | When this option is enabled, e-mail will not actually be sent over the
- | web and will instead be written to your application's logs files so
- | you may inspect the message. This is great for local development.
- |
- */
-
- 'pretend' => false,
-
-];
\ No newline at end of file
+];
diff --git a/config/queue.php b/config/queue.php
index d5c7ea90..d0f732a6 100644
--- a/config/queue.php
+++ b/config/queue.php
@@ -2,91 +2,84 @@
return [
- /*
- |--------------------------------------------------------------------------
- | Default Queue Driver
- |--------------------------------------------------------------------------
- |
- | The Laravel queue API supports a variety of back-ends via an unified
- | API, giving you convenient access to each back-end using the same
- | syntax for each one. Here you may set the default queue driver.
- |
- | Supported: "null", "sync", "database", "beanstalkd",
- | "sqs", "iron", "redis"
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Default Queue Driver
+ |--------------------------------------------------------------------------
+ |
+ | The Laravel queue API supports a variety of back-ends via an unified
+ | API, giving you convenient access to each back-end using the same
+ | syntax for each one. Here you may set the default queue driver.
+ |
+ | Supported: "null", "sync", "database", "beanstalkd", "sqs", "redis"
+ |
+ */
- 'default' => env('QUEUE_DRIVER', 'sync'),
+ 'default' => env('QUEUE_DRIVER', 'sync'),
- /*
- |--------------------------------------------------------------------------
- | Queue Connections
- |--------------------------------------------------------------------------
- |
- | Here you may configure the connection information for each server that
- | is used by your application. A default configuration has been added
- | for each back-end shipped with Laravel. You are free to add more.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Queue Connections
+ |--------------------------------------------------------------------------
+ |
+ | Here you may configure the connection information for each server that
+ | is used by your application. A default configuration has been added
+ | for each back-end shipped with Laravel. You are free to add more.
+ |
+ */
- 'connections' => [
+ 'connections' => [
- 'sync' => [
- 'driver' => 'sync',
- ],
+ 'sync' => [
+ 'driver' => 'sync',
+ ],
- 'database' => [
- 'driver' => 'database',
- 'table' => 'jobs',
- 'queue' => 'default',
- 'expire' => 60,
- ],
+ 'database' => [
+ 'driver' => 'database',
+ 'table' => 'jobs',
+ 'queue' => 'default',
+ 'expire' => 60,
+ ],
- 'beanstalkd' => [
- 'driver' => 'beanstalkd',
- 'host' => 'localhost',
- 'queue' => 'default',
- 'ttr' => 60,
- ],
+ 'beanstalkd' => [
+ 'driver' => 'beanstalkd',
+ 'host' => 'localhost',
+ 'queue' => 'default',
+ 'ttr' => 60,
+ ],
- 'sqs' => [
- 'driver' => 'sqs',
- 'key' => 'your-public-key',
- 'secret' => 'your-secret-key',
- 'queue' => 'your-queue-url',
- 'region' => 'us-east-1',
- ],
+ 'sqs' => [
+ 'driver' => 'sqs',
+ 'key' => 'your-public-key',
+ 'secret' => 'your-secret-key',
+ 'prefix' => 'https://sqs.us-east-1.amazonaws.com/your-account-id',
+ 'queue' => 'your-queue-name',
+ 'region' => 'us-east-1',
+ ],
- 'iron' => [
- 'driver' => 'iron',
- 'host' => 'mq-aws-us-east-1.iron.io',
- 'token' => 'your-token',
- 'project' => 'your-project-id',
- 'queue' => 'your-queue-name',
- 'encrypt' => true,
- ],
+ 'redis' => [
+ 'driver' => 'redis',
+ 'connection' => 'default',
+ 'queue' => 'default',
+ 'expire' => 60,
+ ],
- 'redis' => [
- 'driver' => 'redis',
- 'queue' => 'default',
- 'expire' => 60,
- ],
+ ],
- ],
+ /*
+ |--------------------------------------------------------------------------
+ | Failed Queue Jobs
+ |--------------------------------------------------------------------------
+ |
+ | These options configure the behavior of failed queue job logging so you
+ | can control which database and table are used to store the jobs that
+ | have failed. You may change them to any database / table you wish.
+ |
+ */
- /*
- |--------------------------------------------------------------------------
- | Failed Queue Jobs
- |--------------------------------------------------------------------------
- |
- | These options configure the behavior of failed queue job logging so you
- | can control which database and table are used to store the jobs that
- | have failed. You may change them to any database / table you wish.
- |
- */
+ 'failed' => [
+ 'database' => env('DB_CONNECTION', 'mysql'),
+ 'table' => 'failed_jobs',
+ ],
- 'failed' => [
- 'database' => 'mysql', 'table' => 'failed_jobs',
- ],
-
-];
\ No newline at end of file
+];
diff --git a/config/services.php b/config/services.php
index 65abbac7..287b1186 100644
--- a/config/services.php
+++ b/config/services.php
@@ -2,36 +2,37 @@
return [
- /*
- |--------------------------------------------------------------------------
- | Third Party Services
- |--------------------------------------------------------------------------
- |
- | This file is for storing the credentials for third party services such
- | as Stripe, Mailgun, Mandrill, and others. This file provides a sane
- | default location for this type of information, allowing packages
- | to have a conventional place to find your various credentials.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Third Party Services
+ |--------------------------------------------------------------------------
+ |
+ | This file is for storing the credentials for third party services such
+ | as Stripe, Mailgun, Mandrill, and others. This file provides a sane
+ | default location for this type of information, allowing packages
+ | to have a conventional place to find your various credentials.
+ |
+ */
- 'mailgun' => [
- 'domain' => '',
- 'secret' => '',
- ],
+ 'mailgun' => [
+ 'domain' => env('MAILGUN_DOMAIN'),
+ 'secret' => env('MAILGUN_SECRET'),
+ ],
- 'mandrill' => [
- 'secret' => '',
- ],
+ 'ses' => [
+ 'key' => env('SES_KEY'),
+ 'secret' => env('SES_SECRET'),
+ 'region' => 'us-east-1',
+ ],
- 'ses' => [
- 'key' => '',
- 'secret' => '',
- 'region' => 'us-east-1',
- ],
+ 'sparkpost' => [
+ 'secret' => env('SPARKPOST_SECRET'),
+ ],
- 'stripe' => [
- 'model' => 'App\User',
- 'secret' => '',
- ],
+ 'stripe' => [
+ 'model' => App\User::class,
+ 'key' => env('STRIPE_KEY'),
+ 'secret' => env('STRIPE_SECRET'),
+ ],
-];
\ No newline at end of file
+];
diff --git a/config/session.php b/config/session.php
index 901149db..b21ffee2 100644
--- a/config/session.php
+++ b/config/session.php
@@ -2,152 +2,165 @@
return [
- /*
- |--------------------------------------------------------------------------
- | Default Session Driver
- |--------------------------------------------------------------------------
- |
- | This option controls the default session "driver" that will be used on
- | requests. By default, we will use the lightweight native driver but
- | you may specify any of the other wonderful drivers provided here.
- |
- | Supported: "file", "cookie", "database", "apc",
- | "memcached", "redis", "array"
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Default Session Driver
+ |--------------------------------------------------------------------------
+ |
+ | This option controls the default session "driver" that will be used on
+ | requests. By default, we will use the lightweight native driver but
+ | you may specify any of the other wonderful drivers provided here.
+ |
+ | Supported: "file", "cookie", "database", "apc",
+ | "memcached", "redis", "array"
+ |
+ */
- 'driver' => env('SESSION_DRIVER', 'redis'),
+ 'driver' => env('SESSION_DRIVER', 'redis'),
- /*
- |--------------------------------------------------------------------------
- | Session Lifetime
- |--------------------------------------------------------------------------
- |
- | Here you may specify the number of minutes that you wish the session
- | to be allowed to remain idle before it expires. If you want them
- | to immediately expire on the browser closing, set that option.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Session Lifetime
+ |--------------------------------------------------------------------------
+ |
+ | Here you may specify the number of minutes that you wish the session
+ | to be allowed to remain idle before it expires. If you want them
+ | to immediately expire on the browser closing, set that option.
+ |
+ */
- 'lifetime' => 120,
+ 'lifetime' => 120,
- 'expire_on_close' => false,
+ 'expire_on_close' => false,
- /*
- |--------------------------------------------------------------------------
- | Session Encryption
- |--------------------------------------------------------------------------
- |
- | This option allows you to easily specify that all of your session data
- | should be encrypted before it is stored. All encryption will be run
- | automatically by Laravel and you can use the Session like normal.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Session Encryption
+ |--------------------------------------------------------------------------
+ |
+ | This option allows you to easily specify that all of your session data
+ | should be encrypted before it is stored. All encryption will be run
+ | automatically by Laravel and you can use the Session like normal.
+ |
+ */
- 'encrypt' => false,
+ 'encrypt' => false,
- /*
- |--------------------------------------------------------------------------
- | Session File Location
- |--------------------------------------------------------------------------
- |
- | When using the native session driver, we need a location where session
- | files may be stored. A default has been set for you but a different
- | location may be specified. This is only needed for file sessions.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Session File Location
+ |--------------------------------------------------------------------------
+ |
+ | When using the native session driver, we need a location where session
+ | files may be stored. A default has been set for you but a different
+ | location may be specified. This is only needed for file sessions.
+ |
+ */
- 'files' => storage_path().'/framework/sessions',
+ 'files' => storage_path('framework/sessions'),
- /*
- |--------------------------------------------------------------------------
- | Session Database Connection
- |--------------------------------------------------------------------------
- |
- | When using the "database" or "redis" session drivers, you may specify a
- | connection that should be used to manage these sessions. This should
- | correspond to a connection in your database configuration options.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Session Database Connection
+ |--------------------------------------------------------------------------
+ |
+ | When using the "database" or "redis" session drivers, you may specify a
+ | connection that should be used to manage these sessions. This should
+ | correspond to a connection in your database configuration options.
+ |
+ */
- 'connection' => null,
+ 'connection' => null,
- /*
- |--------------------------------------------------------------------------
- | Session Database Table
- |--------------------------------------------------------------------------
- |
- | When using the "database" session driver, you may specify the table we
- | should use to manage the sessions. Of course, a sensible default is
- | provided for you; however, you are free to change this as needed.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Session Database Table
+ |--------------------------------------------------------------------------
+ |
+ | When using the "database" session driver, you may specify the table we
+ | should use to manage the sessions. Of course, a sensible default is
+ | provided for you; however, you are free to change this as needed.
+ |
+ */
- 'table' => 'sessions',
+ 'table' => 'sessions',
- /*
- |--------------------------------------------------------------------------
- | Session Sweeping Lottery
- |--------------------------------------------------------------------------
- |
- | Some session drivers must manually sweep their storage location to get
- | rid of old sessions from storage. Here are the chances that it will
- | happen on a given request. By default, the odds are 2 out of 100.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Session Sweeping Lottery
+ |--------------------------------------------------------------------------
+ |
+ | Some session drivers must manually sweep their storage location to get
+ | rid of old sessions from storage. Here are the chances that it will
+ | happen on a given request. By default, the odds are 2 out of 100.
+ |
+ */
- 'lottery' => [2, 100],
+ 'lottery' => [2, 100],
- /*
- |--------------------------------------------------------------------------
- | Session Cookie Name
- |--------------------------------------------------------------------------
- |
- | Here you may change the name of the cookie used to identify a session
- | instance by ID. The name specified here will get used every time a
- | new session cookie is created by the framework for every driver.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Session Cookie Name
+ |--------------------------------------------------------------------------
+ |
+ | Here you may change the name of the cookie used to identify a session
+ | instance by ID. The name specified here will get used every time a
+ | new session cookie is created by the framework for every driver.
+ |
+ */
- 'cookie' => 'openstackid_resources',
+ 'cookie' => 'openstackid_resources',
- /*
- |--------------------------------------------------------------------------
- | Session Cookie Path
- |--------------------------------------------------------------------------
- |
- | The session cookie path determines the path for which the cookie will
- | be regarded as available. Typically, this will be the root path of
- | your application but you are free to change this when necessary.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Session Cookie Path
+ |--------------------------------------------------------------------------
+ |
+ | The session cookie path determines the path for which the cookie will
+ | be regarded as available. Typically, this will be the root path of
+ | your application but you are free to change this when necessary.
+ |
+ */
- 'path' => '/',
+ 'path' => '/',
- /*
- |--------------------------------------------------------------------------
- | Session Cookie Domain
- |--------------------------------------------------------------------------
- |
- | Here you may change the domain of the cookie used to identify a session
- | in your application. This will determine which domains the cookie is
- | available to in your application. A sensible default has been set.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Session Cookie Domain
+ |--------------------------------------------------------------------------
+ |
+ | Here you may change the domain of the cookie used to identify a session
+ | in your application. This will determine which domains the cookie is
+ | available to in your application. A sensible default has been set.
+ |
+ */
- 'domain' => env('SESSION_COOKIE_DOMAIN'),
+ 'domain' => env('SESSION_COOKIE_DOMAIN'),
- /*
- |--------------------------------------------------------------------------
- | HTTPS Only Cookies
- |--------------------------------------------------------------------------
- |
- | By setting this option to true, session cookies will only be sent back
- | to the server if the browser has a HTTPS connection. This will keep
- | the cookie from being sent to you if it can not be done securely.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | HTTPS Only Cookies
+ |--------------------------------------------------------------------------
+ |
+ | By setting this option to true, session cookies will only be sent back
+ | to the server if the browser has a HTTPS connection. This will keep
+ | the cookie from being sent to you if it can not be done securely.
+ |
+ */
- 'secure' => env('SESSION_COOKIE_SECURE', false),
+ 'secure' => env('SESSION_COOKIE_SECURE', false),
-];
\ No newline at end of file
+ /*
+ |--------------------------------------------------------------------------
+ | HTTP Access Only
+ |--------------------------------------------------------------------------
+ |
+ | Setting this value to true will prevent JavaScript from accessing the
+ | value of the cookie and the cookie will only be accessible through
+ | the HTTP protocol. You are free to modify this option if needed.
+ |
+ */
+
+ 'http_only' => true,
+
+];
diff --git a/config/view.php b/config/view.php
index 48e9f929..e193ab61 100644
--- a/config/view.php
+++ b/config/view.php
@@ -2,32 +2,32 @@
return [
- /*
- |--------------------------------------------------------------------------
- | View Storage Paths
- |--------------------------------------------------------------------------
- |
- | Most templating systems load templates from disk. Here you may specify
- | an array of paths that should be checked for your views. Of course
- | the usual Laravel view path has already been registered for you.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | View Storage Paths
+ |--------------------------------------------------------------------------
+ |
+ | Most templating systems load templates from disk. Here you may specify
+ | an array of paths that should be checked for your views. Of course
+ | the usual Laravel view path has already been registered for you.
+ |
+ */
- 'paths' => [
- realpath(base_path('resources/views'))
- ],
+ 'paths' => [
+ realpath(base_path('resources/views')),
+ ],
- /*
- |--------------------------------------------------------------------------
- | Compiled View Path
- |--------------------------------------------------------------------------
- |
- | This option determines where all the compiled Blade templates will be
- | stored for your application. Typically, this is within the storage
- | directory. However, as usual, you are free to change this value.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Compiled View Path
+ |--------------------------------------------------------------------------
+ |
+ | This option determines where all the compiled Blade templates will be
+ | stored for your application. Typically, this is within the storage
+ | directory. However, as usual, you are free to change this value.
+ |
+ */
- 'compiled' => realpath(storage_path().'/framework/views'),
+ 'compiled' => realpath(storage_path('framework/views')),
-];
\ No newline at end of file
+];
diff --git a/database/factories/ModelFactory.php b/database/factories/ModelFactory.php
new file mode 100644
index 00000000..f596d0b5
--- /dev/null
+++ b/database/factories/ModelFactory.php
@@ -0,0 +1,21 @@
+define(App\User::class, function (Faker\Generator $faker) {
+ return [
+ 'name' => $faker->name,
+ 'email' => $faker->safeEmail,
+ 'password' => bcrypt(str_random(10)),
+ 'remember_token' => str_random(10),
+ ];
+});
diff --git a/database/migrations/.gitkeep b/database/migrations/.gitkeep
index e69de29b..8b137891 100644
--- a/database/migrations/.gitkeep
+++ b/database/migrations/.gitkeep
@@ -0,0 +1 @@
+
diff --git a/database/seeds/.gitkeep b/database/seeds/.gitkeep
index e69de29b..8b137891 100644
--- a/database/seeds/.gitkeep
+++ b/database/seeds/.gitkeep
@@ -0,0 +1 @@
+
diff --git a/database/seeds/ApiEndpointsSeeder.php b/database/seeds/ApiEndpointsSeeder.php
index 491c02c6..cf55f3d9 100644
--- a/database/seeds/ApiEndpointsSeeder.php
+++ b/database/seeds/ApiEndpointsSeeder.php
@@ -440,6 +440,16 @@ class ApiEndpointsSeeder extends Seeder
)
);
+ ApiEndpoint::create(
+ array(
+ 'name' => 'add-event-feedback-v2',
+ 'active' => true,
+ 'api_id' => $summit->id,
+ 'route' => '/api/v2/summits/{id}/events/{event_id}/feedback',
+ 'http_method' => 'POST'
+ )
+ );
+
ApiEndpoint::create(
array(
'name' => 'get-event-feedback',
@@ -538,6 +548,32 @@ class ApiEndpointsSeeder extends Seeder
)
);
+ //videos
+
+
+ ApiEndpoint::create(
+ array(
+ 'name' => 'create-presentation-video',
+ 'active' => true,
+ 'api_id' => $summit->id,
+ 'route' => '/api/v1/summits/{id}/presentations/{presentation_id}/videos',
+ 'http_method' => 'POST'
+ )
+ );
+
+ //members
+
+ ApiEndpoint::create(
+ array(
+ 'name' => 'get-own-member',
+ 'active' => true,
+ 'api_id' => $summit->id,
+ 'route' => '/api/v1/summits/{id}/members/me',
+ 'http_method' => 'GET'
+ )
+ );
+
+ $member_read_scope = ApiScope::where('name', '=', sprintf('%s/me/read', $current_realm))->first();
$summit_read_scope = ApiScope::where('name', '=', sprintf('%s/summits/read', $current_realm))->first();
$summit_write_scope = ApiScope::where('name', '=', sprintf('%s/summits/write', $current_realm))->first();
$summit_write_event_scope = ApiScope::where('name', '=', sprintf('%s/summits/write-event', $current_realm))->first();
@@ -545,10 +581,13 @@ class ApiEndpointsSeeder extends Seeder
$summit_delete_event_scope = ApiScope::where('name', '=', sprintf('%s/summits/delete-event', $current_realm))->first();
$summit_external_order_read = ApiScope::where('name', '=', sprintf('%s/summits/read-external-orders', $current_realm))->first();
$summit_external_order_confirm = ApiScope::where('name', '=', sprintf('%s/summits/confirm-external-orders', $current_realm))->first();
+ $write_videos_scope = ApiScope::where('name', '=', sprintf('%s/summits/write-videos', $current_realm))->first();
// read
$endpoint = ApiEndpoint::where('name', '=', 'get-summits')->first();
$endpoint->scopes()->attach($summit_read_scope->id);
+ $endpoint = ApiEndpoint::where('name', '=', 'get-own-member')->first();
+ $endpoint->scopes()->attach($member_read_scope->id);
$endpoint = ApiEndpoint::where('name', '=', 'get-summit')->first();
$endpoint->scopes()->attach($summit_read_scope->id);
$endpoint = ApiEndpoint::where('name', '=', 'get-summit-entity-events')->first();
@@ -607,6 +646,9 @@ class ApiEndpointsSeeder extends Seeder
$endpoint = ApiEndpoint::where('name', '=', 'add-event-feedback')->first();
$endpoint->scopes()->attach($summit_write_scope->id);
+ $endpoint = ApiEndpoint::where('name', '=', 'add-event-feedback-v2')->first();
+ $endpoint->scopes()->attach($summit_write_scope->id);
+
// write events
$endpoint = ApiEndpoint::where('name', '=', 'add-event')->first();
$endpoint->scopes()->attach($summit_write_event_scope->id);
@@ -627,6 +669,11 @@ class ApiEndpointsSeeder extends Seeder
$endpoint = ApiEndpoint::where('name', '=', 'confirm-external-order')->first();
$endpoint->scopes()->attach($summit_external_order_confirm->id);
+ //write videos
+ $endpoint = ApiEndpoint::where('name', '=', 'create-presentation-video')->first();
+ $endpoint->scopes()->attach($write_videos_scope->id);
+
+
}
}
\ No newline at end of file
diff --git a/database/seeds/ApiScopesSeeder.php b/database/seeds/ApiScopesSeeder.php
index 93683456..387eaa2f 100644
--- a/database/seeds/ApiScopesSeeder.php
+++ b/database/seeds/ApiScopesSeeder.php
@@ -101,6 +101,16 @@ class ApiScopesSeeder extends Seeder
)
);
+ ApiScope::create(
+ array(
+ 'name' => sprintf('%s/me/read', $current_realm),
+ 'short_description' => 'Get own member data',
+ 'description' => 'Grants read only access for our own member data',
+ 'api_id' => $summits->id,
+ 'system' => false
+ )
+ );
+
ApiScope::create(
array(
'name' => sprintf('%s/summits/write', $current_realm),
@@ -160,6 +170,16 @@ class ApiScopesSeeder extends Seeder
'system' => false
)
);
+
+ ApiScope::create(
+ array(
+ 'name' => sprintf('%s/summits/write-videos', $current_realm),
+ 'short_description' => 'Allow to write presentation videos',
+ 'description' => 'Allow to write presentation videos',
+ 'api_id' => $summits->id,
+ 'system' => false
+ )
+ );
}
}
\ No newline at end of file
diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php
index b3d8fc03..982214f9 100644
--- a/database/seeds/DatabaseSeeder.php
+++ b/database/seeds/DatabaseSeeder.php
@@ -1,20 +1,21 @@
call(UsersTableSeeder::class);
+ Model::unguard();
$this->call('ApiSeeder');
$this->call('ApiScopesSeeder');
$this->call('ApiEndpointsSeeder');
}
-}
\ No newline at end of file
+}
diff --git a/gulpfile.js b/gulpfile.js
index 7cf62673..dc6f1ebb 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -6,11 +6,11 @@ var elixir = require('laravel-elixir');
|--------------------------------------------------------------------------
|
| Elixir provides a clean, fluent API for defining some basic Gulp tasks
- | for your Laravel application. By default, we are compiling the Less
+ | for your Laravel application. By default, we are compiling the Sass
| file for our application, as well as publishing vendor resources.
|
*/
elixir(function(mix) {
- mix.less('app.less');
+ mix.sass('app.scss');
});
diff --git a/package.json b/package.json
index 5595f071..87481c73 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,12 @@
{
"private": true,
+ "scripts": {
+ "prod": "gulp --production",
+ "dev": "gulp watch"
+ },
"devDependencies": {
- "gulp": "^3.8.8",
- "laravel-elixir": "*"
+ "gulp": "^3.9.1",
+ "laravel-elixir": "^5.0.0",
+ "bootstrap-sass": "^3.3.0"
}
}
diff --git a/phpspec.yml b/phpspec.yml
deleted file mode 100644
index eb57939e..00000000
--- a/phpspec.yml
+++ /dev/null
@@ -1,5 +0,0 @@
-suites:
- main:
- namespace: App
- psr4_prefix: App
- src_path: app
\ No newline at end of file
diff --git a/public/.htaccess b/public/.htaccess
index 77827ae7..903f6392 100644
--- a/public/.htaccess
+++ b/public/.htaccess
@@ -5,11 +5,16 @@
RewriteEngine On
- # Redirect Trailing Slashes...
+ # Redirect Trailing Slashes If Not A Folder...
+ RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
+
+ # Handle Authorization Header
+ RewriteCond %{HTTP:Authorization} .
+ RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
diff --git a/public/index.php b/public/index.php
index 37f19c23..c5820533 100644
--- a/public/index.php
+++ b/public/index.php
@@ -1,4 +1,5 @@
make('Illuminate\Contracts\Http\Kernel');
+$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$response = $kernel->handle(
- $request = Illuminate\Http\Request::capture()
+ $request = Illuminate\Http\Request::capture()
);
$response->send();
diff --git a/public/web.config b/public/web.config
new file mode 100644
index 00000000..624c1760
--- /dev/null
+++ b/public/web.config
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/readme.md b/readme.md
index a322e088..e718114c 100644
--- a/readme.md
+++ b/readme.md
@@ -16,6 +16,11 @@ run following commands on root folder
* php artisan migrate --env=YOUR_ENVIRONMENT
* php artisan db:seed --env=YOUR_ENVIRONMENT
* phpunit --bootstrap vendor/autoload.php
+ * php artisan doctrine:generate:proxies
+ * php artisan doctrine:clear:metadata:cache
+ * php artisan doctrine:clear:query:cache
+ * php artisan doctrine:clear:result:cache
+ * php artisan doctrine:ensure:production
* give proper rights to storage folder (775 and proper users)
## Permissions
diff --git a/resources/assets/sass/app.scss b/resources/assets/sass/app.scss
new file mode 100644
index 00000000..bb76e29c
--- /dev/null
+++ b/resources/assets/sass/app.scss
@@ -0,0 +1,2 @@
+// @import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap";
+
diff --git a/resources/lang/en/auth.php b/resources/lang/en/auth.php
new file mode 100644
index 00000000..e5506df2
--- /dev/null
+++ b/resources/lang/en/auth.php
@@ -0,0 +1,19 @@
+ 'These credentials do not match our records.',
+ 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
+
+];
diff --git a/resources/lang/en/pagination.php b/resources/lang/en/pagination.php
index 13b4dcb3..fcab34b2 100644
--- a/resources/lang/en/pagination.php
+++ b/resources/lang/en/pagination.php
@@ -2,18 +2,18 @@
return [
- /*
- |--------------------------------------------------------------------------
- | Pagination Language Lines
- |--------------------------------------------------------------------------
- |
- | The following language lines are used by the paginator library to build
- | the simple pagination links. You are free to change them to anything
- | you want to customize your views to better match your application.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Pagination Language Lines
+ |--------------------------------------------------------------------------
+ |
+ | The following language lines are used by the paginator library to build
+ | the simple pagination links. You are free to change them to anything
+ | you want to customize your views to better match your application.
+ |
+ */
- 'previous' => '« Previous',
- 'next' => 'Next »',
+ 'previous' => '« Previous',
+ 'next' => 'Next »',
];
diff --git a/resources/lang/en/passwords.php b/resources/lang/en/passwords.php
index 1fc0e1ef..e5544d20 100644
--- a/resources/lang/en/passwords.php
+++ b/resources/lang/en/passwords.php
@@ -2,21 +2,21 @@
return [
- /*
- |--------------------------------------------------------------------------
- | Password Reminder Language Lines
- |--------------------------------------------------------------------------
- |
- | The following language lines are the default lines which match reasons
- | that are given by the password broker for a password update attempt
- | has failed, such as for an invalid token or invalid new password.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Password Reset Language Lines
+ |--------------------------------------------------------------------------
+ |
+ | The following language lines are the default lines which match reasons
+ | that are given by the password broker for a password update attempt
+ | has failed, such as for an invalid token or invalid new password.
+ |
+ */
- "password" => "Passwords must be at least six characters and match the confirmation.",
- "user" => "We can't find a user with that e-mail address.",
- "token" => "This password reset token is invalid.",
- "sent" => "We have e-mailed your password reset link!",
- "reset" => "Your password has been reset!",
+ 'password' => 'Passwords must be at least six characters and match the confirmation.',
+ 'reset' => 'Your password has been reset!',
+ 'sent' => 'We have e-mailed your password reset link!',
+ 'token' => 'This password reset token is invalid.',
+ 'user' => "We can't find a user with that e-mail address.",
];
diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php
index 764f0563..b720584b 100644
--- a/resources/lang/en/validation.php
+++ b/resources/lang/en/validation.php
@@ -2,106 +2,113 @@
return [
- /*
- |--------------------------------------------------------------------------
- | Validation Language Lines
- |--------------------------------------------------------------------------
- |
- | The following language lines contain the default error messages used by
- | the validator class. Some of these rules have multiple versions such
- | as the size rules. Feel free to tweak each of these messages here.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Validation Language Lines
+ |--------------------------------------------------------------------------
+ |
+ | The following language lines contain the default error messages used by
+ | the validator class. Some of these rules have multiple versions such
+ | as the size rules. Feel free to tweak each of these messages here.
+ |
+ */
- "accepted" => "The :attribute must be accepted.",
- "active_url" => "The :attribute is not a valid URL.",
- "after" => "The :attribute must be a date after :date.",
- "alpha" => "The :attribute may only contain letters.",
- "alpha_dash" => "The :attribute may only contain letters, numbers, and dashes.",
- "alpha_num" => "The :attribute may only contain letters and numbers.",
- "array" => "The :attribute must be an array.",
- "before" => "The :attribute must be a date before :date.",
- "between" => [
- "numeric" => "The :attribute must be between :min and :max.",
- "file" => "The :attribute must be between :min and :max kilobytes.",
- "string" => "The :attribute must be between :min and :max characters.",
- "array" => "The :attribute must have between :min and :max items.",
- ],
- "boolean" => "The :attribute field must be true or false.",
- "confirmed" => "The :attribute confirmation does not match.",
- "date" => "The :attribute is not a valid date.",
- "date_format" => "The :attribute does not match the format :format.",
- "different" => "The :attribute and :other must be different.",
- "digits" => "The :attribute must be :digits digits.",
- "digits_between" => "The :attribute must be between :min and :max digits.",
- "email" => "The :attribute must be a valid email address.",
- "filled" => "The :attribute field is required.",
- "exists" => "The selected :attribute is invalid.",
- "image" => "The :attribute must be an image.",
- "in" => "The selected :attribute is invalid.",
- "integer" => "The :attribute must be an integer.",
- "ip" => "The :attribute must be a valid IP address.",
- "max" => [
- "numeric" => "The :attribute may not be greater than :max.",
- "file" => "The :attribute may not be greater than :max kilobytes.",
- "string" => "The :attribute may not be greater than :max characters.",
- "array" => "The :attribute may not have more than :max items.",
- ],
- "mimes" => "The :attribute must be a file of type: :values.",
- "min" => [
- "numeric" => "The :attribute must be at least :min.",
- "file" => "The :attribute must be at least :min kilobytes.",
- "string" => "The :attribute must be at least :min characters.",
- "array" => "The :attribute must have at least :min items.",
- ],
- "not_in" => "The selected :attribute is invalid.",
- "numeric" => "The :attribute must be a number.",
- "regex" => "The :attribute format is invalid.",
- "required" => "The :attribute field is required.",
- "required_if" => "The :attribute field is required when :other is :value.",
- "required_with" => "The :attribute field is required when :values is present.",
- "required_with_all" => "The :attribute field is required when :values is present.",
- "required_without" => "The :attribute field is required when :values is not present.",
- "required_without_all" => "The :attribute field is required when none of :values are present.",
- "same" => "The :attribute and :other must match.",
- "size" => [
- "numeric" => "The :attribute must be :size.",
- "file" => "The :attribute must be :size kilobytes.",
- "string" => "The :attribute must be :size characters.",
- "array" => "The :attribute must contain :size items.",
- ],
- "unique" => "The :attribute has already been taken.",
- "url" => "The :attribute format is invalid.",
- "timezone" => "The :attribute must be a valid zone.",
+ 'accepted' => 'The :attribute must be accepted.',
+ 'active_url' => 'The :attribute is not a valid URL.',
+ 'after' => 'The :attribute must be a date after :date.',
+ 'alpha' => 'The :attribute may only contain letters.',
+ 'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.',
+ 'alpha_num' => 'The :attribute may only contain letters and numbers.',
+ 'array' => 'The :attribute must be an array.',
+ 'before' => 'The :attribute must be a date before :date.',
+ 'between' => [
+ 'numeric' => 'The :attribute must be between :min and :max.',
+ 'file' => 'The :attribute must be between :min and :max kilobytes.',
+ 'string' => 'The :attribute must be between :min and :max characters.',
+ 'array' => 'The :attribute must have between :min and :max items.',
+ ],
+ 'boolean' => 'The :attribute field must be true or false.',
+ 'confirmed' => 'The :attribute confirmation does not match.',
+ 'date' => 'The :attribute is not a valid date.',
+ 'date_format' => 'The :attribute does not match the format :format.',
+ 'different' => 'The :attribute and :other must be different.',
+ 'digits' => 'The :attribute must be :digits digits.',
+ 'digits_between' => 'The :attribute must be between :min and :max digits.',
+ 'dimensions' => 'The :attribute has invalid image dimensions.',
+ 'distinct' => 'The :attribute field has a duplicate value.',
+ 'email' => 'The :attribute must be a valid email address.',
+ 'exists' => 'The selected :attribute is invalid.',
+ 'filled' => 'The :attribute field is required.',
+ 'image' => 'The :attribute must be an image.',
+ 'in' => 'The selected :attribute is invalid.',
+ 'in_array' => 'The :attribute field does not exist in :other.',
+ 'integer' => 'The :attribute must be an integer.',
+ 'ip' => 'The :attribute must be a valid IP address.',
+ 'json' => 'The :attribute must be a valid JSON string.',
+ 'max' => [
+ 'numeric' => 'The :attribute may not be greater than :max.',
+ 'file' => 'The :attribute may not be greater than :max kilobytes.',
+ 'string' => 'The :attribute may not be greater than :max characters.',
+ 'array' => 'The :attribute may not have more than :max items.',
+ ],
+ 'mimes' => 'The :attribute must be a file of type: :values.',
+ 'min' => [
+ 'numeric' => 'The :attribute must be at least :min.',
+ 'file' => 'The :attribute must be at least :min kilobytes.',
+ 'string' => 'The :attribute must be at least :min characters.',
+ 'array' => 'The :attribute must have at least :min items.',
+ ],
+ 'not_in' => 'The selected :attribute is invalid.',
+ 'numeric' => 'The :attribute must be a number.',
+ 'present' => 'The :attribute field must be present.',
+ 'regex' => 'The :attribute format is invalid.',
+ 'required' => 'The :attribute field is required.',
+ 'required_if' => 'The :attribute field is required when :other is :value.',
+ 'required_unless' => 'The :attribute field is required unless :other is in :values.',
+ 'required_with' => 'The :attribute field is required when :values is present.',
+ 'required_with_all' => 'The :attribute field is required when :values is present.',
+ 'required_without' => 'The :attribute field is required when :values is not present.',
+ 'required_without_all' => 'The :attribute field is required when none of :values are present.',
+ 'same' => 'The :attribute and :other must match.',
+ 'size' => [
+ 'numeric' => 'The :attribute must be :size.',
+ 'file' => 'The :attribute must be :size kilobytes.',
+ 'string' => 'The :attribute must be :size characters.',
+ 'array' => 'The :attribute must contain :size items.',
+ ],
+ 'string' => 'The :attribute must be a string.',
+ 'timezone' => 'The :attribute must be a valid zone.',
+ 'unique' => 'The :attribute has already been taken.',
+ 'url' => 'The :attribute format is invalid.',
- /*
- |--------------------------------------------------------------------------
- | Custom Validation Language Lines
- |--------------------------------------------------------------------------
- |
- | Here you may specify custom validation messages for attributes using the
- | convention "attribute.rule" to name the lines. This makes it quick to
- | specify a specific custom language line for a given attribute rule.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Custom Validation Language Lines
+ |--------------------------------------------------------------------------
+ |
+ | Here you may specify custom validation messages for attributes using the
+ | convention "attribute.rule" to name the lines. This makes it quick to
+ | specify a specific custom language line for a given attribute rule.
+ |
+ */
- 'custom' => [
- 'attribute-name' => [
- 'rule-name' => 'custom-message',
- ],
- ],
+ 'custom' => [
+ 'attribute-name' => [
+ 'rule-name' => 'custom-message',
+ ],
+ ],
- /*
- |--------------------------------------------------------------------------
- | Custom Validation Attributes
- |--------------------------------------------------------------------------
- |
- | The following language lines are used to swap attribute place-holders
- | with something more reader friendly such as E-Mail Address instead
- | of "email". This simply helps us make messages a little cleaner.
- |
- */
+ /*
+ |--------------------------------------------------------------------------
+ | Custom Validation Attributes
+ |--------------------------------------------------------------------------
+ |
+ | The following language lines are used to swap attribute place-holders
+ | with something more reader friendly such as E-Mail Address instead
+ | of "email". This simply helps us make messages a little cleaner.
+ |
+ */
- 'attributes' => [],
+ 'attributes' => [],
];
diff --git a/server.php b/server.php
index c7e378df..f65c7c44 100644
--- a/server.php
+++ b/server.php
@@ -1,4 +1,5 @@
getById(6);
+ $locations = $summit->getLocations();
+ $locations = $locations->toArray();
+ $this->assertTrue($summit->getIdentifier() === 6);
+ $this->assertTrue(count($locations) > 0);
+ $data = SerializerRegistry::getInstance()->getSerializer($summit)->serialize();
+ $this->assertTrue(is_array($data));
+ }
+
+ public function testGetSummitVenues(){
+
+ $repo = EntityManager::getRepository(\models\summit\Summit::class);
+ $summit = $repo->getById(6);
+ $venues = $summit->getVenues();
+ foreach($venues->toArray() as $venue)
+ {
+ foreach($venue->getRooms() as $r)
+ {
+
+ }
+ foreach($venue->getFloors() as $f)
+ {
+
+ }
+ }
+ }
+
+ public function testGetAttendeeById(){
+ $repo = EntityManager::getRepository(\models\summit\Summit::class);
+ $summit = $repo->getById(6);
+ $this->assertTrue(!is_null($summit));
+ $attendee = $summit->getAttendeeById(493);
+ $this->assertTrue(!is_null($attendee));
+
+ $member = $attendee->getMember();
+ $this->assertTrue(!is_null($member));
+ $feedback = $attendee->getEmittedFeedback();
+ $schedule = $attendee->getSchedule();
+ }
+
+ public function testGetMember(){
+ $em = Registry::getManager('ss');
+ $repo = $em->getRepository(\models\main\Member::class);
+ $me = $repo->find(11624);
+ $this->assertTrue(!is_null($me));
+ $photo = $me->getPhoto();
+ $filename = $photo->getFilename();
+ $this->assertTrue(!is_null($photo));
+ }
+
+ public function testGetEventFeedback(){
+ $repo = EntityManager::getRepository(\models\summit\Summit::class);
+ $summit = $repo->getById(6);
+ $this->assertTrue(!is_null($summit));
+ $event = $summit->getEvent(9454);
+ $this->assertTrue(!is_null($event));
+ }
+
+ public function testGetFile(){
+ $em = Registry::getManager('ss');
+ $repo = $em->getRepository(\models\main\File::class);
+ $file = $repo->find(1);
+ $this->assertTrue(!is_null($file));
+ }
+
+ public function testAddLocation()
+ {
+ $repo = EntityManager::getRepository(\models\summit\Summit::class);
+ $summit = $repo->getById(6);
+ $newExternalLocation = new SummitExternalLocation();
+ $newExternalLocation->setType(SummitExternalLocation::Lounge);
+ $newExternalLocation->setSummit($summit);
+ $summit->getLocations()->add($newExternalLocation);
+ $em = Registry::getManager('ss');
+ $em->flush();
+ }
+
+ public function testGetEvents(){
+
+ $filter = FilterParser::parse('tags=@nova', array
+ (
+ 'title' => array('=@', '=='),
+ 'tags' => array('=@', '=='),
+ 'start_date' => array('>', '<', '<=', '>=', '=='),
+ 'end_date' => array('>', '<', '<=', '>=', '=='),
+ 'summit_type_id' => array('=='),
+ 'event_type_id' => array('=='),
+ ));
+
+ $repo = EntityManager::getRepository(\models\summit\Summit::class);
+ $summit = $repo->getById(6);
+ $response = $repo->getEvents($summit->getIdentifier(), new PagingInfo(1, 10), $published = true, $filter);
+ $schedule = $response->getItems();
+ $this->assertTrue(count($schedule) > 0);
+ $event = $schedule[0];
+ $tags = $event->getTags()->toArray();
+ $this->assertTrue(count($tags) > 0);
+ }
+
+ public function testGetPresentation()
+ {
+ $repo = EntityManager::getRepository(\models\summit\Summit::class);
+ $summit = $repo->getById(6);
+ $presentation = $summit->getEvent(6859);
+ $videos = $presentation->getVideos();
+ $slides = $presentation->getSlides();
+ $links = $presentation->getLinks();
+ $this->assertTrue(!is_null($presentation));
+ }
+
+ public function testGetPresentations()
+ {
+ $repo = EntityManager::getRepository(\models\summit\Summit::class);
+ $summit = $repo->getById(6);
+ $presentations = $summit->getPresentations();
+ }
+
+
+ public function testGetSpeakers(){
+ $repo = EntityManager::getRepository(\models\summit\Summit::class);
+ $summit = $repo->getById(6);
+ $speakers = $summit->getSpeakers();
+ $sponsors = $summit->getSponsors();
+ $repo = EntityManager::getRepository(\models\summit\PresentationSpeaker::class);
+ $speakers = $repo->getSpeakersBySummit($summit, new PagingInfo(1,10))->getItems();
+ $this->assertTrue(count($speakers) > 0);
+ $speaker = $speakers[0];
+ $member = $speaker->getMember();
+ $id = $member->getId();
+ }
+}
\ No newline at end of file
diff --git a/tests/OAuth2SummitApiTest.php b/tests/OAuth2SummitApiTest.php
index b1571d4f..9ca759ac 100644
--- a/tests/OAuth2SummitApiTest.php
+++ b/tests/OAuth2SummitApiTest.php
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
-class OAuth2SummitApiTest extends ProtectedApiTest
+final class OAuth2SummitApiTest extends ProtectedApiTest
{
public function testGetSummits()
@@ -47,7 +47,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$params = array
(
'expand' => 'schedule,speakers' ,
- 'id' => 6
+ 'id' => 7
);
$headers = array("HTTP_Authorization" => " Bearer " .$this->access_token);
@@ -92,7 +92,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$params = array
(
'expand' => 'schedule' ,
- 'id' => 'current'
+ 'id' => 6
);
$headers = array("HTTP_Authorization" => " Bearer " .$this->access_token);
@@ -116,17 +116,17 @@ class OAuth2SummitApiTest extends ProtectedApiTest
{
$params = array
(
- 'id' => 'current',
- 'page' => 1,
- 'per_page' => 15,
- 'filter' => 'first_name=@John,last_name=@Bryce,email=@sebastian@',
- 'order' => '+first_name,-last_name'
+ 'id' => 6,
+ 'page' => 1,
+ 'per_page' => 15,
+ 'filter' => 'first_name=@John,last_name=@Bryce,email=@sebastian@',
+ 'order' => '+first_name,-last_name'
);
$headers = array("HTTP_Authorization" => " Bearer " .$this->access_token);
$response = $this->action(
"GET",
- "OAuth2SummitApiController@getSpeakers",
+ "OAuth2SummitSpeakersApiController@getSpeakers",
$params,
array(),
array(),
@@ -147,7 +147,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$params = array
(
'expand' => 'schedule' ,
- 'id' => 'current',
+ 'id' => 6,
'attendee_id' => 'me',
'access_token' => $this->access_token
);
@@ -155,7 +155,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$headers = array("HTTP_Authorization" => " Bearer " .$this->access_token);
$response = $this->action(
"GET",
- "OAuth2SummitApiController@getAttendee",
+ "OAuth2SummitAttendeesApiController@getAttendee",
$params,
array(),
array(),
@@ -172,14 +172,14 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$params = array
(
'expand' => 'schedule,ticket_type,speaker,feedback' ,
- 'id' => '6',
- 'attendee_id' => '561'
+ 'id' => 6,
+ 'attendee_id' => 1215
);
$headers = array("HTTP_Authorization" => " Bearer " .$this->access_token);
$response = $this->action(
"GET",
- "OAuth2SummitApiController@getAttendee",
+ "OAuth2SummitAttendeesApiController@getAttendee",
$params,
array(),
array(),
@@ -193,7 +193,32 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$this->assertTrue(!is_null($attendee));
}
- public function testCurrentSummitMyAttendeeAddToSchedule($event_id = 5476, $summit_id = 5)
+ public function testCurrentSummitMyAttendeeSchedule()
+ {
+ $params = array
+ (
+ 'id' => 6,
+ 'attendee_id' => 'me'
+ );
+
+ $headers = array("HTTP_Authorization" => " Bearer " .$this->access_token);
+ $response = $this->action(
+ "GET",
+ "OAuth2SummitAttendeesApiController@getAttendeeSchedule",
+ $params,
+ array(),
+ array(),
+ array(),
+ $headers
+ );
+
+ $content = $response->getContent();
+ $this->assertResponseStatus(200);
+ $attendee = json_decode($content);
+ $this->assertTrue(!is_null($attendee));
+ }
+
+ public function testCurrentSummitMyAttendeeAddToSchedule($event_id = 7202, $summit_id = 6)
{
$params = array
(
@@ -205,7 +230,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$headers = array("HTTP_Authorization" => " Bearer " .$this->access_token);
$response = $this->action(
"POST",
- "OAuth2SummitApiController@addEventToAttendeeSchedule",
+ "OAuth2SummitAttendeesApiController@addEventToAttendeeSchedule",
$params,
array(),
array(),
@@ -220,15 +245,15 @@ class OAuth2SummitApiTest extends ProtectedApiTest
{
$params = array
(
- 'id' => 'current',
+ 'id' => 6,
'attendee_id' => 'me',
- 'event_id' => '3872'
+ 'event_id' => 7202
);
$headers = array("HTTP_Authorization" => " Bearer " .$this->access_token);
$response = $this->action(
"PUT",
- "OAuth2SummitApiController@checkingAttendeeOnEvent",
+ "OAuth2SummitAttendeesApiController@checkingAttendeeOnEvent",
$params,
array(),
array(),
@@ -241,7 +266,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
public function testCurrentSummitMyAttendeeScheduleUnset()
{
- $event_id = 8860;
+ $event_id = 7863;
$summit_id = 6;
$this->testCurrentSummitMyAttendeeAddToSchedule($event_id, $summit_id);
$params = array
@@ -254,7 +279,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$headers = array("HTTP_Authorization" => " Bearer " .$this->access_token);
$response = $this->action(
"DELETE",
- "OAuth2SummitApiController@removeEventFromAttendeeSchedule",
+ "OAuth2SummitAttendeesApiController@removeEventFromAttendeeSchedule",
$params,
array(),
array(),
@@ -270,14 +295,14 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$params = array
(
'expand' => 'presentations' ,
- 'id' => 'current',
+ 'id' => 6,
'speaker_id' => 'me'
);
$headers = array("HTTP_Authorization" => " Bearer " .$this->access_token);
$response = $this->action(
"GET",
- "OAuth2SummitApiController@getSpeaker",
+ "OAuth2SummitSpeakersApiController@getSpeaker",
$params,
array(),
array(),
@@ -291,51 +316,11 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$this->assertTrue(!is_null($speaker));
}
- public function testAddFeedback2Speaker()
- {
- $params = array
- (
- 'id' => 'current',
- 'speaker_id' => 476,
- 'presentation_id' => 3872
- );
-
- $headers = array
- (
- "HTTP_Authorization" => " Bearer " .$this->access_token,
- "CONTENT_TYPE" => "application/json"
- );
-
- $feedback_data = array
- (
- 'rate' => 10,
- 'note' => 'you are the best, wow!',
- 'owner_id' => 11624
- );
-
-
- $response = $this->action
- (
- "POST",
- "OAuth2SummitApiController@addSpeakerFeedback",
- $params,
- array(),
- array(),
- array(),
- $headers,
- json_encode($feedback_data)
- );
-
- $content = $response->getContent();
- $this->assertResponseStatus(201);
-
- }
-
public function testCurrentSummitEventsWithFilter()
{
$params = array
(
- 'id' => 'current',
+ 'id' => 6,
'expand' => 'feedback' ,
'filter' => array
(
@@ -350,11 +335,10 @@ class OAuth2SummitApiTest extends ProtectedApiTest
"CONTENT_TYPE" => "application/json"
);
-
$response = $this->action
(
"GET",
- "OAuth2SummitApiController@getEvents",
+ "OAuth2SummitEventsApiController@getEvents",
$params,
array(),
array(),
@@ -373,7 +357,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
{
$params = array
(
- 'id' => 'current',
+ 'id' => 6,
);
$headers = array
@@ -386,7 +370,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$response = $this->action
(
"GET",
- "OAuth2SummitApiController@getEvents",
+ "OAuth2SummitEventsApiController@getEvents",
$params,
array(),
array(),
@@ -405,7 +389,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
{
$params = array
(
- 'id' => 'current',
+ 'id' => 6,
'expand' => 'feedback' ,
'filter' => array
(
@@ -423,7 +407,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$response = $this->action
(
"GET",
- "OAuth2SummitApiController@getEvents",
+ "OAuth2SummitEventsApiController@getEvents",
$params,
array(),
array(),
@@ -442,7 +426,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
{
$params = array
(
- 'id' => 'current',
+ 'id' => 6,
'expand' => 'feedback' ,
'filter' => array
(
@@ -460,7 +444,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$response = $this->action
(
"GET",
- "OAuth2SummitApiController@getScheduledEvents",
+ "OAuth2SummitEventsApiController@getScheduledEvents",
$params,
array(),
array(),
@@ -479,7 +463,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
{
$params = array
(
- 'id' => 'current',
+ 'id' => 6,
'expand' => 'location' ,
'filter' => array
(
@@ -498,7 +482,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$response = $this->action
(
"GET",
- "OAuth2SummitApiController@getScheduledEvents",
+ "OAuth2SummitEventsApiController@getScheduledEvents",
$params,
array(),
array(),
@@ -535,7 +519,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$response = $this->action
(
"GET",
- "OAuth2SummitApiController@getEvents",
+ "OAuth2SummitEventsApiController@getEvents",
$params,
array(),
array(),
@@ -573,7 +557,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$response = $this->action
(
"GET",
- "OAuth2SummitApiController@getEvents",
+ "OAuth2SummitEventsApiController@getEvents",
$params,
array(),
array(),
@@ -610,7 +594,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$response = $this->action
(
"GET",
- "OAuth2SummitApiController@getEvents",
+ "OAuth2SummitEventsApiController@getEvents",
$params,
array(),
array(),
@@ -684,7 +668,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$response = $this->action
(
"GET",
- "OAuth2SummitApiController@getEvents",
+ "OAuth2SummitEventsApiController@getEvents",
$params,
array(),
array(),
@@ -702,8 +686,8 @@ class OAuth2SummitApiTest extends ProtectedApiTest
public function testGetEvent(){
$params = array
(
- 'id' => 'current',
- 'event_id' => 3874,
+ 'id' => 6,
+ 'event_id' => 6838,
);
$headers = array
@@ -716,7 +700,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$response = $this->action
(
"GET",
- "OAuth2SummitApiController@getEvent",
+ "OAuth2SummitEventsApiController@getEvent",
$params,
array(),
array(),
@@ -731,13 +715,12 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$this->assertTrue(!is_null($events));
}
-
public function testGetPublishedEventFields(){
$params = array
(
- 'id' => 'current',
+ 'id' => 6,
'event_id' => 8900,
'fields' => 'id,avg_feedback_rate,head_count',
'relations' => 'none'
@@ -753,7 +736,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$response = $this->action
(
"GET",
- "OAuth2SummitApiController@getScheduledEvent",
+ "OAuth2SummitEventsApiController@getScheduledEvent",
$params,
array(),
array(),
@@ -773,7 +756,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$params = array
(
- 'id' => 'current',
+ 'id' => 6,
'event_id' => 8900,
'fields' => 'id_test',
'relations' => 'none'
@@ -789,7 +772,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$response = $this->action
(
"GET",
- "OAuth2SummitApiController@getScheduledEvent",
+ "OAuth2SummitEventsApiController@getScheduledEvent",
$params,
array(),
array(),
@@ -808,7 +791,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$params = array
(
- 'id' => 'current',
+ 'id' => 6,
'event_id' => 8900,
);
@@ -822,7 +805,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$response = $this->action
(
"GET",
- "OAuth2SummitApiController@getScheduledEvent",
+ "OAuth2SummitEventsApiController@getScheduledEvent",
$params,
array(),
array(),
@@ -837,11 +820,11 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$this->assertTrue(!is_null($events));
}
- public function testPostEvent($start_date = 1461613958, $end_date = 1461613990 )
+ public function testPostEvent($start_date = 1461510000, $end_date = 1461513600 )
{
$params = array
(
- 'id' => 6,
+ 'id' => 7,
);
$headers = array
@@ -852,21 +835,21 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$data = array
(
- 'title' => 'test event',
- 'description' => 'test event',
+ 'title' => 'test event BCN',
+ 'description' => 'test event BCN',
//'location_id' => 25,
- //'allow_feedback' => true,
+ 'allow_feedback' => true,
//'start_date' => $start_date,
//'end_date' => $end_date,
- 'type_id' => 2,
- 'summit_types_id' => [2],
- //'tags' => ['tag#1','tag#2' ]
+ 'type_id' => 88,//2,
+ 'summit_types_id' => [7,8],//[2],
+ 'tags' => ['tag#1','tag#2' ]
);
$response = $this->action
(
"POST",
- "OAuth2SummitApiController@addEvent",
+ "OAuth2SummitEventsApiController@addEvent",
$params,
array(),
array(),
@@ -878,10 +861,93 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$this->assertResponseStatus(201);
$content = $response->getContent();
$event = json_decode($content);
- $this->assertTrue($event->id > 0);
+ $this->assertTrue($event->getId() > 0);
return $event;
}
+ public function testPostPresentationFail412($start_date = 1461510000, $end_date = 1461513600 )
+ {
+ $params = array
+ (
+ 'id' => 7,
+ );
+
+ $headers = array
+ (
+ "HTTP_Authorization" => " Bearer " .$this->access_token,
+ "CONTENT_TYPE" => "application/json"
+ );
+
+ $data = array
+ (
+ 'title' => 'test presentation BCN',
+ 'description' => 'test presentation BCN',
+ 'allow_feedback' => true,
+ 'type_id' => 86,
+ 'summit_types_id' => [7],
+ 'tags' => ['tag#1','tag#2' ]
+ );
+
+ $response = $this->action
+ (
+ "POST",
+ "OAuth2SummitEventsApiController@addEvent",
+ $params,
+ array(),
+ array(),
+ array(),
+ $headers,
+ json_encode($data)
+ );
+
+ $this->assertResponseStatus(412);
+ }
+
+ public function testPostPresentation($start_date = 1461510000, $end_date = 1461513600 )
+ {
+ $params = array
+ (
+ 'id' => 7,
+ );
+
+ $headers = array
+ (
+ "HTTP_Authorization" => " Bearer " .$this->access_token,
+ "CONTENT_TYPE" => "application/json"
+ );
+
+ $data = array
+ (
+ 'title' => 'test presentation BCN',
+ 'description' => 'test presentation BCN',
+ 'allow_feedback' => true,
+ 'type_id' => 86,
+ 'summit_types_id' => [7],
+ 'tags' => ['tag#1','tag#2' ],
+ 'speakers' => [1,2,3],
+ );
+
+ $response = $this->action
+ (
+ "POST",
+ "OAuth2SummitEventsApiController@addEvent",
+ $params,
+ array(),
+ array(),
+ array(),
+ $headers,
+ json_encode($data)
+ );
+
+ $this->assertResponseStatus(201);
+
+ $content = $response->getContent();
+ $presentation = json_decode($content);
+
+ $this->assertTrue($presentation->getId() > 0);
+ return $presentation;
+ }
+
public function testUpdateEvent()
{
$event = $this->testPostEvent();
@@ -890,7 +956,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$params = array
(
'id' => 6,
- 'event_id' => $event->id,
+ 'event_id' => $event->getId(),
);
$headers = array
@@ -905,7 +971,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$response = $this->action
(
"PUT",
- "OAuth2SummitApiController@updateEvent",
+ "OAuth2SummitEventsApiController@updateEvent",
$params,
array(),
array(),
@@ -917,12 +983,12 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$this->assertResponseStatus(200);
$content = $response->getContent();
$event = json_decode($content);
- $this->assertTrue($event->id > 0);
+ $this->assertTrue($event->getId() > 0);
return $event;
}
- public function testPublishEvent($start_date = 1461685500, $end_date = 1461685800)
+ public function testPublishEvent($start_date = 1461520800, $end_date = 1461526200)
{
$event = $this->testPostEvent($start_date,$end_date );
unset($event->summit_types);
@@ -931,7 +997,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$params = array
(
'id' => 6,
- 'event_id' => $event->id,
+ 'event_id' => $event->getId(),
);
$headers = array
@@ -943,7 +1009,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$response = $this->action
(
"PUT",
- "OAuth2SummitApiController@publishEvent",
+ "OAuth2SummitEventsApiController@publishEvent",
$params,
array(),
array(),
@@ -958,12 +1024,12 @@ class OAuth2SummitApiTest extends ProtectedApiTest
public function testUnPublishEvent()
{
- $event = $this->testPublishEvent(1461682800, 1461683700);
+ $event = $this->testPublishEvent(1461529800, 1461533400);
$params = array
(
'id' => 6,
- 'event_id' => $event->id,
+ 'event_id' => $event->getId(),
);
$headers = array
@@ -975,7 +1041,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$response = $this->action
(
"DELETE",
- "OAuth2SummitApiController@unPublishEvent",
+ "OAuth2SummitEventsApiController@unPublishEvent",
$params,
array(),
array(),
@@ -995,7 +1061,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$params = array
(
'id' => 6,
- 'event_id' => $event->id,
+ 'event_id' => $event->getId(),
);
$headers = array
@@ -1007,7 +1073,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$response = $this->action
(
"DELETE",
- "OAuth2SummitApiController@deleteEvent",
+ "OAuth2SummitEventsApiController@deleteEvent",
$params,
array(),
array(),
@@ -1024,8 +1090,8 @@ class OAuth2SummitApiTest extends ProtectedApiTest
{
$params = array
(
- 'id' => 5,
- 'event_id' => 4189,
+ 'id' => 6,
+ 'event_id' => 15027,
);
$headers = array
@@ -1045,7 +1111,45 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$response = $this->action
(
"POST",
- "OAuth2SummitApiController@addEventFeedback",
+ "OAuth2SummitEventsApiController@addEventFeedback",
+ $params,
+ array(),
+ array(),
+ array(),
+ $headers,
+ json_encode($feedback_data)
+ );
+
+ $content = $response->getContent();
+ $this->assertResponseStatus(201);
+
+ }
+
+ public function testAddFeedback2EventByMember()
+ {
+ $params = array
+ (
+ 'id' => 6,
+ 'event_id' => 8970,
+ );
+
+ $headers = array
+ (
+ "HTTP_Authorization" => " Bearer " .$this->access_token,
+ "CONTENT_TYPE" => "application/json"
+ );
+
+ $feedback_data = array
+ (
+ 'rate' => 10,
+ 'note' => 'nice presentation, wow!',
+ );
+
+
+ $response = $this->action
+ (
+ "POST",
+ "OAuth2SummitEventsApiController@addEventFeedbackByMember",
$params,
array(),
array(),
@@ -1096,8 +1200,8 @@ class OAuth2SummitApiTest extends ProtectedApiTest
{
$params = array
(
- 'id' => 'current',
- 'from_date' => 1766620800,
+ 'id' => 6,
+ 'from_date' => 1471565531,
'limit' => 100
);
@@ -1130,7 +1234,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$params = array
(
'id' => 6,
- 'last_event_id' => 62128,
+ 'last_event_id' => 32500,
'limit' => 100
);
@@ -1255,8 +1359,8 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$params = array
(
- 'id' => 'current',
- 'event_id' => 3591,
+ 'id' => 6,
+ 'event_id' => 9454,
);
$headers = array
@@ -1268,7 +1372,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$response = $this->action
(
"GET",
- "OAuth2SummitApiController@getEventFeedback",
+ "OAuth2SummitEventsApiController@getEventFeedback",
$params,
array('expand' => 'owner'),
array(),
@@ -1289,8 +1393,8 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$params = array
(
- 'id' => 'current',
- 'event_id' => 3591,
+ 'id' => 6,
+ 'event_id' => 9454,
'attendee_id' => 'me',
);
@@ -1303,7 +1407,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$response = $this->action
(
"GET",
- "OAuth2SummitApiController@getEventFeedback",
+ "OAuth2SummitEventsApiController@getEventFeedback",
$params,
array( 'expand' => 'owner'),
array(),
@@ -1334,7 +1438,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$response = $this->action
(
"GET",
- "OAuth2SummitApiController@getLocations",
+ "OAuth2SummitLocationsApiController@getLocations",
$params,
array(),
array(),
@@ -1366,7 +1470,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$response = $this->action
(
"GET",
- "OAuth2SummitApiController@getLocation",
+ "OAuth2SummitLocationsApiController@getLocation",
$params,
array(),
array(),
@@ -1385,7 +1489,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
{
$params = array
(
- 'id' => 'current',
+ 'id' => 6,
'external_order_id' => 488240765
);
@@ -1417,7 +1521,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
{
$params = array
(
- 'id' => 'current',
+ 'id' => 6,
'external_order_id' => 'ADDDD'
);
@@ -1445,13 +1549,13 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$this->assertTrue(!is_null($order));
}
- public function testGetCurrentSummitConfirmExternalOrder()
+ public function testCurrentSummitConfirmExternalOrder()
{
$params = array
(
- 'id' => 'current',
- 'external_order_id' => 484446336,
- 'external_attendee_id' => 611227262
+ 'id' => 6,
+ 'external_order_id' => 488240765,
+ 'external_attendee_id' => 615935124
);
$headers = array
@@ -1482,12 +1586,14 @@ class OAuth2SummitApiTest extends ProtectedApiTest
{
$params = array
(
- 'id' => 'current',
- 'location_id' => 25,
+ 'id' => 6,
+ 'page' => 1,
+ 'per_page' => 50,
+ 'location_id' => 52,
'filter' => array
(
- 'tags=@design',
- 'start_date>1445895000'
+ 'tags=@Nova',
+ 'speaker=@Todd'
)
);
@@ -1501,7 +1607,7 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$response = $this->action
(
"GET",
- "OAuth2SummitApiController@getLocationEvents",
+ "OAuth2SummitLocationsApiController@getLocationEvents",
$params,
array(),
array(),
@@ -1520,12 +1626,12 @@ class OAuth2SummitApiTest extends ProtectedApiTest
{
$params = array
(
- 'id' => 'current',
- 'location_id' => 68,
- /*'filter' => array
+ 'id' => 6,
+ 'location_id' => 25,
+ 'filter' => array
(
'speaker=@Alex',
- )*/
+ )
);
$headers = array
@@ -1534,11 +1640,10 @@ class OAuth2SummitApiTest extends ProtectedApiTest
"CONTENT_TYPE" => "application/json"
);
-
$response = $this->action
(
"GET",
- "OAuth2SummitApiController@getLocationPublishedEvents",
+ "OAuth2SummitLocationsApiController@getLocationPublishedEvents",
$params,
array(),
array(),
@@ -1552,4 +1657,67 @@ class OAuth2SummitApiTest extends ProtectedApiTest
$events = json_decode($content);
$this->assertTrue(!is_null($events));
}
+
+ public function testAddPresentationVideo()
+ {
+ $params = array
+ (
+ 'id' => 6,
+ 'presentation_id' => 6838
+ );
+
+ $headers = array
+ (
+ "HTTP_Authorization" => " Bearer " .$this->access_token,
+ "CONTENT_TYPE" => "application/json"
+ );
+
+ $video_data = array
+ (
+ 'you_tube_id' => 'nrGk0AuFd_9',
+ 'name' => 'Fostering Full Equality, Organized by the Women of OpenStack!',
+ );
+
+ $response = $this->action
+ (
+ "POST",
+ "OAuth2PresentationApiController@addVideo",
+ $params,
+ array(),
+ array(),
+ array(),
+ $headers,
+ json_encode($video_data)
+ );
+
+ $content = $response->getContent();
+ $this->assertResponseStatus(201);
+
+ }
+
+ public function testGetMyMemberFromCurrentSummit(){
+
+ $params = array
+ (
+ 'expand' => 'attendee,speaker,feedback' ,
+ 'id' => 6,
+ );
+
+ $headers = array("HTTP_Authorization" => " Bearer " .$this->access_token);
+ $response = $this->action(
+ "GET",
+ "OAuth2SummitMembersApiController@getMyMember",
+ $params,
+ array(),
+ array(),
+ array(),
+ $headers
+ );
+
+ $content = $response->getContent();
+ $this->assertResponseStatus(200);
+ $member = json_decode($content);
+ $this->assertTrue(!is_null($member));
+ }
+
}
\ No newline at end of file
diff --git a/tests/ProtectedApiTest.php b/tests/ProtectedApiTest.php
index cf3aa4c4..5a524499 100644
--- a/tests/ProtectedApiTest.php
+++ b/tests/ProtectedApiTest.php
@@ -44,6 +44,8 @@ class AccessTokenServiceStub implements IAccessTokenService
$url . '/summits/delete-event',
$url . '/summits/read-external-orders',
$url . '/summits/confirm-external-orders',
+ $url . '/summits/write-videos',
+ $url . '/me/read',
);
return AccessToken::createFromParams('123456789', implode(' ', $scopes), '1', $realm, '1','11624', 3600, 'WEB_APPLICATION', '', '');
@@ -75,6 +77,9 @@ class AccessTokenServiceStub2 implements IAccessTokenService
$url . '/summits/delete-event',
$url . '/summits/read-external-orders',
$url . '/summits/confirm-external-orders',
+ $url . '/summits/write-videos',
+ $url . '/summits/write-videos',
+ $url . '/me/read',
);
return AccessToken::createFromParams('123456789', implode(' ', $scopes), '1', $realm, null,null, 3600, 'SERVICE', '', '');
diff --git a/tests/TestCase.php b/tests/TestCase.php
index ca3ba9f2..227cd10f 100644
--- a/tests/TestCase.php
+++ b/tests/TestCase.php
@@ -35,7 +35,6 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
protected function prepareForTests()
{
Artisan::call('migrate');
- Mail::pretend(true);
$this->seed('TestSeeder');
}
diff --git a/update_project.sh b/update_project.sh
new file mode 100755
index 00000000..d1bf0e9d
--- /dev/null
+++ b/update_project.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+php composer.phar update --prefer-dist;
+php composer.phar dump-autoload --optimize;
\ No newline at end of file