<commit_before><?php

namespace Admin\Form\Contract;

use \Litus\Form\Admin\Decorator\ButtonDecorator;
use \Litus\Form\Admin\Decorator\FieldDecorator;
use \Litus\Entity\Br\Contract;

use \Zend\Form\Element\Submit;
use \Zend\Form\Element\Hidden;
use \Zend\Form\Element\Text;

class Edit extends Add {

    public function __construct(Contract $contract, $options = null)
    {
        parent::__construct($options);

        $this->removeElement('submit');

        $field = new Hidden('id');
        $field->setValue($contract->getId());
        $this->addElement($field);

        $field = new Text('contract_nb');
        $field->setLabel('Contract number')
            ->setRequired()
            ->setDecorators(array(new FieldDecorator()));
        $this->addElement($field);

        $field = new Text('invoice_nb');
        $field->setLabel('Invoice number')
            ->setRequired()
            ->setDecorators(array(new FieldDecorator()));
        if(!$contract->isSigned())
            $field->setAttrib('disabled', 'disabled');
        $this->addElement($field);

        $field = new Submit('Save');
        $field->setValue('Save')
            ->setAttrib('class', 'contracts_edit')
            ->setDecorators(array(new ButtonDecorator()));
        $this->addElement($field);

        $this->populate(
            array(
                'company'       => $contract->getCompany()->getId(),
                'discount'      => $contract->getDiscount(),
                'title'         => $contract->getTitle(),
                'sections'      => $this->_getActiveSections($contract),
                'contract_nb'   => $contract->getContractNb(),
                'invoice_nb'    => $contract->getInvoiceNb()
            )
        );
    }

    private function _getActiveSections(Contract $contract)
    {
        $return = array();
        foreach ($contract->getComposition() as $contractComposition)
            $return[] = $contractComposition->getSection()->getId();
        return $return;
    }
}<commit_msg>Litus not working on my local machine (aka: developping on a remote machine) is fun! *cough*<commit_after><?php

namespace Admin\Form\Contract;

use \Litus\Form\Admin\Decorator\ButtonDecorator;
use \Litus\Form\Admin\Decorator\FieldDecorator;
use \Litus\Entity\Br\Contract;

use \Zend\Form\Element\Submit;
use \Zend\Form\Element\Hidden;
use \Zend\Form\Element\Text;

class Edit extends Add {

    public function __construct(Contract $contract, $options = null)
    {
        parent::__construct($options);

        $this->removeElement('submit');

        $field = new Hidden('id');
        $field->setValue($contract->getId());
        $this->addElement($field);

        $field = new Text('contract_nb');
        $field->setLabel('Contract number')
            ->setRequired()
            ->setDecorators(array(new FieldDecorator()));
        $this->addElement($field);

        if($contract->isSigned()) {
            $field = new Text('invoice_nb');
            $field->setLabel('Invoice number')
                ->setRequired()
                ->setValue($contract->getInvoiceNb())
                ->setDecorators(array(new FieldDecorator()))
                ->setAttrib('disabled', 'disabled');
            $this->addElement($field);
        }

        $field = new Submit('Save');
        $field->setValue('Save')
            ->setAttrib('class', 'contracts_edit')
            ->setDecorators(array(new ButtonDecorator()));
        $this->addElement($field);

        $this->populate(
            array(
                'company'       => $contract->getCompany()->getId(),
                'discount'      => $contract->getDiscount(),
                'title'         => $contract->getTitle(),
                'sections'      => $this->_getActiveSections($contract),
                'contract_nb'   => $contract->getContractNb()
            )
        );
    }

    private function _getActiveSections(Contract $contract)
    {
        $return = array();
        foreach ($contract->getComposition() as $contractComposition)
            $return[] = $contractComposition->getSection()->getId();
        return $return;
    }
}
{'fraction_non_alphanumeric': 0.15532579947102668, 'fraction_numerical': 0.0, 'mean_word_length': 2.2963549920760697, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 73, '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': '6809058', 'n_tokens_mistral': 1184, 'n_tokens_neox': 1161, 'n_words': 194}