/
Column.php
1427 lines (1250 loc) · 36 KB
/
Column.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/**
* This file is part of the Propel package.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @license MIT License
*/
namespace Propel\Generator\Model;
use Propel\Generator\Exception\EngineException;
use Propel\Generator\Platform\PlatformInterface;
/**
* A class for holding data about a column used in an application.
*
* @author Hans Lellelid <hans@xmpl.org> (Propel)
* @author Leon Messerschmidt <leon@opticode.co.za> (Torque)
* @author Jason van Zyl <jvanzyl@apache.org> (Torque)
* @author Jon S. Stevens <jon@latchkey.com> (Torque)
* @author Daniel Rall <dlr@finemaltcoding.com> (Torque)
* @author Byron Foster <byron_foster@yahoo.com> (Torque)
* @author Bernd Goldschmidt <bgoldschmidt@rapidsoft.de>
* @author Hugo Hamon <webmaster@apprendre-php.com>
*/
class Column extends MappingModel
{
const DEFAULT_TYPE = 'VARCHAR';
const DEFAULT_VISIBILITY = 'public';
public static $validVisibilities = array('public', 'protected', 'private');
private $name;
private $description;
private $phpName;
private $phpNamingMethod;
private $isNotNull;
private $namePrefix;
private $accessorVisibility;
private $mutatorVisibility;
/**
* The name to use for the Peer constant that identifies this column.
* (Will be converted to all-uppercase in the templates.)
* @var string
*/
private $peerName;
/**
* Native PHP type (scalar or class name)
* @var string "string", "boolean", "int", "double"
*/
private $phpType;
private $domain;
private $parentTable;
private $position;
private $isPrimaryKey;
private $isNodeKey;
private $nodeKeySep;
private $isNestedSetLeftKey;
private $isNestedSetRightKey;
private $isTreeScopeKey;
private $isUnique;
private $isAutoIncrement;
private $isLazyLoad;
private $referrers;
private $isPrimaryString;
// only one type is supported currently, which assumes the
// column either contains the classnames or a key to
// classnames specified in the schema. Others may be
// supported later.
private $inheritanceType;
private $isInheritance;
private $isEnumeratedClasses;
private $inheritanceList;
// maybe this can be retrieved from vendor specific information
private $needsTransactionInPostgres;
protected $valueSet;
/**
* Creates a new column and set the name.
*
* @param string $name
*/
public function __construct($name = null)
{
parent::__construct();
if (null !== $name) {
$this->setName($name);
}
$this->isAutoIncrement = false;
$this->isEnumeratedClasses = false;
$this->isLazyLoad = false;
$this->isNestedSetLeftKey = false;
$this->isNestedSetRightKey = false;
$this->isNodeKey = false;
$this->isNotNull = false;
$this->isPrimaryKey = false;
$this->isPrimaryString = false;
$this->isTreeScopeKey = false;
$this->isUnique = false;
$this->needsTransactionInPostgres = false;
$this->valueSet = array();
}
protected function setupObject()
{
try {
$database = $this->getDatabase();
$domain = $this->getDomain();
$platform = null;
if ($this->hasPlatform()) {
$platform = $this->getPlatform();
}
$dom = $this->getAttribute('domain');
if ($dom) {
$domain->copy($database->getDomain($dom));
} else {
$type = strtoupper($this->getAttribute('type'));
if ($type) {
if ($platform) {
$domain->copy($platform->getDomainForType($type));
} else {
// no platform - probably during tests
$this->setDomain(new Domain($type));
}
} else {
if ($platform) {
$domain->copy($platform->getDomainForType(self::DEFAULT_TYPE));
} else {
// no platform - probably during tests
$this->setDomain(new Domain(self::DEFAULT_TYPE));
}
}
}
$this->name = $this->getAttribute('name');
$this->phpName = $this->getAttribute('phpName');
$this->phpType = $this->getAttribute('phpType');
$this->peerName = $this->getAttribute('peerName');
$this->description = $this->getAttribute('description');
/*
Retrieves the method for converting from specified name
to a PHP name, defaulting to parent tables default method.
*/
$this->phpNamingMethod = $this->getAttribute('phpNamingMethod', $database->getDefaultPhpNamingMethod());
$this->namePrefix = $this->getAttribute(
'prefix',
$this->parentTable->getAttribute('columnPrefix')
);
// Accessor visibility
$visibility = $this->getMethodVisibility('accessorVisibility', 'defaultAccessorVisibility');
$this->setAccessorVisibility($visibility);
// Mutator visibility
$visibility = $this->getMethodVisibility('mutatorVisibility', 'defaultMutatorVisibility');
$this->setMutatorVisibility($visibility);
$this->isPrimaryString = $this->booleanValue($this->getAttribute('primaryString'));
$this->isPrimaryKey = $this->booleanValue($this->getAttribute('primaryKey'));
$this->isNodeKey = $this->booleanValue($this->getAttribute('nodeKey'));
$this->nodeKeySep = $this->getAttribute('nodeKeySep', '.');
$this->isNestedSetLeftKey = $this->booleanValue($this->getAttribute('nestedSetLeftKey'));
$this->isNestedSetRightKey = $this->booleanValue($this->getAttribute('nestedSetRightKey'));
$this->isTreeScopeKey = $this->booleanValue($this->getAttribute('treeScopeKey'));
$this->isNotNull = ($this->booleanValue($this->getAttribute('required'), false) || $this->isPrimaryKey); // primary keys are required
//AutoIncrement/Sequences
$this->isAutoIncrement = $this->booleanValue($this->getAttribute('autoIncrement'));
$this->isLazyLoad = $this->booleanValue($this->getAttribute('lazyLoad'));
// Add type, size information to associated Domain object
$domain->replaceSqlType($this->getAttribute('sqlType'));
if (!$this->getAttribute('size')
&& $domain->getType() === 'VARCHAR'
&& !$this->getAttribute('sqlType')
&& $platform
&& !$platform->supportsVarcharWithoutSize()) {
$size = 255;
} else {
$size = $this->getAttribute('size');
}
$domain->replaceSize($size);
$domain->replaceScale($this->getAttribute('scale'));
$defval = $this->getAttribute('defaultValue', $this->getAttribute('default'));
if (null !== $defval && 'null' !== strtolower($defval)) {
$domain->setDefaultValue(new ColumnDefaultValue($defval, ColumnDefaultValue::TYPE_VALUE));
} elseif (null !== $this->getAttribute('defaultExpr')) {
$domain->setDefaultValue(new ColumnDefaultValue($this->getAttribute('defaultExpr'), ColumnDefaultValue::TYPE_EXPR));
}
if ($this->getAttribute('valueSet')) {
$this->setValueSet($this->getAttribute('valueSet'));
}
$this->inheritanceType = $this->getAttribute('inheritance');
/*
here we are only checking for 'false', so don't
use boleanValue()
*/
$this->isInheritance = (null !== $this->inheritanceType && 'false' !== $this->inheritanceType);
} catch (Exception $e) {
throw new EngineException(sprintf(
'Error setting up column %s: %s',
$this->getAttribute('name'),
$e->getMessage()
));
}
}
/**
* Returns the generated methods visibility by looking for the
* attribute value in the column, parent table or parent database.
* Finally, it defaults to the default visibility (public).
*
* @param string $attribute Local column attribute
* @param string $parentAttribute Parent (table or database) attribute
* @return string
*/
private function getMethodVisibility($attribute, $parentAttribute)
{
$database = $this->getDatabase();
$visibility = $this->getAttribute(
$attribute,
$this->parentTable->getAttribute(
$parentAttribute,
$database->getAttribute(
$parentAttribute,
self::DEFAULT_VISIBILITY
)
)
);
return $visibility;
}
/**
* Returns the database object the current column is in.
*
* @return Database
*/
private function getDatabase()
{
return $this->parentTable->getDatabase();
}
/**
* Gets domain for this column, creating a new empty domain object if none is set.
* @return Domain
*/
public function getDomain()
{
if (null === $this->domain) {
$this->domain = new Domain();
}
return $this->domain;
}
/**
* Sets the domain for this column.
*
* @param Domain $domain
*/
public function setDomain(Domain $domain)
{
$this->domain = $domain;
}
/**
* Returns the fully qualified column name (table.column).
*
* @return string
*/
public function getFullyQualifiedName()
{
return $this->parentTable->getName() . '.' . strtoupper($this->getName());
}
/**
* Returns the column name.
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Sets the column name.
*
* @param string $name
*/
public function setName($name)
{
$this->name = $name;
}
/**
* Returns whether or not the column name is plural.
*
* @return Boolean
*/
public function isNamePlural()
{
return $this->getSingularName() !== $this->name;
}
/**
* Returns the column singular name.
*
* @return string
*/
public function getSingularName()
{
return rtrim($this->name, 's');
}
/**
* Returns the column description.
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* Sets the column description.
*
* @param string $description
*/
public function setDescription($description)
{
$this->description = $description;
}
/**
* Returns the name to use in PHP sources. It will set & return
* a self-generated phpName from it's name if it's not already set.
*
* @return string
*/
public function getPhpName()
{
if (null === $this->phpName) {
$this->setPhpName();
}
return $this->phpName;
}
/**
* Sets the name to use in PHP sources.
*
* It will generate a phpName from it's name if no
* $phpName is passed.
*
* @param string $phpName
*/
public function setPhpName($phpName = null)
{
if (null === $phpName) {
$this->phpName = self::generatePhpName($this->name, $this->phpNamingMethod, $this->namePrefix);
} else {
$this->phpName = $phpName;
}
}
/**
* Returns the studly version of the PHP name.
*
* The studly name is the PHP name with the first character lowercase.
*
* @return string
*/
public function getStudlyPhpName()
{
return lcfirst($this->getPhpName());
}
/**
* Returns the accessor methods visibility of this column / attribute.
*
* @return string
*/
public function getAccessorVisibility()
{
if (null !== $this->accessorVisibility) {
return $this->accessorVisibility;
}
return self::DEFAULT_VISIBILITY;
}
/**
* Sets the accessor methods visibility for this column / attribute.
*
* @param string $visibility
*/
public function setAccessorVisibility($visibility)
{
$visibility = strtolower($visibility);
if (!in_array($visibility, self::$validVisibilities)) {
$visibility = self::DEFAULT_VISIBILITY;
}
$this->accessorVisibility = $visibility;
}
/**
* Returns the mutator methods visibility for this current column.
*
* @return string
*/
public function getMutatorVisibility()
{
if (null !== $this->mutatorVisibility) {
return $this->mutatorVisibility;
}
return self::DEFAULT_VISIBILITY;
}
/**
* Sets the mutator methods visibility for this column / attribute.
*
* @param string $visibility
*/
public function setMutatorVisibility($visibility)
{
$visibility = strtolower($visibility);
if (!in_array($visibility, self::$validVisibilities)) {
$visibility = self::DEFAULT_VISIBILITY;
}
$this->mutatorVisibility = $visibility;
}
/**
* Returns the full column constant name (e.g. PeerName::COLUMN_NAME).
*
* @return string A column constant name for insertion into PHP code
*/
public function getConstantName()
{
$classname = $this->parentTable->getPhpName() . 'Peer';
$const = $this->getConstantColumnName();
return $classname.'::'.$const;
}
/**
* Returns the column constant name.
*
* @return string
*/
public function getConstantColumnName()
{
// was it overridden in schema.xml ?
if ($this->getPeerName()) {
return strtoupper($this->getPeerName());
}
return strtoupper($this->getName());
}
/**
* Returns the Peer constant name that will identify this column.
*
* @return string
*/
public function getPeerName()
{
return $this->peerName;
}
/**
* Sets the Peer constant name that will identify this column.
*
* @param string $name
*/
public function setPeerName($name)
{
$this->peerName = $name;
}
/**
* Returns the type to use in PHP sources.
*
* If no types has been specified, then use result of getPhpNative().
*
* @return string
*/
public function getPhpType()
{
return $this->phpType ? $this->phpType : $this->getPhpNative();
}
/**
* Returns the location of this column within the table (one-based).
*
* @return integer
*/
public function getPosition()
{
return $this->position;
}
/**
* Returns the location of this column within the table (one-based).
*
* @param integer $position
*/
public function setPosition($position)
{
$this->position = (int) $position;
}
/**
* Sets the parent table.
*
* @param Table $table
*/
public function setTable(Table $table)
{
$this->parentTable = $table;
}
/**
* Returns the parent table.
*
* @return Table
*/
public function getTable()
{
return $this->parentTable;
}
/**
* Returns the parent table name.
*
* @return string
*/
public function getTableName()
{
return $this->parentTable->getName();
}
/**
* Adds a new inheritance definition to the inheritance list and sets the
* parent column of the inheritance to the current column.
*
* @param Inheritance|array $inheritance
* @return Inheritance
*/
public function addInheritance($inheritance)
{
if ($inheritance instanceof Inheritance) {
$inheritance->setColumn($this);
if (null === $this->inheritanceList) {
$this->inheritanceList = array();
$this->isEnumeratedClasses = true;
}
$this->inheritanceList[] = $inheritance;
return $inheritance;
}
$inh = new Inheritance();
$inh->loadMapping($inheritance);
return $this->addInheritance($inh);
}
/**
* Returns the inheritance definitions.
*
* @return array
*/
public function getChildren()
{
return $this->inheritanceList;
}
/**
* Returns whether or not this column is a normal property or specifies a
* the classes that are represented in the table containing this column.
*
* @return Boolean
*/
public function isInheritance()
{
return $this->isInheritance;
}
/**
* Returns whether or not possible classes have been enumerated in the
* schema file.
*
* @return Boolean
*/
public function isEnumeratedClasses()
{
return $this->isEnumeratedClasses;
}
/**
* Returns whether or not the column is not null.
*
* @return Boolean
*/
public function isNotNull()
{
return $this->isNotNull;
}
/**
* Sets whether or not the column is not null.
*
* @param Boolean $notNull
*/
public function setNotNull($notNull)
{
$this->isNotNull = (Boolean) $notNull;
}
/**
* Returns NOT NULL string for this column.
*
* @return string.
*/
public function getNotNullString()
{
return $this->parentTable->getPlatform()->getNullString($this->isNotNull);
}
/**
* Sets whether or not the column is used as the primary string.
*
* The primary string is the value used by default in the magic
* __toString method of an active record object.
*
* @param Boolean $isPrimaryString
*/
public function setPrimaryString($isPrimaryString)
{
$this->isPrimaryString = (Boolean) $isPrimaryString;
}
/**
* Returns true if the column is the primary string (used for the magic
* __toString() method).
*
* @return Boolean
*/
public function isPrimaryString()
{
return $this->isPrimaryString;
}
/**
* Sets whether or not the column is a primary key.
*
* @param Boolean $primary
*/
public function setPrimaryKey($primary)
{
$this->isPrimaryKey = (Boolean) $primary;
}
/**
* Returns whether or not the column is the primary key.
*
* @return Boolean
*/
public function isPrimaryKey()
{
return $this->isPrimaryKey;
}
/**
* Sets whether or not the column is a node key of a tree.
*
* @param Boolean $isNodeKey
*/
public function setNodeKey($isNodeKey)
{
$this->isNodeKey = (Boolean) $isNodeKey;
}
/**
* Returns whether or not the column is a node key of a tree.
*
* @return Boolean
*/
public function isNodeKey()
{
return $this->isNodeKey;
}
/**
* Sets the separator for the node key column in a tree.
*
* @param string $sep
*/
public function setNodeKeySep($sep)
{
$this->nodeKeySep = (string) $sep;
}
/**
* Returns the node key column separator for a tree.
*
* @return string
*/
public function getNodeKeySep()
{
return $this->nodeKeySep;
}
/**
* Sets whether or not the column is the nested set left key of a tree.
*
* @param Boolean $isNestedSetLeftKey
*/
public function setNestedSetLeftKey($isNestedSetLeftKey)
{
$this->isNestedSetLeftKey = (Boolean) $isNestedSetLeftKey;
}
/**
* Returns whether or not the column is a nested set key of a tree.
*
* @return Boolean
*/
public function isNestedSetLeftKey()
{
return $this->isNestedSetLeftKey;
}
/**
* Set if the column is the nested set right key of a tree.
*
* @param Boolean $isNestedSetRightKey
*/
public function setNestedSetRightKey($isNestedSetRightKey)
{
$this->isNestedSetRightKey = (Boolean) $isNestedSetRightKey;
}
/**
* Return whether or not the column is a nested set right key of a tree.
*
* @return Boolean
*/
public function isNestedSetRightKey()
{
return $this->isNestedSetRightKey;
}
/**
* Sets whether or not the column is the scope key of a tree.
*
* @param Boolean $isTreeScopeKey
*/
public function setTreeScopeKey($isTreeScopeKey)
{
$this->isTreeScopeKey = (Boolean) $isTreeScopeKey;
}
/**
* Returns whether or not the column is a scope key of a tree.
*
* @return Boolean
*/
public function isTreeScopeKey()
{
return $this->isTreeScopeKey;
}
/**
* Sets whether or not the column must have a unique index on it.
*
* @param Boolean $isUnique
*/
public function setUnique($isUnique)
{
$this->isUnique = (Boolean) $isUnique;
}
/**
* Returns whether or not the column must have a unique index.
*
* @return Boolean
*/
public function isUnique()
{
return $this->isUnique;
}
/**
* Returns true if the column requires a transaction in PostGreSQL.
*
* @return Boolean
*/
public function requiresTransactionInPostgres()
{
return $this->needsTransactionInPostgres;
}
/**
* Returns whether or not this column is a foreign key.
*
* @return Boolean
*/
public function isForeignKey()
{
return count($this->getForeignKeys()) > 0;
}
/**
* Returns whether or not this column is part of more than one foreign key.
*
* @return Boolean
*/
public function hasMultipleFK()
{
return count($this->getForeignKeys()) > 1;
}
/**
* Returns the foreign key objects for this column.
*
* Only if it is a foreign key or part of a foreign key.
*
* @return array
*/
public function getForeignKeys()
{
return $this->parentTable->getColumnForeignKeys($this->name);
}
/**
* Adds the foreign key from another table that refers to this column.
*
* @param ForeignKey $fk
*/
public function addReferrer(ForeignKey $fk)
{
if (null === $this->referrers) {
$this->referrers = array();
}
$this->referrers[] = $fk;
}
/**
* Returns the list of references to this column.
*
* @return array
*/
public function getReferrers()
{
if (null === $this->referrers) {
$this->referrers = array();
}
return $this->referrers;
}
/**
* Returns whether or not this column has referers.
*
* @return Boolean
*/
public function hasReferrers()
{
return is_array($this->referrers) && count($this->referrers) > 0;
}
/**
* Returns whether or not this column has a specific referrer for a
* specific foreign key object.
*
* @param ForeignKey $fk
* @return Boolean
*/
public function hasReferrer(ForeignKey $fk)
{
return $this->hasReferrers() && in_array($fk, $this->referrers, true);
}
/**
* Clears all referrers.
*
*/
public function clearReferrers()
{
$this->referrers = null;
}
/**
* Clears all inheritance children.
*
*/
public function clearInheritanceList()
{
$this->inheritanceList = array();
}
/**
* Sets the domain up for specified mapping type.
*
* Calling this method will implicitly overwrite any previously set type,
* size, scale (or other domain attributes).
*
* @param string $mappingType
*/
public function setDomainForType($mappingType)
{
$this->getDomain()->copy($this->getPlatform()->getDomainForType($mappingType));
}
/**
* Sets the mapping column type.
*
* @param string $mappingType
* @see Domain::setType()
*/
public function setType($mappingType)
{
$this->getDomain()->setType($mappingType);
if (in_array($mappingType, array(PropelTypes::VARBINARY, PropelTypes::LONGVARBINARY, PropelTypes::BLOB))) {
$this->needsTransactionInPostgres = true;
}
}
/**
* Returns the Propel column type as a string.
*
* @return string
* @see Domain::getType()
*/
public function getType()
{
return $this->getDomain()->getType();
}
/**
* Returns the column PDO type integer for this column's mapping type.
*
* @return integer
*/
public function getPDOType()
{
return PropelTypes::getPDOType($this->getType());
}
public function isDefaultSqlType(PlatformInterface $platform = null)
{
if (null === $this->domain
|| null === $this->domain->getSqlType()
|| null === $platform) {
return true;
}
$defaultSqlType = $platform->getDomainForType($this->getType())->getSqlType();
return $defaultSqlType === $this->getDomain()->getSqlType();
}
/**
* Returns whether or not this column is a blob/lob type.