开发者

understanding the arguments passed to hasColumn() in Doctrine

开发者 https://www.devze.com 2022-12-27 00:59 出处:网络
Im using Doctrine and i dont quite understand this code here: $this->hasColumn(\'id\', \'integer\', 8, array(

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开发者_JAVA技巧 2nd is the type and the 3rd the length? if so, why do we specify them again in the array?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号