This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Khepin\UserValidatorBundle\Aop; | |
use JMS\AopBundle\Aop\PointcutInterface; | |
use Doctrine\Common\Annotations\Reader; | |
/** | |
* Pointcut for all calls to a method that requires validating the user | |
*/ | |
class Pointcut implements PointcutInterface |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Khepin\UserValidatorBundle\Annotation; | |
/** | |
* @Annotation | |
* Annotation to validate a user or redirect him to his profile edit page if | |
* the profile is not valid according to the given validation groups | |
*/ | |
final class ValidateUser |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class SomeController | |
{ | |
/** | |
* @ValidateUser("ticket_checkout", route="profile_edit") | |
*/ | |
public function checkoutAction(){ | |
// proceed to checkout | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class SomeController | |
{ | |
public function checkoutAction(){ | |
$user = $this->get('security.context')->getToken()->getUser(); | |
$errors = $this->get('validator')->validate($user, 'ticket_checkout'); | |
if(count($errors) > 0) { | |
// Add a warning message to the session | |
// Redirect user to a profile edit page where he can setup the missing info |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Doctrine\DBAL\Types\Type; | |
Type::addType('geotype', 'Powwow\NewdbBundle\Types\GeoType'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//.... | |
/** | |
* @var string $location | |
* | |
* @ORM\Column(name="location", type="geotype") | |
*/ | |
private $location; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Powwow\NewdbBundle\Types; | |
use Doctrine\DBAL\Types\Type; | |
use Doctrine\DBAL\Platforms\AbstractPlatform; | |
/** | |
* My custom datatype. | |
*/ | |
class GeoType extends Type |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="hero-unit"> | |
<section class="container-top-left"> | |
<h2>Life is about FUN!</h2> | |
<h3 class="slogan">Get active. Get social. Get organized.</h3> | |
<p class="intro"><small>With mashup sports you will find "mashups" where everyone gets | |
active and social. Get started by searching for a mashup or organizing your own mashup.</small></p> | |
<span class="row"><!-- this should probably be a DIV instead of a span --> | |
<span class="organize-btn"><!-- see what the css for this could look like to have a bigger button --> | |
<a class="btn btn-primary btn-large" id="organize">Organize a mashup</a> | |
</span> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Khepin; | |
use Symfony\Component\Security\Acl\Model\ObjectIdentityRetrievalStrategyInterface; | |
use Symfony\Component\Security\Acl\Domain\ObjectIdentity; | |
class DoctrineProxyIdRetrievalStrategy implements ObjectIdentityRetrievalStrategyInterface { | |
const PROXY_CLASS_NAME = 'Doctrine\ORM\Proxy\Proxy'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#config.yml | |
services: | |
security.acl.object_identity_retrieval_strategy: | |
class: Khepin\DoctrineProxyIdRetrievalStrategy |