<commit_before><?php

namespace Crm\OperatorBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Security\Core\SecurityContext;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Crm\MainBundle\Entity\CompanyPayment;
use Crm\MainBundle\Entity\Company;
use Crm\MainBundle\Entity\CompanyPetition;
use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder;

/**
 * @Security("has_role('ROLE_MODERATOR')")
 * @Route("/operator/payment")
 */
class PaymentController extends Controller
{
    /**
     * @Route("/list/{operatorId}", name="operator_payment_list", defaults={"operatorId" = null })
     * @Template()
     */
    public function listAction($operatorId = null){
        if ($operatorId){
            $operator = $this->getDoctrine()->getRepository('CrmMainBundle:Operator')->findOneById($operatorId);
            $payments = $this->getDoctrine()->getRepository('CrmMainBundle:CompanyPayment')->findByOperator($operator);
        }else{
            if ( !$this->get('security.context')->isGranted('ROLE_ADMIN') ){
                $payments = $this->getDoctrine()->getRepository('CrmMainBundle:CompanyPayment')->findAll();
            }else{
                $moderator = $this->getUser();
                $payments = $this->getDoctrine()->getRepository('CrmMainBundle:CompanyPayment')->findByModerator($moderator);
            }
            $operator = null;
        }
        return array('payments' => $payments, 'operator' => $operator );
    }

    /**<commit_msg>update company<commit_after><?php

namespace Crm\OperatorBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Security\Core\SecurityContext;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Crm\MainBundle\Entity\CompanyPayment;
use Crm\MainBundle\Entity\Company;
use Crm\MainBundle\Entity\CompanyPetition;
use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder;

/**
 * @Security("has_role('ROLE_MODERATOR')")
 * @Route("/operator/payment")
 */
class PaymentController extends Controller
{
    /**
     * @Route("/list/{operatorId}", name="operator_payment_list", defaults={"operatorId" = null })
     * @Template()
     */
    public function listAction($operatorId = null){
        if ($operatorId){
            $operator = $this->getDoctrine()->getRepository('CrmMainBundle:Operator')->findOneById($operatorId);
            $payments = $this->getDoctrine()->getRepository('CrmMainBundle:CompanyPayment')->findByOperator($operator);
        }else{
            if ( !$this->get('security.context')->isGranted('ROLE_ADMIN') ){
                $payments = $this->getDoctrine()->getRepository('CrmMainBundle:CompanyPayment')->findAll();
            }else{
                $moderator = $this->getUser();
                $payments = $this->getDoctrine()->getRepository('CrmMainBundle:CompanyPayment')->findByOperator($moderator);
            }
            $operator = null;
        }
        return array('payments' => $payments, 'operator' => $operator );
    }

    /**
{'fraction_non_alphanumeric': 0.13924050632911392, 'fraction_numerical': 0.0, 'mean_word_length': 4.282729805013927, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1213693', 'n_tokens_mistral': 1042, 'n_tokens_neox': 1031, 'n_words': 135}