Skip to content

Instantly share code, notes, and snippets.

View saksmt's full-sized avatar

Kirill Saksin saksmt

View GitHub Profile
@saksmt
saksmt / TagsTransformer.php
Created August 21, 2014 12:18
DataTransformer
<?php
namespace ForaSoft\ImproveClassBundle\Form\Transformer;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Persistence\ObjectManager;
use ForaSoft\ImproveClassBundle\Entity\Tag;
use Symfony\Component\Form\DataTransformerInterface;
class TagsTransformer implements DataTransformerInterface
@saksmt
saksmt / SHITCODE.php
Last active August 29, 2015 14:04
Ubershitcode
foreach($users as $key => $user) // <--- $user is used only (1), $key is used only for indexing in array
{
$id = $user['id']; // <--- (1)here
if($id == $currentUserId)
unset($users[$key]);
if($tags != null) // not strict comparison with null, (2)
{
$tmpTags = $tagsRepo->createQueryAllByUserId($id)->getResult(); // <--- WAT?!