Skip to content

Instantly share code, notes, and snippets.

View ahonymous's full-sized avatar
💭
I may be slow to respond.

Oleksandr Moshta ahonymous

💭
I may be slow to respond.
  • Ukraine, Cherkasy
View GitHub Profile
<?php
namespace <Organization>\AppBundle\Tests;
use Symfony\Component\Form\Extension\Core\CoreExtension;
use Symfony\Component\Form\Extension\Validator\Type\FormTypeValidatorExtension;
use Symfony\Component\Form\Forms;
use Symfony\Component\Form\Test\TypeTestCase;
use Symfony\Component\Validator\ConstraintViolationList;
<?php
namespace <dsaaffa>;
use Symfony\Bundle\FrameworkBundle\Client;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\ConsoleOutput;

11.11.2014 Symfony overview, Controller, Routing, Twig

  • Install Symfony standart edition
  • Symfony Bundles
  • Symfony Components
  • Create Bundle, route and controller
  • Add twig view

18.11.2014 Databases and Doctrine

public function addCommentAction(Request $request)
{
$comment = new Comment();
$form = $this->createForm(new CommentFormType(),$comment);
if ($request->isMethod('POST')) {
$form->handleRequest($request);
if ($form->isValid()) {
@ahonymous
ahonymous / 000-default.conf
Last active October 19, 2016 16:18
Example of config APACHE2 with virtual hosts
<VirtualHost *:80>
#ServerName www.example.com
ServerAdmin ahonymous@gmail.com
DocumentRoot /home/alex/extra/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /home/alex/extra/www/html>
<?php
require_once 'vendor/autoload.php';
use Filipac\Ip;
PHP_Timer::start();
$ip = Ip::get();
echo "Hello, your ip is: {$ip} </br> ";
{
"name": "ahonymous/hw4",
"description": "Geekhub AdvancedPHP 2015 HW#4",
"license": "MIT",
"authors": [
{
"name": "Alex Moshta",
"email": "ahonymous@gmail.com"
}
],
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Article
*
* @ORM\Table(name="article")
<?php
class ImageHelper
{
public function cropImage($content, $width, $height)
{
$image = new \Imagick();
$image->readImageBlob($content);
$image->setImageFormat('jpeg');
@ahonymous
ahonymous / ApiOrderTypeTest.php
Last active January 14, 2016 11:01
Tests for form with entity type
<?php
namespace AppBundle\Tests\Form;
use AppBundle\Entity\EOrder;
use AppBundle\Entity\User;
use AppBundle\Form\ApiOrderType;
use AppBundle\Tests\AppTypeTestCase;
class ApiOrderTypeTest extends AppTypeTestCase