<commit_before><?php
/**
 * ReservationForm.php
 *
 * @author <NAME>
 * Date: 13/03/17
 */

namespace Broarm\EventTickets;

use FieldGroup;
use FieldList;
use FormAction;
use RequiredFields;
use TextField;

/**
 * Class ReservationForm
 *
 * @package Broarm\EventTickets
 */
class ReservationForm extends FormStep
{
    /**
     * @var Reservation
     */
    protected $reservation;

    public function __construct($controller, $name, Reservation $reservation = null)
    {
        $requiredFields = array();
        $fields = FieldList::create();

        // Ask details about created attendees
        foreach ($reservation->Attendees() as $attendee) {
            $fields->add($field = AttendeeField::create($attendee));
            $requiredFields = array_merge($requiredFields, $field->getRequiredFields());
        }

        $actions = FieldList::create(
            FormAction::create('goToNextStep', _t('ReservationForm.PAYMENT', 'Continue to payment'))
        );

        $required = new RequiredFields($requiredFields);

        parent::__construct($controller, $name, $fields, $actions, $required);
    }



    /**
     * Get the attached reservation
     *
     * @return Reservation
     */
    public function getReservation() {
        return $this->reservation;
    }

    /**
     * Finish the registration and continue to checkout
     *
     * @param array           $data<commit_msg>set the reservation on the reservation form<commit_after><?php
/**
 * ReservationForm.php
 *
 * @author <NAME>
 * Date: 13/03/17
 */

namespace Broarm\EventTickets;

use FieldGroup;
use FieldList;
use FormAction;
use RequiredFields;
use TextField;

/**
 * Class ReservationForm
 *
 * @package Broarm\EventTickets
 */
class ReservationForm extends FormStep
{
    /**
     * @var Reservation
     */
    protected $reservation;

    public function __construct($controller, $name, Reservation $reservation = null)
    {
        $requiredFields = array();
        $fields = FieldList::create();
        $this->reservation = $reservation;

        // Ask details about created attendees
        foreach ($reservation->Attendees() as $attendee) {
            $fields->add($field = AttendeeField::create($attendee));
            $requiredFields = array_merge($requiredFields, $field->getRequiredFields());
        }

        $actions = FieldList::create(
            FormAction::create('goToNextStep', _t('ReservationForm.PAYMENT', 'Continue to payment'))
        );

        $required = new RequiredFields($requiredFields);

        parent::__construct($controller, $name, $fields, $actions, $required);
    }



    /**
     * Get the attached reservation
     *
     * @return Reservation
     */
    public function getReservation() {
        return $this->reservation;
    }

    /**
     * Finish the registration and continue to checkout
     *
     * @param array           $data
{'fraction_non_alphanumeric': 0.122533748701973, 'fraction_numerical': 0.004153686396677051, 'mean_word_length': 2.729032258064516, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 14, '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': '5191554', 'n_tokens_mistral': 825, 'n_tokens_neox': 788, 'n_words': 189}