<commit_before><?php
namespace Chatter;

use Chatter\Form\UserAddForm;
use Chatter\Form\UserEditForm;
use Chatter\Form\UserFieldset;
use Chatter\Repository\UserRepository;
use Chatter\Service\UserService;
use Doctrine\ORM\EntityManager;
use DoctrineModule\Stdlib\Hydrator\DoctrineObject;
use Zend\InputFilter\InputFilter;
use Zend\ModuleManager\Feature\FormElementProviderInterface;
use Zend\ServiceManager\AbstractPluginManager;

class Module implements FormElementProviderInterface
{
    public function getAutoloaderConfig()
    {
        return array(
            'Zend\Loader\ClassMapAutoloader' => array(
                __DIR__ . '/autoload_classmap.php',
            ),
            'Zend\Loader\StandardAutoloader' => array(
                'namespaces' => array(
                    __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
                ),
            ),
        );
    }

    public function getConfig()
    {
        return include __DIR__ . '/config/module.config.php';
    }

    public function getServiceConfig() {
        return array(
            'factories' => array(
                'userService' => function ($sl) {
                    /** @var EntityManager $entityManager */
                    $entityManager = $sl->get('doctrine.entitymanager.orm_default');
                    $userService = new UserService();
                    $userService->setEntityManager($entityManager);

                    $userRepository = $entityManager->getRepository('Chatter\Entity\User');
                    $userService->setRepository($userRepository);
                    return $userService;
                },
            ),
        );
    }

    public function getFormElementConfig()
    {
        return array(
            'factories' => array(
                'userAddForm' => function(AbstractPluginManager $sm) {
                    $locator = $sm->getServiceLocator();
                    /** @var EntityManager $entityManager */
                    $entityManager = $locator->get('doctrine.entitymanager.orm_default');

                    $userAddForm = new UserAddForm();
                    $userAddForm->setHydrator(new DoctrineObject($entityManager));
                    $userAddForm->setInputFilter(new InputFilter());
<commit_msg>Created a user repository factory service<commit_after><?php
namespace Chatter;

use Chatter\Form\UserAddForm;
use Chatter\Form\UserEditForm;
use Chatter\Form\UserFieldset;
use Chatter\Repository;
use Chatter\Service\UserService;
use Doctrine\ORM\EntityManager;
use DoctrineModule\Stdlib\Hydrator\DoctrineObject;
use Zend\InputFilter\InputFilter;
use Zend\ModuleManager\Feature\FormElementProviderInterface;
use Zend\ServiceManager\AbstractPluginManager;

class Module implements FormElementProviderInterface
{
    public function getAutoloaderConfig()
    {
        return array(
            'Zend\Loader\ClassMapAutoloader' => array(
                __DIR__ . '/autoload_classmap.php',
            ),
            'Zend\Loader\StandardAutoloader' => array(
                'namespaces' => array(
                    __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
                ),
            ),
        );
    }

    public function getConfig()
    {
        return include __DIR__ . '/config/module.config.php';
    }

    public function getServiceConfig() {
        return array(
            'factories' => array(
                'userRepository' => function ($sm) {
                    /** @var EntityManager $entityManager */
                    $entityManager = $sm->get('doctrine.entitymanager.orm_default');
                    $userRepository = $entityManager->getRepository('Chatter\Entity\User');
                    return $userRepository;
                },
                'userService' => function ($sm) {
                    $userService = new Service\UserService();
                    $userService->setRepository($sm->get('userRepository'));
                    return $userService;
                },
            ),
        );
    }

    public function getFormElementConfig()
    {
        return array(
            'factories' => array(
                'userAddForm' => function(AbstractPluginManager $sm) {
                    $locator = $sm->getServiceLocator();
                    /** @var EntityManager $entityManager */
                    $entityManager = $locator->get('doctrine.entitymanager.orm_default');

                    $userAddForm = new UserAddForm();
                    $userAddForm->setHydrator(new DoctrineObject($entityManager));
                    $userAddForm->setInputFilter(new InputFilter());

{'fraction_non_alphanumeric': 0.10616216216216216, 'fraction_numerical': 0.0, 'mean_word_length': 2.0, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 36, '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': '7216467', 'n_tokens_mistral': 1201, 'n_tokens_neox': 1149, 'n_words': 207}