tags:

views:

339

answers:

1

Im using Doctrine and i dont quite understand this code here:

    $this->hasColumn('id', 'integer', 8, array(
         'type' => 'integer',
         'length' => 8,
         'fixed' => false,
    ));

what is the 2nd and 3rd argument in hasColumn for?

the 2nd is the type and the 3rd the length? if so, why do we specify them again in the array?

+2  A: 

You do not have to redefine this in $options array. In fact internally Doctrine assigns values of 2nd and 3rd parameter to this array after few operations:

// few operations on $length
$options['type'] = $type;
$options['length'] = $length;

Why type/length have their own parameters? Because they are the most commonly used while $options can be skipped in many cases.

Crozin