VichUploaderBundle

This commit is contained in:
R. Eric Wheeler 2017-04-25 15:45:32 -07:00
parent e60363f8c7
commit 2d025468cb
34 changed files with 89001 additions and 821 deletions

View File

@ -18,6 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
use JavierEguiluz\Bundle\EasyAdminBundle\EasyAdminBundle;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\HttpKernel\Kernel;
@ -39,6 +40,7 @@ class AppKernel extends Kernel
new \FOS\UserBundle\FOSUserBundle(),
new Knp\Bundle\GaufretteBundle\KnpGaufretteBundle(),
new Vich\UploaderBundle\VichUploaderBundle(),
new EasyAdminBundle(),
new Sikofitt\DoughnutWeddingBundle\SikofittDoughnutWeddingBundle(),
];

View File

@ -1,5 +1,5 @@
{% extends "@FOSUser/layout.html.twig" %}
{% extends "base.html.twig" %}
{% block fos_user_content %}
{% block body %}
{% include "@FOSUser/ChangePassword/change_password_content.html.twig" %}
{% endblock fos_user_content %}
{% endblock body %}

View File

@ -1,7 +1,7 @@
{% trans_default_domain 'SikofittDoughnutweddingBundle' %}
<h2 class="uk-width-1-1 uk-margin-medium-bottom uk-text-center">User Information</h2>
<div class="uk-width-1-1 uk-text-center uk-grid-divider uk-child-width-1-2" uk-grid>
<div class="uk-width-1-1 uk-text-center uk-child-width-1-2" uk-grid>
<div><p class="uk-padding-small uk-text-right">{{ 'profile.name'|trans }}</p></div>
<div><p class="uk-padding-small uk-text-left">{{ user.name }}</p></div>
@ -11,9 +11,14 @@
<div><p class="uk-padding-small uk-text-right">{{ 'profile.rsvp'|trans }}</p></div>
<div><p class="uk-padding-small uk-text-left">{% if user.rsvp is not null %}{{ user.rsvp.guests }}{% else %}0{% endif %}</p></div>
<div class="uk-width-1-2@m uk-width-1-1@s uk-align-center uk-margin-small uk-grid-margin uk-first-column">
<a href="{{ url('fos_user_profile_edit') }}" title="Edit profile" class="uk-button-large uk-button uk-button-primary uk-width-1-1">Edit Information</a></div>
</div>
</div>
<div class="uk-width-1-1 uk-margin-medium uk-text-center">
You can change your password <a href="{{ path('fos_user_change_password') }}">here.</a>
</div>
<div class="uk-width-1-2@m uk-width-1-1@s uk-align-center uk-margin-small uk-first-column">
<a href="{{ url('fos_user_profile_edit') }}" title="Edit profile" class="uk-button-large uk-button uk-button-primary uk-width-1-1">Edit Information</a>
</div>
<div class="uk-width-1-6@m uk-visible@m uk-margin-large-top uk-position-center-right">
<ul class="uk-iconnav uk-iconnav-vertical">

View File

@ -1,11 +1,12 @@
{% trans_default_domain 'FOSUserBundle' %}
<h1 class="uk-h2 uk-text-center">Reset your password</h1>
<form action="{{ path('fos_user_resetting_send_email') }}" method="POST" class="uk-form uk-form-horizontal fos_user_resetting_request">
<form action="{{ path('fos_user_resetting_send_email') }}" method="POST" class="fos_user_resetting_request">
<div>
<label for="username">{{ 'resetting.request.username'|trans }}</label>
<input type="text" id="username" name="username" required="required" />
</div>
<div>
<input type="submit" value="{{ 'resetting.request.submit'|trans }}" />
<label class="uk-form-label uk-visible@m" for="username">Email address </label>
<div class="uk-form-controls-text uk-form-controls">
<input class="uk-input uk-form-large" type="text" id="username" name="username" placeholder="Enter your email address" required="required" />
</div>
<div class="uk-width-1-1@s uk-width-1-3@m uk-align-right@m uk-margin-small-top">
<input type="submit" class="uk-width-1-1 uk-button uk-button-large uk-button-primary" value="{{ 'resetting.request.submit'|trans }}" />
</div>
</form>

View File

@ -1,6 +1,7 @@
{% extends 'HWIOAuthBundle::layout.html.twig' %}
{% block hwi_oauth_content %}
{{ dump() }}
{% if error is defined and error %}
<span>{{ error }}</span>
{% endif %}

View File

@ -1,29 +1,58 @@
{% extends 'base.html.twig' %}
{% block body %}
<div class="uk-width-1-1">
{{ dump(form) }}
<div class="uk-width-1-1">
{% if userInformation.resourceOwner.name == 'yahoo' %}
{% set name = userInformation.nickname %}
{% set name = userInformation.nickname %}
{% else %}
{% set name = userInformation.email %}
{% set name = userInformation.email %}
{% endif %}
<h3>{{ 'header.register' | trans({'%name%': name }, 'HWIOAuthBundle') }}</h3>
{{ form_start(form, {'action': path('hwi_oauth_connect_registration', {'key': key}), 'attr': {'class': 'hwi_oauth_registration_register uk-form uk-form-horizontal'}}) }}
{{ form_widget(form) }}
<div>
<button type="submit" class="btn btn-primary">{{ 'connect.registration.submit'|trans({}, 'HWIOAuthBundle') }}</button>
<a href="{{ path('hwi_oauth_connect') }}" class="btn">{{ 'connect.registration.cancel' | trans({}, 'HWIOAuthBundle') }}</a>
</div>
{{ form_end(form) }}
{% if userInformation.profilePicture is not empty %}
<img src="{{ userInformation.profilePicture }}" />
{% endif %}
{{ form_start(form, {'action': path('hwi_oauth_connect_registration', {'key': key}), 'attr': {'class': 'hwi_oauth_registration_register uk-form uk-form-horizontal'}}) }}
{{ form_label(form.name, 'Name', {'label_attr':{'class':'uk-form-label uk-visible@m'}}) }}
<div class="uk-form-controls uk-form-controls-text uk-margin-small-bottom">
{{ form_widget(form.name, {'attr':{'class':'uk-input uk-form-large', 'placeholder':'Your name'}}) }}
</div>
{{ form_label(form.email, 'Email address', {'label_attr':{'class':'uk-form-label uk-visible@m'}}) }}
<div class="uk-form-controls uk-form-controls-text uk-margin-small-bottom">
{{ form_widget(form.email, {'attr':{'class':'uk-input uk-form-large', 'placeholder':'Email address'}}) }}
</div>
{{ form_label(form.plainPassword.first, 'Password', {'label_attr':{'class':'uk-form-label uk-visible@m'}}) }}
<div class="uk-form-controls uk-form-controls-text uk-margin-small-bottom">
{{ form_widget(form.plainPassword.first, {'attr':{'class':'uk-input uk-form-large', 'placeholder':'Create password'}}) }}
</div>
{{ form_label(form.plainPassword.second, 'Repeat password', {'label_attr':{'class':'uk-form-label uk-visible@m'}}) }}
<div class="uk-form-controls uk-form-controls-text uk-margin-small-bottom">
{{ form_widget(form.plainPassword.second, {'attr':{'class':'uk-input uk-form-large', 'placeholder':'Repeat password'}}) }}
</div>
{{ form_label(form.rsvp, 'Number of guests? (including yourself)', {'label_attr':{'class':'uk-form-label uk-visible@m'}}) }}
<div class="uk-form-controls uk-form-controls-text uk-margin-small-bottom">
{{ form_widget(form.rsvp, {'attr':{'placeholder':'Guest\'s including yourself.'}}) }}
</div>
{{ form_label(form.comment) }}
<div class="uk-form-controls uk-form-controls-text">
{{ form_widget(form.comment) }}
</div>
<div class="uk-child-width-1-2@m uk-child-width-1-1@s uk-grid uk-grid-divider uk-margin-medium-top" uk-grid>
<div>
<input type="submit" class="uk-width-1-1 uk-button-primary uk-button uk-button-large"
value="{{ 'connect.registration.submit'|trans({}, 'HWIOAuthBundle') }}"/>
</div>
<div>
<a href="{{ path('hwi_oauth_connect') }}"
class="uk-width-1-1 uk-button uk-button-large uk-button-danger">{{ 'connect.registration.cancel' | trans({}, 'HWIOAuthBundle') }}</a>
</div>
</div>
{{ form_end(form) }}
{% if userInformation.profilePicture is not empty %}
<img src="{{ userInformation.profilePicture }}"/>
{% endif %}
</div>
{% endblock body %}

View File

@ -20,17 +20,17 @@
<div class="uk-container uk-container-expand uk-hidden@m">
<nav class="uk-navbar">
<div class="uk-navbar-left uk-responsive-width">
<a href="{{ path('sikofitt_doughnutwedding_default_index') }}"><img src="{{ asset('images/logo.png') }}" /></a>
<a class="uk-transform-origin-center-left uk-animation-scale-up" href="{{ path('sikofitt_doughnutwedding_default_index') }}"><img src="{{ asset('images/logo.png') }}" /></a>
</div>
<div class="uk-navbar-right">
<a uk-navbar-toggle-icon="" href="#offcanvas" uk-toggle="" class="uk-navbar-toggle uk-hidden@m uk-navbar-toggle-icon uk-icon"></a></div>
<a uk-navbar-toggle-icon="" href="#offcanvas" uk-toggle="" class="uk-navbar-toggle uk-hidden@m uk-navbar-toggle-icon uk-icon"></a>
</div>
</nav>
</div>
<div class="uk-container-small uk-container uk-margin-medium-top uk-margin-medium-bottom">
<div class="uk-visible@m uk-responsive-width uk-width-3-4 uk-align-center">
<div class="uk-logo uk-animation-scale-up uk-transform-origin-top-center">
<div class="uk-logo uk-animation-scale-up uk-transform-origin-bottom-center">
<h2 class="uk-text-center">ERIC + KATRINA'S</h2>
<a href="{{ path('sikofitt_doughnutwedding_default_index') }}"><img src="{{ asset('images/logo.png') }}" /></a>
<h3 class="uk-margin-small-top uk-text-center">MAY 12TH, 2017</h3>
@ -44,23 +44,46 @@
{% include "social_login.html.twig" %}
{% block footer %}{% endblock %}
</div>
<div id="offcanvas" uk-offcanvas="overlay: true">
<div class="uk-offcanvas-bar">
<div id="offcanvas" uk-offcanvas="overlay: true; mode:reveal">
<div class="uk-offcanvas-bar uk-offcanvas-bar-animation">
<button class="uk-offcanvas-close" type="button" uk-close></button>
<ul class="uk-nav uk-nav-primary">
<li class="uk-nav-header">Navigation</li>
<li class="uk-nav-divider"></li>
<li><a href="{{ path('sikofitt_doughnutwedding_default_index') }}"><span class="uk-margin-small-right" uk-icon="icon: home"></span> Home</a></li>
<li><a href="{{ path('sikofitt_doughnutwedding_default_ourstory') }}"><span class="uk-margin-small-right" uk-icon="icon: heart"></span> Our Story</a></li>
<li><a href="{{ path('sikofitt_doughnutwedding_rsvp_index') }}"><span class="uk-margin-small-right" uk-icon="icon: bolt"></span> RSVP</a></li>
<li><a href="{{ path('sikofitt_doughnutwedding_gallery_index') }}"><span class="uk-margin-small-right" uk-icon="icon: image"></span> Gallery</a></li>
<li><a href="#"><span class="uk-margin-small-right" uk-icon="icon: location"></span> Location</a></li>
<li><a href="#"><span class="uk-margin-small-right" uk-icon="icon: mail"></span> Get In Touch</a></li>
<ul class="uk-nav uk-nav-default">
<li class="uk-active"><a href="#">Active</a></li>
<li class="uk-parent">
<a href="#">Parent</a>
<ul class="uk-nav-sub">
<li><a href="#">Sub item</a></li>
<li><a href="#">Sub item</a></li>
</ul>
</li>
<li class="uk-nav-header">Header</li>
<li><a href="#"><span class="uk-margin-small-right" uk-icon="icon: table"></span> Item</a></li>
<li><a href="#"><span class="uk-margin-small-right" uk-icon="icon: thumbnails"></span> Item</a></li>
{% if not is_granted('IS_AUTHENTICATED_FULLY') %} {% set social_prefix = 'Login with' %} {% else %} {% set social_prefix = 'Link Account With' %} {% endif %}
{% if is_granted('IS_AUTHENTICATED_FULLY') %}
<li class="uk-nav-header">{{ app.user.name }}</li>
<li class="uk-nav-divider"></li>
<li><a href="#"><span class="uk-margin-small-right" uk-icon="icon: trash"></span> Item</a></li>
<li><a href="#"><span class="uk-margin-small-right" uk-icon="icon: user"></span> Profile</a></li>
<li><a><span class="uk-margin-small-right" uk-icon="icon: lock"></span> Change password</a></li>
<li><a><span class="uk-margin-small-right" uk-icon="icon: sign-out"></span> Logout</a></li>
{% else %}
<li class="uk-nav-header">User</li>
<li class="uk-nav-divider"></li>
<li><a href="{{ path('fos_user_security_login') }}" title="Login"><span class="uk-margin-small-right" uk-icon="icon: sign-in"></span> Login</a></li>
<li><a href="{{ path('fos_user_registration_register') }}" title="Register"><span class="uk-margin-small-right" uk-icon="icon: star"></span> Register / RSVP</a></li>
{% endif %}
<li>
<div class="uk-position-fixed uk-position-bottom uk-padding-small">
<p class="uk-text-meta uk-text-center uk-margin-small-bottom">{{ social_prefix }}</p>
<ul class="uk-iconnav">
<li><a><span class="uk-margin-small-right" uk-icon="icon: facebook"></span></a></li>
<li><a><span class="uk-margin-small-right" uk-icon="icon: google"></span></a></li>
<li><a><span class="uk-margin-small-right" uk-icon="icon: instagram"></span></a></li>
<li><a><span class="uk-margin-small-right" uk-icon="icon: twitter"></span></a></li>
<li><a><span class="uk-margin-small-right uk-icon-image uk-login uk-login-yahoo"><img height="20" width="20" src="{{ asset('images/yahoo.svg') }}" uk-svg></span></a></li>
<li><a><span class="uk-margin-small-right uk-icon-image uk-login uk-login-amazon"><img height="20" width="20" src="{{ asset('images/amazon.svg') }}" uk-svg></span></a></li>
</ul>
</div>
</li>
</ul>
</div>

View File

@ -5,21 +5,21 @@
<div class="uk-home uk-child-width-1-3@s uk-grid-match uk-grid-small" uk-grid>
<div>
<div class="uk-background-cover uk-background-fade uk-our-story-home uk-height-large uk-card uk-card-default uk-card-body uk-flex uk-flex-center uk-flex-middle">
<a href="#" class="uk-position-cover"></a>
<a href="{{ path('sikofitt_doughnutwedding_default_ourstory') }}" class="uk-position-cover"></a>
<div class="uk-light uk-width-1-1 uk-overlay uk-margin-large-top uk-position-center">
<h3 class="uk-position-cover uk-text-center"><a href="#" class="uk-position-cover uk-box-shadow-small">our story</a></h3>
</div>
</div>
</div>
<div>
<div class="uk-background-cover uk-doughnut-rsvp uk-margin-small-bottom uk-height-small uk-card uk-card-default uk-card-body uk-flex uk-flex-center uk-flex-middle">
<a href="#" class="uk-position-cover"></a>
<div class="uk-background-cover uk-background-fade uk-doughnut-rsvp uk-margin-small-bottom uk-height-small uk-card uk-card-default uk-card-body uk-flex uk-flex-center uk-flex-middle">
<a href="{{ path('fos_user_profile_edit') }}" class="uk-position-cover"></a>
<div class="uk-light uk-width-1-1 uk-overlay uk-margin-small-top uk-position-center">
<h3 class="uk-position-cover uk-text-center"><a href="#" class="uk-position-cover uk-box-shadow-small">RSVP</a></h3>
</div>
</div>
<div class="uk-height-medium uk-background-cover uk-photo-home uk-card uk-card-default uk-card-body uk-flex uk-flex-center uk-flex-middle">
<a href="#" class="uk-position-cover"></a>
<a href="{{ path('sikofitt_doughnutwedding_gallery_index') }}" class="uk-position-cover"></a>
<div class="uk-light uk-width-1-1 uk-overlay uk-margin-small-top uk-position-center">
<h3 class="uk-position-cover uk-text-center"><a href="#" class="uk-position-cover uk-box-shadow-small">photo gallery</a></h3>
</div>
@ -32,7 +32,7 @@
<h3 class="uk-position-cover uk-text-center"><a href="#" class="uk-position-cover uk-box-shadow-small">location</a></h3>
</div>
</div>
<div class="uk-height-small uk-background-cover uk-doughnut-get-in-touch-home uk-card uk-card-default uk-card-body uk-flex uk-flex-center uk-flex-middle">
<div class="uk-height-small uk-background-cover uk-background-fade uk-doughnut-get-in-touch-home uk-card uk-card-default uk-card-body uk-flex uk-flex-center uk-flex-middle">
<a href="#" class="uk-position-cover"></a>
<div class="uk-light uk-width-1-1 uk-overlay uk-position-center uk-margin-small-top">
<h3 class="uk-position-cover uk-text-center"><a href="#" class="uk-position-cover uk-box-shadow-small">get in touch</a></h3>
@ -49,7 +49,7 @@
</p>
</div>
<div class="uk-width-1-1">
<p class="uk-text-center"><a href="#" class="uk-width-1-5@m uk-width-1-1@s uk-button uk-button-primary">Join Group</a></p></div>
<p class="uk-text-center"><a href="https://www.facebook.com/groups/doughnutwedding" class="uk-width-1-5@m uk-width-1-1@s uk-button uk-button-primary">Join Group</a></p></div>
</div>
{% endblock %}

View File

@ -1,8 +0,0 @@
{% extends 'base.html.twig' %}
{% block body %}
{{ 'Hello World!' }}
{% for key, request in app.request_stack %}
{{ dump(key) }}
{% endfor %}
{% endblock %}

View File

@ -0,0 +1,21 @@
{% extends 'base.html.twig' %}
{% block body %}
<h1 class="uk-text-center" style="letter-spacing: .15rem">Our Story</h1>
<div class="uk-column-1-2@m uk-column-divider">
<p>Eric and Katrina first met online in 2014. After texting back and forth for a week they finally met in
persion at a little coffee shop in Oakland on July 23, 2014. Eric was shy and Katrina was nervous, but somehow they found enough
to talk about to agree to a second date where they continued to bond over coffee, cigarettes, and zombie movies.</p>
<p>Ollie (Katrina's dog) loved Eric instantly, and Buddy and Mayu (Eric's cats) never murdered Katrina in her sleep, so they tolerated her.</p>
<p class="uk-column-span uk-text-lead uk-text-center">This was a good sign.</p>
<p>In August 2016 they packed everything into a couple of crates and moved up north to Portland, Oregon. After six months of the both of them working from home,
they realized that they were still madly in love (despite seeing each other all day, every day.) So on February 6, 2017 Eric proposed to Katrina.</p>
<p class="uk-column-span uk-text-lead uk-text-center uk-text-primary">
On May 12, 2017 they will both say "yes" and live happily ever after til death do they part.
</p>
</div>
<div class="uk-width-1-1">
<p class="uk-text-center">
<a href="{{ path('sikofitt_doughnutwedding_gallery_index') }}" class="uk-button uk-button-primary">Check out some photos!</a>
</p>
</div>
{% endblock %}

View File

@ -3,7 +3,7 @@ imports:
- { resource: security.yml }
- { resource: services.yml }
- { resource: snc_redis.yml }
- { resource: easy_admin.yml }
# Put parameters here that don't need to change on each machine where the app is deployed
# http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
@ -169,10 +169,10 @@ hwi_oauth:
instagram: instagramId
twitter: twitterId
yahoo: yahooId
# if you want to use 'connect' and do not use the FOSUB integration, configure these separately
connect:
confirmation: false
failed_auth_path: fos_user_security_login
fos_user:
db_driver: orm # other valid values are 'mongodb' and 'couchdb'
firewall_name: secured_area
@ -186,9 +186,21 @@ fos_user:
registration:
form:
type: Sikofitt\DoughnutWeddingBundle\Form\RegistrationType
change_password:
form:
type: Sikofitt\DoughnutWeddingBundle\Form\ChangePasswordFormType
knp_gaufrette:
stream_wrapper: ~
adapters:
assets:
google_cloud_storage:
service_id: 'doughnutwedding.google_cloud_storage.service'
bucket_name: 'zgluzzkwodfky2m0ytbhmjhmmzqzntq2ngy3ndjmntyxmzg4'
options:
acl: 'public'
directory: 'assets'
gallery:
google_cloud_storage:
service_id: 'doughnutwedding.google_cloud_storage.service'
@ -200,7 +212,15 @@ knp_gaufrette:
cloud:
adapter: gallery
alias: google_cloud
assets:
adapter: assets
alias: cloud_assets
vich_uploader:
db_driver: orm
storage: gaufrette
mappings:
gallery_image:
upload_destination: cloud
uri_prefix: /
sikofitt_doughnut_wedding:
max_rsvps: ~

View File

@ -9,7 +9,7 @@ framework:
web_profiler:
toolbar: true
intercept_redirects: true
intercept_redirects: false
monolog:
handlers:

49
app/config/easy_admin.yml Normal file
View File

@ -0,0 +1,49 @@
easy_admin:
design:
form_theme: 'vertical'
entities:
User:
class: Sikofitt\DoughnutWeddingBundle\Entity\User
list:
actions: ['show','edit','delete']
fields: ['name','username','email','enabled','lastLogin','rsvp']
show:
fields:
- name
- username
- email
- rsvp
- comment
- images
- enabled
- lastLogin
- passwordRequestedAt
- roles
- created
- updated
- facebookId
- googleId
- amazonId
- instagramId
- twitterId
- yahooId
Rsvp:
class: Sikofitt\DoughnutWeddingBundle\Entity\Rsvp
Image:
class: Sikofitt\DoughnutWeddingBundle\Entity\Image
image_base_path: 'https://storage.googleapis.com/zgluzzkwodfky2m0ytbhmjhmmzqzntq2ngy3ndjmntyxmzg4/gallery/'
list:
actions: ['show','delete']
fields:
- { property: 'imageName', label: 'Image', type: 'image', base_path: 'https://storage.googleapis.com/zgluzzkwodfky2m0ytbhmjhmmzqzntq2ngy3ndjmntyxmzg4/gallery/' }
- category
- tags
- user
form:
fields:
- { property: 'imageFile', type: 'vich_image', base_path: 'https://storage.googleapis.com/zgluzzkwodfky2m0ytbhmjhmmzqzntq2ngy3ndjmntyxmzg4/gallery/' }
- { property: tags, type: 'collection'}
- category
- user

View File

@ -45,6 +45,11 @@ fos_user_change_password:
resource: "@FOSUserBundle/Resources/config/routing/change_password.xml"
prefix: /user/profile
easy_admin_bundle:
resource: "@EasyAdminBundle/Controller/"
type: annotation
prefix: /admin
sikofitt_doughnut_wedding:
resource: "@SikofittDoughnutWeddingBundle/Controller/"
type: annotation

View File

@ -5,9 +5,14 @@ security:
FOS\UserBundle\Model\UserInterface:
algorithm: bcrypt
cost: 14
role_hierarchy:
ROLE_USER: ~
ROLE_ADMIN: [ROLE_USER]
ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN]
providers:
fos_userbundle:
id: fos_user.user_provider.username
id: fos_user.user_provider.username_email
firewalls:
# disables authentication for assets and the profiler, adapt it according to your needs
dev:
@ -31,17 +36,21 @@ security:
instagram: /login/callback/instagram
amazon: /login/callback/amazon
yahoo: /login/callback/yahoo
login_path: /connect
login_path: /login
use_forward: false
failure_path: /login
failure_path: /connect
oauth_user_provider:
service: hwi_oauth.user.provider.fosub_bridge
access_control:
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/login/callback$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/logout$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/login_check$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/user$, role: ROLE_USER }
- { path: ^/user, role: ROLE_USER }
- { path: ^/gallery/upload, role: ROLE_USER }
- { path: ^/gallery, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin$, role: ROLE_ADMIN }
- { path: ^/.*, role: IS_AUTHENTICATED_ANONYMOUSLY }

View File

@ -13,6 +13,11 @@ services:
arguments: ['@fos_user.user_manager']
tags:
- { name: form.type, alias: app_user_registration }
doughnutwedding.form.profile:
class: Sikofitt\DoughnutWeddingBundle\Form\ProfileEditType
arguments: ['@fos_user.user_manager']
tags:
- { name: form.type, alias: app_user_profile_edit }
doughnutwedding.event.redirect_user_logged_in_event:
class: Sikofitt\DoughnutWeddingBundle\EventListener\UserRedirectOnLoggedInListener
arguments: ['@security.token_storage', '@router']

88166
app/logs/development.log Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
jQuery(document).ready(function($) {
if(null === document.querySelector('select') && document.querySelector('select').length > 0) {
if(null !== document.querySelector('select') && document.querySelector('select').length > 0) {
var selectPlaceholder = 'Choose an option.';
if(document.querySelector('select').hasAttribute('placeholder')) {
selectPlaceholder = document.querySelector('select').getAttribute('placeholder');

View File

@ -45,4 +45,15 @@ class DefaultController extends Controller
}
return $this->render('default/index.html.twig', $parameters);
}
/**
* @Route("/our_story")
*
* @param \Symfony\Component\HttpFoundation\Request $request
*
* @return Response
*/
public function ourStoryAction(Request $request) {
return $this->render('our_story.html.twig');
}
}

View File

@ -21,25 +21,25 @@
namespace Sikofitt\DoughnutWeddingBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sikofitt\DoughnutWeddingBundle\Entity\Image;
use Sikofitt\DoughnutWeddingBundle\Form\GalleryUploadType;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Vich\UploaderBundle\Form\Type\VichImageType;
/**
* Class ImageController.
*
* @Route("/gallery")
*/
class ImageController extends Controller
class GalleryController extends Controller
{
/**
* @Route("/")
*/
public function indexAction()
{
/** @var \Gaufrette\Filesystem $fileSystem */
$fileSystem = $this->get('knp_gaufrette.filesystem_map')->get('cloud');
dump($fileSystem->listKeys());
return $this->render('SikofittDoughnutWeddingBundle:Image:index.html.twig', [
]);
$images = $this->get('doctrine.orm.default_entity_manager')->getRepository('SikofittDoughnutWeddingBundle:Image')->findAll();
return $this->render('SikofittDoughnutWeddingBundle:Image:index.html.twig', ['images' => $images]);
}
/**
@ -47,8 +47,10 @@ class ImageController extends Controller
*/
public function uploadAction()
{
$form = $this->get('form.factory')->create(GalleryUploadType::class, new Image());
return $this->render('SikofittDoughnutWeddingBundle:Image:upload.html.twig', [
// ...
'form' => $form->createView()
]);
}

View File

@ -1,43 +0,0 @@
<?php
/*
* doughnutwedding.com
* Copyright (C) 2017 http://doughnutwedding.com eric@doughnutwedding.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Sikofitt\DoughnutWeddingBundle\Controller;
class RouterCollector
{
/**
* @var \Kernel
*/
private $application;
public function setApplication(\Kernel $application)
{
$this->application = $application;
return $this;
}
public function buildRoutes()
{
$this->application->match('/login', DefaultController::class.'::loginAction')
->method('GET|POST')
->bind('login');
}
}

View File

@ -22,7 +22,9 @@ namespace Sikofitt\DoughnutWeddingBundle\Controller;
use Doctrine\ORM\EntityManager;
use Sikofitt\DoughnutWeddingBundle\Form\RsvpType;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Bundle\FrameworkBundle\Tests\Controller\ContainerAwareController;
use Symfony\Component\Form\FormFactory;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
@ -45,26 +47,13 @@ class RsvpController extends Controller
* @var UserRepository $userRepo
*/
$em = $this->get('doctrine.orm.entity_manager');
$rsvpRepo = $em->getRepository('Sikofitt:Rsvp');
$count = (40 - $rsvpRepo->getRsvpCount());
$userRepo = $em->getRepository('Sikofitt:User');
$kCount = $userRepo->getKatrinaCount();
$eCount = $userRepo->getEricCount();
/**
* @var FormFactory $formFactory
*/
$formFactory = $app['form.factory'];
$user = new User();
$rsvp = new Rsvp();
$rsvp
->setCreated(new \DateTime('now'))
->setUpdated(new \DateTime('now'));
$user
->setRsvp($rsvp)
->setCreated(new \DateTime('now'))
->setUpdated(new \DateTime('now'));
$user = $this->getUser();
$form = $this->get('form.factory')->create(RsvpType::class, $user);
$form = $formFactory->create(RsvpType::class, $user);
if ($request->isMethod('POST')) {
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
@ -73,23 +62,16 @@ class RsvpController extends Controller
/**
* @var EntityManager $em
*/
$em = $app['orm.em'];
$em->persist($user);
$em->flush();
return $app->redirect('/rsvp');
return $this->render('rsvp_form.html.twig', ['form' => $form->createView()]);
}
}
return $app->render(
'rsvp_form.html.twig',
[
'form' => $form->createView(),
'count' => $count,
'kCount' => $kCount,
'eCount' => $eCount,
]
);
return $this->redirect($this->generateUrl('fos_user_profile_edit'));
}
/**

View File

@ -3,10 +3,12 @@
namespace Sikofitt\DoughnutWeddingBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\File\File;
/**
* Image
*
* @Vich\Uploadable()
* @ORM\Table(name="image")
* @ORM\Entity(repositoryClass="Sikofitt\DoughnutWeddingBundle\Repository\ImageRepository")
*/
@ -22,57 +24,144 @@ class Image
private $id;
/**
* @var string
* @var File
*
* @ORM\Column(name="imageFile", type="string", length=255)
* @Vich\UploadableField(mapping="gallery_image", fileNameProperty="imageName", size="imageSize")
*/
private $imageFile;
/**
* @var string
*
* @ORM\Column(name="imageName", type="string", length=255)
* @ORM\Column(type="string", length=255)
*/
private $imageName;
/**
* @var int
* @var \Sikofitt\DoughnutWeddingBundle\Entity\User
*
* @ORM\Column(name="user", type="integer", nullable=true)
* @ORM\ManyToOne(targetEntity="Sikofitt\DoughnutWeddingBundle\Entity\User", inversedBy="images")
*/
private $user;
/**
* @var string
*
* @ORM\Column(name="tags", type="json_array", nullable=true, unique=false)
*/
private $tags;
/**
/**
* @var string
*
* @ORM\Column(name="category", type="string", length=255, nullable=true, unique=false)
*/
private $category;
/**
* @var string
*
* @ORM\Column(name="description", type="text", nullable=true, unique=false)
*/
private $description;
/**
* @var bool
*
* @ORM\Column(name="is_published", type="boolean")
*/
private $isPublished = true;
/**
* @var \DateTimeImmutable
*
* @ORM\Column(name="updated_at", type="datetime", nullable=true)
*/
private $updatedAt;
/**
* Get id
*
* @return int
*/
public function getId()
public function getId() : ?int
{
return $this->id;
}
/**
* @return string
*/
public function getDescription(): ?string {
return $this->description;
}
/**
* @param string $description
*
* @return Image
*/
public function setDescription(?string $description): Image {
$this->description = $description;
return $this;
}
/**
* @return bool
*/
public function isIsPublished(): bool {
return $this->isPublished;
}
/**
* @param bool $isPublished
*
* @return Image
*/
public function setIsPublished(bool $isPublished): Image {
$this->isPublished = $isPublished;
return $this;
}
/**
* @return \DateTimeImmutable
*/
public function getUpdatedAt(): ?\DateTimeImmutable {
return $this->updatedAt;
}
/**
* @param \DateTimeImmutable $updatedAt
*
* @return Image
*/
public function setUpdatedAt(\DateTimeImmutable $updatedAt): Image {
$this->updatedAt = $updatedAt;
return $this;
}
/**
* Set imageFile
*
* @param string $imageFile
* @param File|UploadedFile $imageFile
*
* @return Image
*/
public function setImageFile($imageFile)
public function setImageFile(?File $imageFile) : Image
{
$this->imageFile = $imageFile;
if($imageFile) {
$this->updatedAt = new \DateTimeImmutable();
}
return $this;
}
/**
* Get imageFile
*
* @return string
* @return File|null
*/
public function getImageFile()
public function getImageFile() : ?File
{
return $this->imageFile;
}
@ -84,7 +173,7 @@ class Image
*
* @return Image
*/
public function setImageName($imageName)
public function setImageName(string $imageName) : Image
{
$this->imageName = $imageName;
@ -96,19 +185,24 @@ class Image
*
* @return string
*/
public function getImageName()
public function getImageName() : ?string
{
return $this->imageName;
if(null === $this->imageName && null !== $this->imageFile) {
return $this->imageFile->getFilename();
}
return $this->imageName;
}
/**
* Set user
*
* @param integer $user
* @param User $user
*
* @return Image
*/
public function setUser($user)
public function setUser(?User $user) : Image
{
$this->user = $user;
@ -118,11 +212,62 @@ class Image
/**
* Get user
*
* @return int
* @return User
*/
public function getUser()
public function getUser() : ?User
{
return $this->user;
}
}
/**
* Set tags
*
* @param array $tags
*
* @return Image
*/
public function setTags($tags) : Image
{
$this->tags = $tags;
return $this;
}
/**
* Get tags
*
* @return array
*/
public function getTags()
{
return $this->tags;
}
/**
* Set category
*
* @param string $category
*
* @return Image
*/
public function setCategory($category)
{
$this->category = $category;
return $this;
}
/**
* Get category
*
* @return string
*/
public function getCategory()
{
return $this->category;
}
public function __toString() {
return $this->imageName;
//return sprintf('<img src="%s" alt="%s" />', $this->imageName, $this->imageName);
}
}

View File

@ -1,128 +0,0 @@
<?php
namespace Sikofitt\DoughnutWeddingBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* ImageCategory
*
* @ORM\Table(name="image_category")
* @ORM\Entity(repositoryClass="Sikofitt\DoughnutWeddingBundle\Repository\ImageCategoryRepository")
*/
class ImageCategory
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="categoryName", type="string", length=255)
*/
private $categoryName;
/**
* @var string
*
* @ORM\Column(name="machineName", type="string", length=255, unique=true)
*/
private $machineName;
/**
* @var int
*
* @ORM\Column(name="image", type="integer")
*/
private $image;
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set categoryName
*
* @param string $categoryName
*
* @return ImageCategory
*/
public function setCategoryName($categoryName)
{
$this->categoryName = $categoryName;
return $this;
}
/**
* Get categoryName
*
* @return string
*/
public function getCategoryName()
{
return $this->categoryName;
}
/**
* Set machineName
*
* @param string $machineName
*
* @return ImageCategory
*/
public function setMachineName($machineName)
{
$this->machineName = $machineName;
return $this;
}
/**
* Get machineName
*
* @return string
*/
public function getMachineName()
{
return $this->machineName;
}
/**
* Set image
*
* @param integer $image
*
* @return ImageCategory
*/
public function setImage($image)
{
$this->image = $image;
return $this;
}
/**
* Get image
*
* @return int
*/
public function getImage()
{
return $this->image;
}
}

View File

@ -1,128 +0,0 @@
<?php
namespace Sikofitt\DoughnutWeddingBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* ImageTag
*
* @ORM\Table(name="image_tag")
* @ORM\Entity(repositoryClass="Sikofitt\DoughnutWeddingBundle\Repository\ImageTagRepository")
*/
class ImageTag
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="tagName", type="string", length=255)
*/
private $tagName;
/**
* @var string
*
* @ORM\Column(name="machineName", type="string", length=255, unique=true)
*/
private $machineName;
/**
* @var int
*
* @ORM\Column(name="image", type="integer", nullable=true)
*/
private $image;
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set tagName
*
* @param string $tagName
*
* @return ImageTag
*/
public function setTagName($tagName)
{
$this->tagName = $tagName;
return $this;
}
/**
* Get tagName
*
* @return string
*/
public function getTagName()
{
return $this->tagName;
}
/**
* Set machineName
*
* @param string $machineName
*
* @return ImageTag
*/
public function setMachineName($machineName)
{
$this->machineName = $machineName;
return $this;
}
/**
* Get machineName
*
* @return string
*/
public function getMachineName()
{
return $this->machineName;
}
/**
* Set image
*
* @param integer $image
*
* @return ImageTag
*/
public function setImage($image)
{
$this->image = $image;
return $this;
}
/**
* Get image
*
* @return int
*/
public function getImage()
{
return $this->image;
}
}

View File

@ -180,4 +180,8 @@ class Rsvp
{
return $this->user;
}
public function __toString() {
return sprintf('%d guests', $this->guests);
}
}

View File

@ -20,158 +20,173 @@
namespace Sikofitt\DoughnutWeddingBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\PersistentCollection;
use Symfony\Component\Validator\Constraints as Assert;
/** @noinspection ClassOverridesFieldOfSuperClassInspection */
/**
* Class User.
*
* @ORM\Entity(repositoryClass="Sikofitt\DoughnutWeddingBundle\Repository\UserRepository")
* @ORM\Table(name="users")
*/
class User extends \FOS\UserBundle\Model\User
{
const KATRINA_SIDE = 'Katrina';
class User extends \FOS\UserBundle\Model\User {
const ERIC_SIDE = 'Eric';
const KATRINA_SIDE = 'Katrina';
/**
* @ORM\Id()
* @ORM\Column(name="id", type="integer", nullable=false, unique=true)
* @ORM\GeneratedValue(strategy="IDENTITY")
*
* @var int
*/
protected $id;
const ERIC_SIDE = 'Eric';
/**
* @ORM\Column(name="fullname", type="string", length=255, nullable=false)
* @Assert\NotBlank()
* @Assert\Regex(pattern="/\w+/")
*/
private $name;
/**
* @ORM\Id()
* @ORM\Column(name="id", type="integer", nullable=false, unique=true)
* @ORM\GeneratedValue(strategy="IDENTITY")
*
* @var int
*/
protected $id;
/**
* @var string
* @ORM\Column(name="reset_token", type="string", length=255, nullable=true)
*/
private $resetToken;
/**
* @ORM\Column(name="fullname", type="string", length=255, nullable=false)
* @Assert\NotBlank()
* @Assert\Regex(pattern="/\w+/")
*/
private $name;
/**
* @var string
* @ORM\Column(name="user_token", type="string", length=255, nullable=true)
*/
private $userToken;
/**
* @var \Sikofitt\DoughnutWeddingBundle\Entity\Rsvp
* @ORM\OneToOne(targetEntity="Sikofitt\DoughnutWeddingBundle\Entity\Rsvp", inversedBy="user",
* cascade={"persist"})
*/
private $rsvp;
/**
* @var int
* @ORM\OneToOne(targetEntity="Sikofitt\DoughnutWeddingBundle\Entity\Rsvp", inversedBy="user", cascade={"persist"})
*/
private $rsvp;
/**
* @ORM\Column(type="datetime", name="created")
*/
private $created;
/**
* @ORM\Column(type="datetime", name="created")
*/
private $created = null;
/**
* @ORM\Column(type="datetime", name="updated")
*/
private $updated;
/**
* @ORM\Column(type="datetime", name="updated")
*/
private $updated = null;
/**
* @var \Doctrine\Common\Collections\ArrayCollection
*
* @ORM\OneToMany(targetEntity="Sikofitt\DoughnutWeddingBundle\Entity\Image", mappedBy="user")
*/
private $images;
/**
* @var string
*
* @ORM\Column(name="comments", type="text", nullable=true)
*/
private $comment;
/**
* @ORM\Column(name="facebook_id", type="string", length=255, nullable=true)
*/
private $facebookId;
private $facebookAccessToken;
private $facebookAccessToken;
/**
* @ORM\Column(name="google_id", type="string", length=255, nullable=true)
*/
private $googleId;
private $googleAccessToken;
private $googleAccessToken;
/**
* @ORM\Column(name="amazon_id", type="string", length=255, nullable=true)
*/
private $amazonId;
private $amazonAccessToken;
private $amazonAccessToken;
/**
* @ORM\Column(name="instagram_id", type="string", length=255, nullable=true)
*/
private $instagramId;
private $instagramAccessToken;
private $instagramAccessToken;
/**
* @ORM\Column(name="twitter_id", type="string", length=255, nullable=true)
*/
private $twitterId;
private $twitterAccessToken;
private $twitterAccessToken;
/**
* @ORM\Column(name="yahoo_id", type="string", length=255, nullable=true)
*/
private $yahooId;
private $yahooAccessToken;
public function __construct()
{
if (null === $this->created) {
$this->created = new \DateTime('now');
}
$this->updated = new \DateTime('now');
parent::__construct();
private $yahooAccessToken;
/**
* User constructor.
*/
public function __construct() {
if (NULL === $this->created) {
$this->created = new \DateTime('now');
}
$this->updated = new \DateTime('now');
parent::__construct();
}
public function getComment() : ?string {
return $this->comment;
}
public function setComment(?string $comment) : User {
$this->comment = $comment;
return $this;
}
/**
* @return mixed
*/
public function getAmazonId()
{
return $this->amazonId;
public function getAmazonId() : ?string {
return $this->amazonId;
}
/**
* @param mixed $amazonId
* @param string $amazonId
*
* @return User
*/
public function setAmazonId($amazonId)
{
$this->amazonId = $amazonId;
public function setAmazonId(?string $amazonId) : User {
$this->amazonId = $amazonId;
return $this;
return $this;
}
/**
* @return mixed
* @return string
*/
public function getAmazonAccessToken()
{
return $this->amazonAccessToken;
public function getAmazonAccessToken() : ?string {
return $this->amazonAccessToken;
}
/**
* @param mixed $amazonAccessToken
* @param string $amazonAccessToken
*
* @return User
*/
public function setAmazonAccessToken($amazonAccessToken)
{
$this->amazonAccessToken = $amazonAccessToken;
public function setAmazonAccessToken(?string $amazonAccessToken) : User {
$this->amazonAccessToken = $amazonAccessToken;
return $this;
return $this;
}
/**
* @return mixed
* @return string
*/
public function getFacebookId()
{
return $this->facebookId;
public function getFacebookId() : ?string {
return $this->facebookId;
}
/**
@ -179,411 +194,310 @@ class User extends \FOS\UserBundle\Model\User
*
* @return User
*/
public function setFacebookId($facebookId)
{
$this->facebookId = $facebookId;
public function setFacebookId(string $facebookId) : User {
$this->facebookId = $facebookId;
return $this;
return $this;
}
/**
* @return string
*/
public function getFacebookAccessToken() : ?string {
return $this->facebookAccessToken;
}
/**
* @param string $facebookAccessToken
*
* @return User
*/
public function setFacebookAccessToken(?string $facebookAccessToken) : User {
$this->facebookAccessToken = $facebookAccessToken;
return $this;
}
/**
* @return string
*/
public function getGoogleId() : ?string {
return $this->googleId;
}
/**
* @param string $googleId
*
* @return User
*/
public function setGoogleId(?string $googleId) : User {
$this->googleId = $googleId;
return $this;
}
/**
* @return string
*/
public function getGoogleAccessToken() : ?string {
return $this->googleAccessToken;
}
/**
* @param string $googleAccessToken
*
* @return User
*/
public function setGoogleAccessToken(?string $googleAccessToken) : User {
$this->googleAccessToken = $googleAccessToken;
return $this;
}
/**
* @return string
*/
public function getInstagramId() : ?string{
return $this->instagramId;
}
/**
* @param string $instagramId
*
* @return User
*/
public function setInstagramId(?string $instagramId) : User {
$this->instagramId = $instagramId;
return $this;
}
/**
* @return mixed
*/
public function getFacebookAccessToken()
{
return $this->facebookAccessToken;
public function getInstagramAccessToken() : ?string {
return $this->instagramAccessToken;
}
/**
* @param mixed $facebookAccessToken
* @param string $instagramAccessToken
*
* @return User
*/
public function setFacebookAccessToken($facebookAccessToken)
{
$this->facebookAccessToken = $facebookAccessToken;
public function setInstagramAccessToken(?string $instagramAccessToken) : User {
$this->instagramAccessToken = $instagramAccessToken;
return $this;
return $this;
}
/**
* @return string
*/
public function getTwitterId() : ?string {
return $this->twitterId;
}
/**
* @param string $twitterId
*
* @return User
*/
public function setTwitterId(?string $twitterId) : User {
$this->twitterId = $twitterId;
return $this;
}
/**
* @return mixed
*/
public function getGoogleId()
{
return $this->googleId;
public function getTwitterAccessToken() {
return $this->twitterAccessToken;
}
/**
* @param mixed $googleId
* @param string $twitterAccessToken
*
* @return User
*/
public function setGoogleId($googleId)
{
$this->googleId = $googleId;
public function setTwitterAccessToken(?string $twitterAccessToken) : User {
$this->twitterAccessToken = $twitterAccessToken;
return $this;
return $this;
}
/**
* @return mixed
* @return string
*/
public function getGoogleAccessToken()
{
return $this->googleAccessToken;
public function getYahooId() : ?string {
return $this->yahooId;
}
/**
* @param mixed $googleAccessToken
* @param string $yahooId
*
* @return User
*/
public function setGoogleAccessToken($googleAccessToken)
{
$this->googleAccessToken = $googleAccessToken;
public function setYahooId(?string $yahooId) : User {
$this->yahooId = $yahooId;
return $this;
return $this;
}
/**
* @return mixed
* @return string
*/
public function getInstagramId()
{
return $this->instagramId;
public function getYahooAccessToken() : ?string {
return $this->yahooAccessToken;
}
/**
* @param mixed $instagramId
* @param string $yahooAccessToken
*
* @return User
*/
public function setInstagramId($instagramId)
{
$this->instagramId = $instagramId;
public function setYahooAccessToken(?string $yahooAccessToken): User {
$this->yahooAccessToken = $yahooAccessToken;
return $this;
return $this;
}
/**
* @return mixed
* Get Name.
*
* @return string
*/
public function getInstagramAccessToken()
{
return $this->instagramAccessToken;
public function getName(): ?string {
return $this->name;
}
/**
* @param mixed $instagramAccessToken
* Set Name.
*
* @param string $name
*
* @return User
*/
public function setInstagramAccessToken($instagramAccessToken)
{
$this->instagramAccessToken = $instagramAccessToken;
public function setName(string $name): User {
$this->name = $name;
return $this;
return $this;
}
/**
* @return mixed
*/
public function getTwitterId()
{
return $this->twitterId;
}
/**
* @param mixed $twitterId
/**
* @param string $plainPassword
*
* @return User
*/
public function setTwitterId($twitterId)
{
$this->twitterId = $twitterId;
public function setPlainPassword($plainPassword): User {
$this->plainPassword = $plainPassword;
return $this;
return $this;
}
/**
* @return mixed
* Get created.
*
* @return \DateTime
*/
public function getTwitterAccessToken()
{
return $this->twitterAccessToken;
public function getCreated(): ?\DateTime {
return $this->created;
}
/**
* @param mixed $twitterAccessToken
* Set created.
*
* @param \DateTime $created
*
* @return User
*/
public function setTwitterAccessToken($twitterAccessToken)
{
$this->twitterAccessToken = $twitterAccessToken;
public function setCreated(?\DateTime $created): User {
$this->created = $created;
return $this;
return $this;
}
/**
* @return mixed
* Get updated.
*
* @return \DateTime
*/
public function getYahooId()
{
return $this->yahooId;
public function getUpdated(): ?\DateTime {
return $this->updated;
}
/**
* @param mixed $yahooId
* Set updated.
*
* @param \DateTime $updated
*
* @return User
*/
public function setYahooId($yahooId)
{
$this->yahooId = $yahooId;
public function setUpdated(?\DateTime $updated): User {
$this->updated = $updated;
return $this;
return $this;
}
/**
* @return mixed
* Get rsvp.
*
* @return Rsvp
*/
public function getYahooAccessToken()
{
return $this->yahooAccessToken;
public function getRsvp(): ?Rsvp {
return $this->rsvp;
}
/**
* @param mixed $yahooAccessToken
* Set rsvp.
*
* @param Rsvp $rsvp
*
* @return User
*/
public function setYahooAccessToken($yahooAccessToken)
{
$this->yahooAccessToken = $yahooAccessToken;
public function setRsvp(Rsvp $rsvp = NULL) : User {
$this->rsvp = $rsvp;
return $this;
return $this;
}
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Add image
*
* @param \Sikofitt\DoughnutWeddingBundle\Entity\Image $image
*
* @return User
*/
public function addImage(Image $image): User {
$image->setUser($this);
/**
* Set Name.
*
* @param string $name
*
* @return User
*/
public function setName($name)
{
$this->name = $name;
$this->images[] = $image;
return $this;
}
return $this;
}
/**
* Get Name.
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Remove image
*
* @param \Sikofitt\DoughnutWeddingBundle\Entity\Image $image
*
* @return Void
*/
public function removeImage(Image $image): void {
$image->setUser(NULL);
/**
* @return string
*/
public function getUsername()
{
return $this->username;
}
$this->images->removeElement($image);
}
/**
* Get images
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getImages() {
/**
* Set email.
*
* @param string $email
*
* @return User
*/
public function setEmail($email)
{
$this->email = $email;
return $this;
}
/**
* Get email.
*
* @return string
*/
public function getEmail()
{
return $this->email;
}
/**
* @param string $password
*
* @return $this
*/
public function setPassword($password)
{
$this->password = $password;
return $this;
}
/**
* @return string
*/
public function getPassword()
{
return $this->password;
}
/**
* @return string
*/
public function getPlainPassword()
{
return $this->plainPassword;
}
/**
* @param string $plainPassword
*
* @return User
*/
public function setPlainPassword($plainPassword): User
{
$this->plainPassword = $plainPassword;
return $this;
}
/**
* @param string $userToken
*
* @return $this
*/
public function setUserToken($userToken)
{
$this->userToken = $userToken;
return $this;
}
/**
* @return string
*/
public function getUserToken()
{
return $this->userToken;
}
/**
* @param string $resetToken
*
* @return $this
*/
public function setResetToken($resetToken)
{
$this->resetToken = $resetToken;
return $this;
}
/**
* @return string
*/
public function getResetToken()
{
return $this->resetToken;
}
/**
* Set created.
*
* @param \DateTime $created
*
* @return User
*/
public function setCreated($created)
{
$this->created = $created;
return $this;
}
/**
* Get created.
*
* @return \DateTime
*/
public function getCreated()
{
return $this->created;
}
/**
* Set updated.
*
* @param \DateTime $updated
*
* @return User
*/
public function setUpdated($updated)
{
$this->updated = $updated;
return $this;
}
/**
* Get updated.
*
* @return \DateTime
*/
public function getUpdated()
{
return $this->updated;
}
/**
* Set rsvp.
*
* @param Rsvp $rsvp
*
* @return User
*/
public function setRsvp(Rsvp $rsvp = null)
{
$this->rsvp = $rsvp;
return $this;
}
/**
* Get rsvp.
*
* @return Rsvp
*/
public function getRsvp()
{
return $this->rsvp;
}
return $this->images;
}
}

View File

@ -105,9 +105,10 @@ class UserRedirectOnLoggedInListener
private function getRedirectRoutes(): array
{
return [
//'fos_user_security_login',
// 'fos_user_registration_confirmed',
//'hwi_oauth_connect'
'fos_user_security_login',
'fos_user_registration_confirmed',
'hwi_oauth_connect',
'fos_user_resetting_request'
];
}
}

View File

@ -0,0 +1,24 @@
<?php
/**
* Created by PhpStorm.
* User: eric
* Date: 4/24/17
* Time: 6:38 PM
*/
namespace Sikofitt\DoughnutWeddingBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
class ChangePasswordFormType extends AbstractType {
public function buildForm(FormBuilderInterface $builder, array $options) {
$builder->remove('current_password');
}
public function getParent() {
return \FOS\UserBundle\Form\Type\ChangePasswordFormType::class;
}
}

View File

@ -0,0 +1,31 @@
<?php
/**
* Created by PhpStorm.
* User: eric
* Date: 4/24/17
* Time: 6:56 PM
*/
namespace Sikofitt\DoughnutWeddingBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Vich\UploaderBundle\Form\Type\VichImageType;
class GalleryUploadType extends AbstractType {
public function buildForm(FormBuilderInterface $builder, array $options) {
$builder->add('imageFile', VichImageType::class, [
'label_attr' => [
'class' => 'uk-form-label'
],
'attr' => [
'class' => ''
]
])
->add('description')
->add('tags')
->add('category');
}
}

View File

@ -9,7 +9,9 @@
namespace Sikofitt\DoughnutWeddingBundle\Form;
use Symfony\Component\Form\FormEvent;
use FOS\UserBundle\Form\Type\ProfileFormType;
use FOS\UserBundle\Model\UserManager;
use HWI\Bundle\OAuthBundle\OAuth\Response\PathUserResponse;
use Sikofitt\DoughnutWeddingBundle\Entity\Rsvp;
use Symfony\Component\Form\AbstractType;
@ -18,17 +20,22 @@ use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\OptionsResolver;
class ProfileEditType extends AbstractType
{
private $userManager;
public function __construct(UserManager $userManager) {
$this->userManager = $userManager;
}
public function buildForm(FormBuilderInterface $builder, array $options)
public function buildForm(FormBuilderInterface $builder, array $options)
{
$emailOptions = $builder->get('email')->getOptions();
$builder->remove('current_password');
//$builder->remove('username');
$builder->remove('username');
$builder->remove('email');
$emailOptions['attr'] = [
'class' => 'uk-input uk-form-large uk-padding-small uk-box-shadow-hover-small',
@ -59,6 +66,12 @@ class ProfileEditType extends AbstractType
],
]);
$builder->addEventListener(FormEvents::SUBMIT, function(FormEvent $event) {
$user = $event->getData();
$user->setUsername($user->getEmail());
$this->userManager->updateCanonicalFields($user);
});
$builder->get('rsvp')
->addModelTransformer(new CallbackTransformer(
function (?Rsvp $rsvp) {

View File

@ -21,6 +21,7 @@
namespace Sikofitt\DoughnutWeddingBundle\Form;
use HWI\Bundle\OAuthBundle\OAuth\Response\PathUserResponse;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\FormEvent;
use FOS\UserBundle\Form\Type\RegistrationFormType;
use FOS\UserBundle\Model\UserManager;
@ -40,11 +41,11 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class RegistrationType extends AbstractType
{
private $userManger;
private $userManager;
public function __construct(UserManager $userManager)
{
$this->userManger = $userManager;
$this->userManager = $userManager;
}
public function buildForm(FormBuilderInterface $builder, array $options)
@ -59,13 +60,25 @@ class RegistrationType extends AbstractType
'label_attr' => [
'class' => 'uk-form-label uk-text-primary',
],
])->remove('username');
])
->add('comment', TextareaType::class, [
'required' => false,
'label' => 'Anything you would like to share with the Bride and Groom?',
'label_attr' => [
'class' => 'uk-form-label uk-visible@m',
],
'attr' => [
'class' => 'uk-textarea uk-form-large',
'placeholder' => 'Anything you would like to share with the Bride and Groom?'
]
])
->remove('username');
$builder->addEventListener(FormEvents::SUBMIT, function(FormEvent $event) {
$user = $event->getData();
$user->setUsername($user->getEmail());
$this->userManger->updateCanonicalFields($user);
$this->userManager->updateCanonicalFields($user);
});
$builder->get('rsvp')

View File

@ -18,10 +18,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Sikofitt\App\Form;
namespace Sikofitt\DoughnutWeddingBundle\Form;
use Sikofitt\App\Entity\Rsvp;
use Sikofitt\App\Entity\User;
use Sikofitt\DoughnutWeddingBundle\Entity\Rsvp;
use Sikofitt\DoughnutWeddingBundle\Entity\User;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\CallbackTransformer;
use Symfony\Component\Form\Extension\Core\Type\{

View File

@ -3,5 +3,16 @@
{% block title %}SikofittDoughnutWeddingBundle:Image:upload{% endblock %}
{% block body %}
<h1>Welcome to the Image:upload page</h1>
{{ form_start(form, {'attr': { 'class': 'uk-form uk-form-horizontal'}}) }}
{{ form_label(form.imageFile, null, {'label_attr':{'class':'uk-hidden'}}) }}
<div class="uk-form-controls uk-form-controls-text">
{{ form_widget(form.imageFile) }}
</div>
<button class="uk-button uk-button-default">Submit</button>
{{ form_rest(form) }}
{{ form_end(form) }}
{% endblock %}