This file contains 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
// if form is mapped => false; | |
$img = $form->get('img')->getData(); | |
//if form is mapped => true | |
$img = $user->getImg(); | |
if ($img !== NULL) { | |
// Generate a unique name for the file before saving it | |
$fileName = md5(uniqid()) . '.' . $img->getExtension(); |
This file contains 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
//Get password for mapped => false | |
$pass = $this->getForm()->get('password')->getData(); | |
//Get password for mapped => true | |
$pass = $this->getForm()->get('password')->getData(); | |
$pass = $this->getForm()->get('password')->getData(); | |
if ($pass !== null) { | |
$object->setPlainPassword($pass); | |
} |
This file contains 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
<VirtualHost *:80> | |
ServerName giftshere | |
DocumentRoot /home/maximstrutinskiy/Sites/giftshere/web | |
<Directory /home/maximstrutinskiy/Sites/giftshere/web> | |
AllowOverride None | |
Require all granted | |
Allow from All | |
</Directory> | |
ErrorLog /home/maximstrutinskiy/Sites/giftshere-log/error.log | |
CustomLog /home/maximstrutinskiy/Sites/giftshere-log/access.log combined |
This file contains 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 MainBundle\Validator\Constraints; | |
use Symfony\Component\Validator\Constraint; | |
/** @Annotation */ | |
class CustomLength extends Constraint | |
{ | |
// Define all annotation parameters; |
This file contains 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
$this->denyAccessUnlessGranted('edit_comment', $comment); |
This file contains 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
$app->register(new Silex\Provider\SecurityServiceProvider(), | |
[ | |
$app['security.firewalls'] = [ | |
'secured' => [ | |
'pattern' => '^/', | |
'anonymous' => true, | |
'form' => [ | |
'login_path' => '/login', | |
'check_path' => '/admin/login_check', | |
], |
This file contains 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 createNewContributionAction(Request $request, int $userReviewId, int $review_id) | |
{ | |
$user = $this->getApp()['user']; | |
$userReview = $this->getRepository(UserReview::class)->findBy(['id' => $userReviewId]); | |
$userReview = $userReview[0]; | |
$form = $this->getFormFactory()->createBuilder(CreateContributionType::class)->getForm(); | |
$form->handleRequest($request); | |
if ($form->isSubmitted()) { | |
if (isset($_POST['save'])) { | |
$data = $form->getData(); |
This file contains 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 indexAction(Request $request) | |
{ | |
$em = $this->getDoctrine()->getManager(); | |
$shipment = new Shipment(); | |
$form = $this->createFormBuilder($shipment) | |
->add('name', TextType::class) | |
->getForm(); | |
$form->handleRequest($request); | |
if ($form->isSubmitted() && $form->isValid()) { |
This file contains 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 App\Command; | |
use App\Entity\User; | |
use Knp\Command\Command; | |
use Symfony\Component\Console\Input\InputArgument; | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Output\OutputInterface; |
This file contains 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 DesignPatterns\Structural\DependencyInjection; | |
class DatabaseConfiguration | |
{ | |
/** | |
* @var string | |
*/ | |
private $host; |
OlderNewer