public function generateReference()
    {
        $reference = str_pad($this->ID, self::$reference_id_padding, '0', STR_PAD_LEFT);

        $this->extend('generateReference', $reference);

        $candidate = $reference;
        //prevent generating references that are the same
        $count = 0;
        while (Order::get()->filter('Reference', $candidate)->count() > 0) {
            $count++;
            $candidate = $reference . '' . $count;
        }
        $this->Reference = $candidate;
    }
public function generateReference()
    {
        $reference = str_pad($this->ID, self::$reference_id_padding, '0', STR_PAD_LEFT);

        $this->extend('generateReference', $reference);

        $candidate = $reference;
        //prevent generating references that are the same
        $count = 0;
        while (Order::get()->filter('Reference', $candidate)->count() > 0) {
            $count++;
            $candidate = $reference . '' . $count;
        }
        $this->Reference = $candidate;
    }
public function generateReference ( ) { $ reference = str_pad ( $ this -> ID , self :: $ reference_id_padding , '0' , STR_PAD_LEFT ) ; $ this -> extend ( 'generateReference' , $ reference ) ; $ candidate = $ reference ; //prevent generating references that are the same $ count = 0 ; while ( Order :: get ( ) -> filter ( 'Reference' , $ candidate ) -> count ( ) > 0 ) { $ count ++ ; $ candidate = $ reference . '' . $ count ; } $ this -> Reference = $ candidate ; }
Create a unique reference identifier string for this order.
Create a unique reference identifier string for this order .