<commit_before><?php

namespace Kdig\OrientBundle\Listener;

use Doctrine\ORM\Event\LifecycleEventArgs;
use Kdig\OrientBundle\Entity\Object as Object;

use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

class ObjectListener 
{
    private $container;
 
    public function __construct(ContainerInterface $container)
    {
        $this->container = $container;
    }
 
    public function postUpdate(LifecycleEventArgs $args) {
        $entity = $args->getEntity();
        $entityManager = $args->getEntityManager();
        $aclProvider = $this->container->get('problematic.acl_manager');
        
        if ($entity instanceof Object) {
            //add ACL information
            if ($user = $person->getUser()) {
                $aclProvider->addObjectPermission($entity, MaskBuilder::MASK_OWNER, $user);
            }
        }
    }
    
    public function postPersist(LifecycleEventArgs $args) {
//        $entity = $args->getEntity();
//        $entityManager = $args->getEntityManager();
//        if ($entity instanceof Pottery) {
//            $tcode = $entity->getClass()->getNumber()
//                    .$entity->getShape()->getNumber()
//                    .'-'
//                    .$entity->getRim()->getNumber()
//                    .$entity->getNeck()->getNumber()
//                    .$entity->getWall()->getNumber()
//                    .$entity->getUpperwall()->getNumber()
//                    .$entity->getLowerwall()->getNumber()
//                    .$entity->getBase()->getNumber()
//                    .$entity->getHandle()->getNumber()
//                    .$entity->getHandleposition()->getNumber()
//                    .$entity->getSpout()->getNumber()
//                    .$entity->getSpoutposition()->getNumber()
//                    .'-'
//                    .$entity->getInclusion()->getNumber()
//                    .$entity->getInclusionsize()->getNumber()
//                    .$entity->getInclusionfrequency()->getNumber();
//            $entity->setTcode($tcode);
//            $entityManager->persist($entity);
//            $entityManager->flush();
//        }
    }<commit_msg>updated objectListener<commit_after><?php

namespace Kdig\OrientBundle\Listener;

use Doctrine\ORM\Event\LifecycleEventArgs;
use Kdig\OrientBundle\Entity\Object as Object;

use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

class ObjectListener 
{
    private $container;
 
    public function __construct(ContainerInterface $container)
    {
        $this->container = $container;
    }
 
    public function postUpdate(LifecycleEventArgs $args) {
        $entity = $args->getEntity();
        $entityManager = $args->getEntityManager();
        $aclProvider = $this->container->get('problematic.acl_manager');
        
        if ($entity instanceof Object) {
            //add ACL information
            $user = $this->container->get('security.context')->getToken()->getUser();
            if ($user) {
                $aclProvider->addObjectPermission($entity, MaskBuilder::MASK_OWNER, $user);
            }
        }
    }
    
    public function postPersist(LifecycleEventArgs $args) {
//        $entity = $args->getEntity();
//        $entityManager = $args->getEntityManager();
//        if ($entity instanceof Pottery) {
//            $tcode = $entity->getClass()->getNumber()
//                    .$entity->getShape()->getNumber()
//                    .'-'
//                    .$entity->getRim()->getNumber()
//                    .$entity->getNeck()->getNumber()
//                    .$entity->getWall()->getNumber()
//                    .$entity->getUpperwall()->getNumber()
//                    .$entity->getLowerwall()->getNumber()
//                    .$entity->getBase()->getNumber()
//                    .$entity->getHandle()->getNumber()
//                    .$entity->getHandleposition()->getNumber()
//                    .$entity->getSpout()->getNumber()
//                    .$entity->getSpoutposition()->getNumber()
//                    .'-'
//                    .$entity->getInclusion()->getNumber()
//                    .$entity->getInclusionsize()->getNumber()
//                    .$entity->getInclusionfrequency()->getNumber();
//            $entity->setTcode($tcode);
//            $entityManager->persist($entity);
//            $entityManager->flush();
//        }
    }
{'fraction_non_alphanumeric': 0.15904186447993093, 'fraction_numerical': 0.0, 'mean_word_length': 1.9169288860918816, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 90, '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': '972499', 'n_tokens_mistral': 1221, 'n_tokens_neox': 1141, 'n_words': 160}