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
// Je récupère mon champ image | |
foreach ($tricks as $form->getData()->getImage()){ | |
// Je récupère mon champ url | |
foreach ($form as $champ->getUrl()){ | |
//Je renomme mon champ url | |
$rename = $fileUploader->upload($champ); | |
} |
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
//Je récupère le token de l utilisateur qui s' inscrit | |
$str = $this->get('security.token_storage')->getToken(); | |
//Je génère une url en passant le token (donc la ca ne marche pas)... | |
//Mon url donné est : "/public/index.php/activate" au lieu de "/public/index.php/activate?token=..." | |
$token = $this->generateUrl('activate', array('token' => $str)); |
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
public function activateAction(Request $request) | |
{ | |
//$params = array(); | |
$token = $request->get('token'); | |
$user = $this->getDoctrine() | |
->getManager() |
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
public function activateAction(Request $request) | |
{ | |
$params = array(); | |
$token = $request->get('token'); | |
$test = $this->getDoctrine() | |
->getManager() |
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
public function activateAction(Request $request) | |
{ | |
$params = array(); | |
$token = $request->get('token'); | |
$test = $this->getDoctrine() | |
->getManager() |
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
class TricksType extends AbstractType | |
{ | |
private $entitymanager; | |
public function __construct(EntityManagerInterface $entityManager) | |
{ | |
$this->entitymanager = $entityManager; | |
} | |
public function buildForm(FormBuilderInterface $builder, array $options) |
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
// Mon tricksType | |
class TricksType extends AbstractType | |
{ | |
private $entitymanager; | |
public function __construct(EntityManagerInterface $entityManager) | |
{ | |
$this->entitymanager = $entityManager; | |
} |
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
// Mon entité Image | |
class Image | |
{ | |
/** | |
* @var int | |
*/ | |
private $id; | |
/** |
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
private function uploadFile($entity) | |
{ | |
// upload only works for Product entities | |
if (!$entity instanceof Tricks) { | |
return; | |
} | |
$file = $entity->getImage()->getValues(); | |
foreach ($file as $item) |
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
// Listener | |
class ImageUploadListener | |
{ | |
private $uploader; | |
public function __construct(FileUploader $uploader) | |
{ | |
$this->uploader = $uploader; | |
} |