public function onBeforeWrite()
    {
        // Set the title to the name of the reservation holder
        $this->Title = $this->getName();

        // Create a validation code to be used for confirmation and in the barcode
        if ($this->exists() && empty($this->ReservationCode)) {
            $this->ReservationCode = $this->createReservationCode();
        }

        parent::onBeforeWrite();
    }
public function onBeforeWrite()
    {
        // Set the title to the name of the reservation holder
        $this->Title = $this->getName();

        // Create a validation code to be used for confirmation and in the barcode
        if ($this->exists() && empty($this->ReservationCode)) {
            $this->ReservationCode = $this->createReservationCode();
        }

        parent::onBeforeWrite();
    }
public function onBeforeWrite ( ) { // Set the title to the name of the reservation holder $ this -> Title = $ this -> getName ( ) ; // Create a validation code to be used for confirmation and in the barcode if ( $ this -> exists ( ) && empty ( $ this -> ReservationCode ) ) { $ this -> ReservationCode = $ this -> createReservationCode ( ) ; } parent :: onBeforeWrite ( ) ; }
Generate a reservation code if it does not yet exists
Generate a reservation code if it does not yet exists