source: pro-violet-viettel/sourcecode/api.violet.vn/www/lib/model/om/BaseTbluser.php

Last change on this file was 289, checked in by dungnv, 11 years ago
File size: 30.9 KB
Line 
1<?php
2
3
4abstract class BaseTbluser extends BaseObject  implements Persistent {
5
6
7       
8        protected static $peer;
9
10       
11        protected $us_id;
12
13       
14        protected $us_username;
15
16       
17        protected $us_password;
18
19       
20        protected $us_firstname;
21
22       
23        protected $us_lastname;
24
25       
26        protected $us_sex;
27
28       
29        protected $us_email;
30
31       
32        protected $us_phone;
33
34       
35        protected $us_aclgroup;
36
37       
38        protected $us_school;
39
40       
41        protected $us_province;
42
43       
44        protected $us_lastvisited;
45
46       
47        protected $us_registerdate;
48
49       
50        protected $us_rating;
51
52       
53        protected $us_download;
54
55       
56        protected $us_avatar;
57
58       
59        protected $us_status;
60
61       
62        protected $us_key;
63
64       
65        protected $us_company;
66
67       
68        protected $us_score;
69
70       
71        protected $us_pointplus;
72
73       
74        protected $us_checked;
75
76       
77        protected $us_checkinfo;
78
79       
80        protected $us_idmd5;
81
82       
83        protected $us_homepage;
84
85       
86        protected $us_money;
87
88       
89        protected $singleTblblogcheckinfo;
90
91       
92        protected $alreadyInSave = false;
93
94       
95        protected $alreadyInValidation = false;
96
97       
98        public function __construct()
99        {
100                parent::__construct();
101                $this->applyDefaultValues();
102        }
103
104       
105        public function applyDefaultValues()
106        {
107                $this->us_sex = 0;
108                $this->us_rating = 0;
109                $this->us_download = 0;
110                $this->us_status = 0;
111                $this->us_key = 0;
112                $this->us_company = 0;
113                $this->us_score = 0;
114                $this->us_pointplus = 5;
115                $this->us_checked = 0;
116                $this->us_money = 0;
117        }
118
119       
120        public function getUsId()
121        {
122                return $this->us_id;
123        }
124
125       
126        public function getUsUsername()
127        {
128                return $this->us_username;
129        }
130
131       
132        public function getUsPassword()
133        {
134                return $this->us_password;
135        }
136
137       
138        public function getUsFirstname()
139        {
140                return $this->us_firstname;
141        }
142
143       
144        public function getUsLastname()
145        {
146                return $this->us_lastname;
147        }
148
149       
150        public function getUsSex()
151        {
152                return $this->us_sex;
153        }
154
155       
156        public function getUsEmail()
157        {
158                return $this->us_email;
159        }
160
161       
162        public function getUsPhone()
163        {
164                return $this->us_phone;
165        }
166
167       
168        public function getUsAclgroup()
169        {
170                return $this->us_aclgroup;
171        }
172
173       
174        public function getUsSchool()
175        {
176                return $this->us_school;
177        }
178
179       
180        public function getUsProvince()
181        {
182                return $this->us_province;
183        }
184
185       
186        public function getUsLastvisited($format = 'Y-m-d H:i:s')
187        {
188                if ($this->us_lastvisited === null) {
189                        return null;
190                }
191
192
193                if ($this->us_lastvisited === '0000-00-00 00:00:00') {
194                                                                        return null;
195                } else {
196                        try {
197                                $dt = new DateTime($this->us_lastvisited);
198                        } catch (Exception $x) {
199                                throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->us_lastvisited, true), $x);
200                        }
201                }
202
203                if ($format === null) {
204                                                return $dt;
205                } elseif (strpos($format, '%') !== false) {
206                        return strftime($format, $dt->format('U'));
207                } else {
208                        return $dt->format($format);
209                }
210        }
211
212       
213        public function getUsRegisterdate($format = 'Y-m-d H:i:s')
214        {
215                if ($this->us_registerdate === null) {
216                        return null;
217                }
218
219
220                if ($this->us_registerdate === '0000-00-00 00:00:00') {
221                                                                        return null;
222                } else {
223                        try {
224                                $dt = new DateTime($this->us_registerdate);
225                        } catch (Exception $x) {
226                                throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->us_registerdate, true), $x);
227                        }
228                }
229
230                if ($format === null) {
231                                                return $dt;
232                } elseif (strpos($format, '%') !== false) {
233                        return strftime($format, $dt->format('U'));
234                } else {
235                        return $dt->format($format);
236                }
237        }
238
239       
240        public function getUsRating()
241        {
242                return $this->us_rating;
243        }
244
245       
246        public function getUsDownload()
247        {
248                return $this->us_download;
249        }
250
251       
252        public function getUsAvatar()
253        {
254                return $this->us_avatar;
255        }
256
257       
258        public function getUsStatus()
259        {
260                return $this->us_status;
261        }
262
263       
264        public function getUsKey()
265        {
266                return $this->us_key;
267        }
268
269       
270        public function getUsCompany()
271        {
272                return $this->us_company;
273        }
274
275       
276        public function getUsScore()
277        {
278                return $this->us_score;
279        }
280
281       
282        public function getUsPointplus()
283        {
284                return $this->us_pointplus;
285        }
286
287       
288        public function getUsChecked()
289        {
290                return $this->us_checked;
291        }
292
293       
294        public function getUsCheckinfo()
295        {
296                return $this->us_checkinfo;
297        }
298
299       
300        public function getUsIdmd5()
301        {
302                return $this->us_idmd5;
303        }
304
305       
306        public function getUsHomepage()
307        {
308                return $this->us_homepage;
309        }
310
311       
312        public function getUsMoney()
313        {
314                return $this->us_money;
315        }
316
317       
318        public function setUsId($v)
319        {
320                if ($v !== null) {
321                        $v = (int) $v;
322                }
323
324                if ($this->us_id !== $v) {
325                        $this->us_id = $v;
326                        $this->modifiedColumns[] = TbluserPeer::US_ID;
327                }
328
329                return $this;
330        }
331       
332        public function setUsUsername($v)
333        {
334                if ($v !== null) {
335                        $v = (string) $v;
336                }
337
338                if ($this->us_username !== $v) {
339                        $this->us_username = $v;
340                        $this->modifiedColumns[] = TbluserPeer::US_USERNAME;
341                }
342
343                return $this;
344        }
345       
346        public function setUsPassword($v)
347        {
348                if ($v !== null) {
349                        $v = (string) $v;
350                }
351
352                if ($this->us_password !== $v) {
353                        $this->us_password = $v;
354                        $this->modifiedColumns[] = TbluserPeer::US_PASSWORD;
355                }
356
357                return $this;
358        }
359       
360        public function setUsFirstname($v)
361        {
362                if ($v !== null) {
363                        $v = (string) $v;
364                }
365
366                if ($this->us_firstname !== $v) {
367                        $this->us_firstname = $v;
368                        $this->modifiedColumns[] = TbluserPeer::US_FIRSTNAME;
369                }
370
371                return $this;
372        }
373       
374        public function setUsLastname($v)
375        {
376                if ($v !== null) {
377                        $v = (string) $v;
378                }
379
380                if ($this->us_lastname !== $v) {
381                        $this->us_lastname = $v;
382                        $this->modifiedColumns[] = TbluserPeer::US_LASTNAME;
383                }
384
385                return $this;
386        }
387       
388        public function setUsSex($v)
389        {
390                if ($v !== null) {
391                        $v = (int) $v;
392                }
393
394                if ($this->us_sex !== $v || $v === 0) {
395                        $this->us_sex = $v;
396                        $this->modifiedColumns[] = TbluserPeer::US_SEX;
397                }
398
399                return $this;
400        }
401       
402        public function setUsEmail($v)
403        {
404                if ($v !== null) {
405                        $v = (string) $v;
406                }
407
408                if ($this->us_email !== $v) {
409                        $this->us_email = $v;
410                        $this->modifiedColumns[] = TbluserPeer::US_EMAIL;
411                }
412
413                return $this;
414        }
415       
416        public function setUsPhone($v)
417        {
418                if ($v !== null) {
419                        $v = (string) $v;
420                }
421
422                if ($this->us_phone !== $v) {
423                        $this->us_phone = $v;
424                        $this->modifiedColumns[] = TbluserPeer::US_PHONE;
425                }
426
427                return $this;
428        }
429       
430        public function setUsAclgroup($v)
431        {
432                if ($v !== null) {
433                        $v = (int) $v;
434                }
435
436                if ($this->us_aclgroup !== $v) {
437                        $this->us_aclgroup = $v;
438                        $this->modifiedColumns[] = TbluserPeer::US_ACLGROUP;
439                }
440
441                return $this;
442        }
443       
444        public function setUsSchool($v)
445        {
446                if ($v !== null) {
447                        $v = (string) $v;
448                }
449
450                if ($this->us_school !== $v) {
451                        $this->us_school = $v;
452                        $this->modifiedColumns[] = TbluserPeer::US_SCHOOL;
453                }
454
455                return $this;
456        }
457       
458        public function setUsProvince($v)
459        {
460                if ($v !== null) {
461                        $v = (string) $v;
462                }
463
464                if ($this->us_province !== $v) {
465                        $this->us_province = $v;
466                        $this->modifiedColumns[] = TbluserPeer::US_PROVINCE;
467                }
468
469                return $this;
470        }
471       
472        public function setUsLastvisited($v)
473        {
474                                                if ($v === null || $v === '') {
475                        $dt = null;
476                } elseif ($v instanceof DateTime) {
477                        $dt = $v;
478                } else {
479                                                                        try {
480                                if (is_numeric($v)) {                                   $dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
481                                                                                                                        $dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
482                                } else {
483                                        $dt = new DateTime($v);
484                                }
485                        } catch (Exception $x) {
486                                throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
487                        }
488                }
489
490                if ( $this->us_lastvisited !== null || $dt !== null ) {
491                       
492                        $currNorm = ($this->us_lastvisited !== null && $tmpDt = new DateTime($this->us_lastvisited)) ? $tmpDt->format('Y-m-d H:i:s') : null;
493                        $newNorm = ($dt !== null) ? $dt->format('Y-m-d H:i:s') : null;
494
495                        if ( ($currNorm !== $newNorm)                                   )
496                        {
497                                $this->us_lastvisited = ($dt ? $dt->format('Y-m-d H:i:s') : null);
498                                $this->modifiedColumns[] = TbluserPeer::US_LASTVISITED;
499                        }
500                }
501                return $this;
502        }
503       
504        public function setUsRegisterdate($v)
505        {
506                                                if ($v === null || $v === '') {
507                        $dt = null;
508                } elseif ($v instanceof DateTime) {
509                        $dt = $v;
510                } else {
511                                                                        try {
512                                if (is_numeric($v)) {                                   $dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
513                                                                                                                        $dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
514                                } else {
515                                        $dt = new DateTime($v);
516                                }
517                        } catch (Exception $x) {
518                                throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
519                        }
520                }
521
522                if ( $this->us_registerdate !== null || $dt !== null ) {
523                       
524                        $currNorm = ($this->us_registerdate !== null && $tmpDt = new DateTime($this->us_registerdate)) ? $tmpDt->format('Y-m-d H:i:s') : null;
525                        $newNorm = ($dt !== null) ? $dt->format('Y-m-d H:i:s') : null;
526
527                        if ( ($currNorm !== $newNorm)                                   )
528                        {
529                                $this->us_registerdate = ($dt ? $dt->format('Y-m-d H:i:s') : null);
530                                $this->modifiedColumns[] = TbluserPeer::US_REGISTERDATE;
531                        }
532                }
533                return $this;
534        }
535       
536        public function setUsRating($v)
537        {
538                if ($v !== null) {
539                        $v = (int) $v;
540                }
541
542                if ($this->us_rating !== $v || $v === 0) {
543                        $this->us_rating = $v;
544                        $this->modifiedColumns[] = TbluserPeer::US_RATING;
545                }
546
547                return $this;
548        }
549       
550        public function setUsDownload($v)
551        {
552                if ($v !== null) {
553                        $v = (int) $v;
554                }
555
556                if ($this->us_download !== $v || $v === 0) {
557                        $this->us_download = $v;
558                        $this->modifiedColumns[] = TbluserPeer::US_DOWNLOAD;
559                }
560
561                return $this;
562        }
563       
564        public function setUsAvatar($v)
565        {
566                if ($v !== null) {
567                        $v = (string) $v;
568                }
569
570                if ($this->us_avatar !== $v) {
571                        $this->us_avatar = $v;
572                        $this->modifiedColumns[] = TbluserPeer::US_AVATAR;
573                }
574
575                return $this;
576        }
577       
578        public function setUsStatus($v)
579        {
580                if ($v !== null) {
581                        $v = (int) $v;
582                }
583
584                if ($this->us_status !== $v || $v === 0) {
585                        $this->us_status = $v;
586                        $this->modifiedColumns[] = TbluserPeer::US_STATUS;
587                }
588
589                return $this;
590        }
591       
592        public function setUsKey($v)
593        {
594                if ($v !== null) {
595                        $v = (int) $v;
596                }
597
598                if ($this->us_key !== $v || $v === 0) {
599                        $this->us_key = $v;
600                        $this->modifiedColumns[] = TbluserPeer::US_KEY;
601                }
602
603                return $this;
604        }
605       
606        public function setUsCompany($v)
607        {
608                if ($v !== null) {
609                        $v = (int) $v;
610                }
611
612                if ($this->us_company !== $v || $v === 0) {
613                        $this->us_company = $v;
614                        $this->modifiedColumns[] = TbluserPeer::US_COMPANY;
615                }
616
617                return $this;
618        }
619       
620        public function setUsScore($v)
621        {
622                if ($v !== null) {
623                        $v = (int) $v;
624                }
625
626                if ($this->us_score !== $v || $v === 0) {
627                        $this->us_score = $v;
628                        $this->modifiedColumns[] = TbluserPeer::US_SCORE;
629                }
630
631                return $this;
632        }
633       
634        public function setUsPointplus($v)
635        {
636                if ($v !== null) {
637                        $v = (int) $v;
638                }
639
640                if ($this->us_pointplus !== $v || $v === 5) {
641                        $this->us_pointplus = $v;
642                        $this->modifiedColumns[] = TbluserPeer::US_POINTPLUS;
643                }
644
645                return $this;
646        }
647       
648        public function setUsChecked($v)
649        {
650                if ($v !== null) {
651                        $v = (int) $v;
652                }
653
654                if ($this->us_checked !== $v || $v === 0) {
655                        $this->us_checked = $v;
656                        $this->modifiedColumns[] = TbluserPeer::US_CHECKED;
657                }
658
659                return $this;
660        }
661       
662        public function setUsCheckinfo($v)
663        {
664                if ($v !== null) {
665                        $v = (int) $v;
666                }
667
668                if ($this->us_checkinfo !== $v) {
669                        $this->us_checkinfo = $v;
670                        $this->modifiedColumns[] = TbluserPeer::US_CHECKINFO;
671                }
672
673                return $this;
674        }
675       
676        public function setUsIdmd5($v)
677        {
678                if ($v !== null) {
679                        $v = (string) $v;
680                }
681
682                if ($this->us_idmd5 !== $v) {
683                        $this->us_idmd5 = $v;
684                        $this->modifiedColumns[] = TbluserPeer::US_IDMD5;
685                }
686
687                return $this;
688        }
689       
690        public function setUsHomepage($v)
691        {
692                if ($v !== null) {
693                        $v = (string) $v;
694                }
695
696                if ($this->us_homepage !== $v) {
697                        $this->us_homepage = $v;
698                        $this->modifiedColumns[] = TbluserPeer::US_HOMEPAGE;
699                }
700
701                return $this;
702        }
703       
704        public function setUsMoney($v)
705        {
706                if ($v !== null) {
707                        $v = (int) $v;
708                }
709
710                if ($this->us_money !== $v || $v === 0) {
711                        $this->us_money = $v;
712                        $this->modifiedColumns[] = TbluserPeer::US_MONEY;
713                }
714
715                return $this;
716        }
717       
718        public function hasOnlyDefaultValues()
719        {
720                                                if (array_diff($this->modifiedColumns, array(TbluserPeer::US_SEX,TbluserPeer::US_RATING,TbluserPeer::US_DOWNLOAD,TbluserPeer::US_STATUS,TbluserPeer::US_KEY,TbluserPeer::US_COMPANY,TbluserPeer::US_SCORE,TbluserPeer::US_POINTPLUS,TbluserPeer::US_CHECKED,TbluserPeer::US_MONEY))) {
721                                return false;
722                        }
723
724                        if ($this->us_sex !== 0) {
725                                return false;
726                        }
727
728                        if ($this->us_rating !== 0) {
729                                return false;
730                        }
731
732                        if ($this->us_download !== 0) {
733                                return false;
734                        }
735
736                        if ($this->us_status !== 0) {
737                                return false;
738                        }
739
740                        if ($this->us_key !== 0) {
741                                return false;
742                        }
743
744                        if ($this->us_company !== 0) {
745                                return false;
746                        }
747
748                        if ($this->us_score !== 0) {
749                                return false;
750                        }
751
752                        if ($this->us_pointplus !== 5) {
753                                return false;
754                        }
755
756                        if ($this->us_checked !== 0) {
757                                return false;
758                        }
759
760                        if ($this->us_money !== 0) {
761                                return false;
762                        }
763
764                                return true;
765        }
766       
767        public function hydrate($row, $startcol = 0, $rehydrate = false)
768        {
769                try {
770
771                        $this->us_id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
772                        $this->us_username = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
773                        $this->us_password = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
774                        $this->us_firstname = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
775                        $this->us_lastname = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
776                        $this->us_sex = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null;
777                        $this->us_email = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
778                        $this->us_phone = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
779                        $this->us_aclgroup = ($row[$startcol + 8] !== null) ? (int) $row[$startcol + 8] : null;
780                        $this->us_school = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
781                        $this->us_province = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null;
782                        $this->us_lastvisited = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null;
783                        $this->us_registerdate = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null;
784                        $this->us_rating = ($row[$startcol + 13] !== null) ? (int) $row[$startcol + 13] : null;
785                        $this->us_download = ($row[$startcol + 14] !== null) ? (int) $row[$startcol + 14] : null;
786                        $this->us_avatar = ($row[$startcol + 15] !== null) ? (string) $row[$startcol + 15] : null;
787                        $this->us_status = ($row[$startcol + 16] !== null) ? (int) $row[$startcol + 16] : null;
788                        $this->us_key = ($row[$startcol + 17] !== null) ? (int) $row[$startcol + 17] : null;
789                        $this->us_company = ($row[$startcol + 18] !== null) ? (int) $row[$startcol + 18] : null;
790                        $this->us_score = ($row[$startcol + 19] !== null) ? (int) $row[$startcol + 19] : null;
791                        $this->us_pointplus = ($row[$startcol + 20] !== null) ? (int) $row[$startcol + 20] : null;
792                        $this->us_checked = ($row[$startcol + 21] !== null) ? (int) $row[$startcol + 21] : null;
793                        $this->us_checkinfo = ($row[$startcol + 22] !== null) ? (int) $row[$startcol + 22] : null;
794                        $this->us_idmd5 = ($row[$startcol + 23] !== null) ? (string) $row[$startcol + 23] : null;
795                        $this->us_homepage = ($row[$startcol + 24] !== null) ? (string) $row[$startcol + 24] : null;
796                        $this->us_money = ($row[$startcol + 25] !== null) ? (int) $row[$startcol + 25] : null;
797                        $this->resetModified();
798
799                        $this->setNew(false);
800
801                        if ($rehydrate) {
802                                $this->ensureConsistency();
803                        }
804
805                                                return $startcol + 26;
806                } catch (Exception $e) {
807                        throw new PropelException("Error populating Tbluser object", $e);
808                }
809        }
810
811       
812        public function ensureConsistency()
813        {
814
815        }
816       
817        public function reload($deep = false, PropelPDO $con = null)
818        {
819                if ($this->isDeleted()) {
820                        throw new PropelException("Cannot reload a deleted object.");
821                }
822
823                if ($this->isNew()) {
824                        throw new PropelException("Cannot reload an unsaved object.");
825                }
826
827                if ($con === null) {
828                        $con = Propel::getConnection(TbluserPeer::DATABASE_NAME, Propel::CONNECTION_READ);
829                }
830
831                               
832                $stmt = TbluserPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
833                $row = $stmt->fetch(PDO::FETCH_NUM);
834                $stmt->closeCursor();
835                if (!$row) {
836                        throw new PropelException('Cannot find matching row in the database to reload object values.');
837                }
838                $this->hydrate($row, 0, true);
839                if ($deep) { 
840                        $this->singleTblblogcheckinfo = null;
841
842                }       }
843
844       
845        public function delete(PropelPDO $con = null)
846        {
847                if ($this->isDeleted()) {
848                        throw new PropelException("This object has already been deleted.");
849                }
850
851                if ($con === null) {
852                        $con = Propel::getConnection(TbluserPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
853                }
854               
855                $con->beginTransaction();
856                try {
857                        TbluserPeer::doDelete($this, $con);
858                        $this->setDeleted(true);
859                        $con->commit();
860                } catch (PropelException $e) {
861                        $con->rollBack();
862                        throw $e;
863                }
864        }
865
866       
867        public function save(PropelPDO $con = null)
868        {
869                if ($this->isDeleted()) {
870                        throw new PropelException("You cannot save an object that has been deleted.");
871                }
872
873                if ($con === null) {
874                        $con = Propel::getConnection(TbluserPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
875                }
876               
877                $con->beginTransaction();
878                try {
879                        $affectedRows = $this->doSave($con);
880                        $con->commit();
881                        TbluserPeer::addInstanceToPool($this);
882                        return $affectedRows;
883                } catch (PropelException $e) {
884                        $con->rollBack();
885                        throw $e;
886                }
887        }
888
889       
890        protected function doSave(PropelPDO $con)
891        {
892                $affectedRows = 0;              if (!$this->alreadyInSave) {
893                        $this->alreadyInSave = true;
894
895                        if ($this->isNew() ) {
896                                $this->modifiedColumns[] = TbluserPeer::US_ID;
897                        }
898
899                                                if ($this->isModified()) {
900                                if ($this->isNew()) {
901                                        $pk = TbluserPeer::doInsert($this, $con);
902                                        $affectedRows += 1;                                                                                                                                                             
903                                        $this->setUsId($pk); 
904                                        $this->setNew(false);
905                                } else {
906                                        $affectedRows += TbluserPeer::doUpdate($this, $con);
907                                }
908
909                                $this->resetModified();                         }
910
911                        if ($this->singleTblblogcheckinfo !== null) {
912                                if (!$this->singleTblblogcheckinfo->isDeleted()) {
913                                                $affectedRows += $this->singleTblblogcheckinfo->save($con);
914                                }
915                        }
916
917                        $this->alreadyInSave = false;
918
919                }
920                return $affectedRows;
921        }
922       
923        protected $validationFailures = array();
924
925       
926        public function getValidationFailures()
927        {
928                return $this->validationFailures;
929        }
930
931       
932        public function validate($columns = null)
933        {
934                $res = $this->doValidate($columns);
935                if ($res === true) {
936                        $this->validationFailures = array();
937                        return true;
938                } else {
939                        $this->validationFailures = $res;
940                        return false;
941                }
942        }
943
944       
945        protected function doValidate($columns = null)
946        {
947                if (!$this->alreadyInValidation) {
948                        $this->alreadyInValidation = true;
949                        $retval = null;
950
951                        $failureMap = array();
952
953
954                        if (($retval = TbluserPeer::doValidate($this, $columns)) !== true) {
955                                $failureMap = array_merge($failureMap, $retval);
956                        }
957
958
959                                if ($this->singleTblblogcheckinfo !== null) {
960                                        if (!$this->singleTblblogcheckinfo->validate($columns)) {
961                                                $failureMap = array_merge($failureMap, $this->singleTblblogcheckinfo->getValidationFailures());
962                                        }
963                                }
964
965
966                        $this->alreadyInValidation = false;
967                }
968
969                return (!empty($failureMap) ? $failureMap : true);
970        }
971
972       
973        public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
974        {
975                $pos = TbluserPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
976                $field = $this->getByPosition($pos);
977                return $field;
978        }
979
980       
981        public function getByPosition($pos)
982        {
983                switch($pos) {
984                        case 0:
985                                return $this->getUsId();
986                                break;
987                        case 1:
988                                return $this->getUsUsername();
989                                break;
990                        case 2:
991                                return $this->getUsPassword();
992                                break;
993                        case 3:
994                                return $this->getUsFirstname();
995                                break;
996                        case 4:
997                                return $this->getUsLastname();
998                                break;
999                        case 5:
1000                                return $this->getUsSex();
1001                                break;
1002                        case 6:
1003                                return $this->getUsEmail();
1004                                break;
1005                        case 7:
1006                                return $this->getUsPhone();
1007                                break;
1008                        case 8:
1009                                return $this->getUsAclgroup();
1010                                break;
1011                        case 9:
1012                                return $this->getUsSchool();
1013                                break;
1014                        case 10:
1015                                return $this->getUsProvince();
1016                                break;
1017                        case 11:
1018                                return $this->getUsLastvisited();
1019                                break;
1020                        case 12:
1021                                return $this->getUsRegisterdate();
1022                                break;
1023                        case 13:
1024                                return $this->getUsRating();
1025                                break;
1026                        case 14:
1027                                return $this->getUsDownload();
1028                                break;
1029                        case 15:
1030                                return $this->getUsAvatar();
1031                                break;
1032                        case 16:
1033                                return $this->getUsStatus();
1034                                break;
1035                        case 17:
1036                                return $this->getUsKey();
1037                                break;
1038                        case 18:
1039                                return $this->getUsCompany();
1040                                break;
1041                        case 19:
1042                                return $this->getUsScore();
1043                                break;
1044                        case 20:
1045                                return $this->getUsPointplus();
1046                                break;
1047                        case 21:
1048                                return $this->getUsChecked();
1049                                break;
1050                        case 22:
1051                                return $this->getUsCheckinfo();
1052                                break;
1053                        case 23:
1054                                return $this->getUsIdmd5();
1055                                break;
1056                        case 24:
1057                                return $this->getUsHomepage();
1058                                break;
1059                        case 25:
1060                                return $this->getUsMoney();
1061                                break;
1062                        default:
1063                                return null;
1064                                break;
1065                }       }
1066
1067       
1068        public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true)
1069        {
1070                $keys = TbluserPeer::getFieldNames($keyType);
1071                $result = array(
1072                        $keys[0] => $this->getUsId(),
1073                        $keys[1] => $this->getUsUsername(),
1074                        $keys[2] => $this->getUsPassword(),
1075                        $keys[3] => $this->getUsFirstname(),
1076                        $keys[4] => $this->getUsLastname(),
1077                        $keys[5] => $this->getUsSex(),
1078                        $keys[6] => $this->getUsEmail(),
1079                        $keys[7] => $this->getUsPhone(),
1080                        $keys[8] => $this->getUsAclgroup(),
1081                        $keys[9] => $this->getUsSchool(),
1082                        $keys[10] => $this->getUsProvince(),
1083                        $keys[11] => $this->getUsLastvisited(),
1084                        $keys[12] => $this->getUsRegisterdate(),
1085                        $keys[13] => $this->getUsRating(),
1086                        $keys[14] => $this->getUsDownload(),
1087                        $keys[15] => $this->getUsAvatar(),
1088                        $keys[16] => $this->getUsStatus(),
1089                        $keys[17] => $this->getUsKey(),
1090                        $keys[18] => $this->getUsCompany(),
1091                        $keys[19] => $this->getUsScore(),
1092                        $keys[20] => $this->getUsPointplus(),
1093                        $keys[21] => $this->getUsChecked(),
1094                        $keys[22] => $this->getUsCheckinfo(),
1095                        $keys[23] => $this->getUsIdmd5(),
1096                        $keys[24] => $this->getUsHomepage(),
1097                        $keys[25] => $this->getUsMoney(),
1098                );
1099                return $result;
1100        }
1101
1102       
1103        public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
1104        {
1105                $pos = TbluserPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
1106                return $this->setByPosition($pos, $value);
1107        }
1108
1109       
1110        public function setByPosition($pos, $value)
1111        {
1112                switch($pos) {
1113                        case 0:
1114                                $this->setUsId($value);
1115                                break;
1116                        case 1:
1117                                $this->setUsUsername($value);
1118                                break;
1119                        case 2:
1120                                $this->setUsPassword($value);
1121                                break;
1122                        case 3:
1123                                $this->setUsFirstname($value);
1124                                break;
1125                        case 4:
1126                                $this->setUsLastname($value);
1127                                break;
1128                        case 5:
1129                                $this->setUsSex($value);
1130                                break;
1131                        case 6:
1132                                $this->setUsEmail($value);
1133                                break;
1134                        case 7:
1135                                $this->setUsPhone($value);
1136                                break;
1137                        case 8:
1138                                $this->setUsAclgroup($value);
1139                                break;
1140                        case 9:
1141                                $this->setUsSchool($value);
1142                                break;
1143                        case 10:
1144                                $this->setUsProvince($value);
1145                                break;
1146                        case 11:
1147                                $this->setUsLastvisited($value);
1148                                break;
1149                        case 12:
1150                                $this->setUsRegisterdate($value);
1151                                break;
1152                        case 13:
1153                                $this->setUsRating($value);
1154                                break;
1155                        case 14:
1156                                $this->setUsDownload($value);
1157                                break;
1158                        case 15:
1159                                $this->setUsAvatar($value);
1160                                break;
1161                        case 16:
1162                                $this->setUsStatus($value);
1163                                break;
1164                        case 17:
1165                                $this->setUsKey($value);
1166                                break;
1167                        case 18:
1168                                $this->setUsCompany($value);
1169                                break;
1170                        case 19:
1171                                $this->setUsScore($value);
1172                                break;
1173                        case 20:
1174                                $this->setUsPointplus($value);
1175                                break;
1176                        case 21:
1177                                $this->setUsChecked($value);
1178                                break;
1179                        case 22:
1180                                $this->setUsCheckinfo($value);
1181                                break;
1182                        case 23:
1183                                $this->setUsIdmd5($value);
1184                                break;
1185                        case 24:
1186                                $this->setUsHomepage($value);
1187                                break;
1188                        case 25:
1189                                $this->setUsMoney($value);
1190                                break;
1191                }       }
1192
1193       
1194        public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
1195        {
1196                $keys = TbluserPeer::getFieldNames($keyType);
1197
1198                if (array_key_exists($keys[0], $arr)) $this->setUsId($arr[$keys[0]]);
1199                if (array_key_exists($keys[1], $arr)) $this->setUsUsername($arr[$keys[1]]);
1200                if (array_key_exists($keys[2], $arr)) $this->setUsPassword($arr[$keys[2]]);
1201                if (array_key_exists($keys[3], $arr)) $this->setUsFirstname($arr[$keys[3]]);
1202                if (array_key_exists($keys[4], $arr)) $this->setUsLastname($arr[$keys[4]]);
1203                if (array_key_exists($keys[5], $arr)) $this->setUsSex($arr[$keys[5]]);
1204                if (array_key_exists($keys[6], $arr)) $this->setUsEmail($arr[$keys[6]]);
1205                if (array_key_exists($keys[7], $arr)) $this->setUsPhone($arr[$keys[7]]);
1206                if (array_key_exists($keys[8], $arr)) $this->setUsAclgroup($arr[$keys[8]]);
1207                if (array_key_exists($keys[9], $arr)) $this->setUsSchool($arr[$keys[9]]);
1208                if (array_key_exists($keys[10], $arr)) $this->setUsProvince($arr[$keys[10]]);
1209                if (array_key_exists($keys[11], $arr)) $this->setUsLastvisited($arr[$keys[11]]);
1210                if (array_key_exists($keys[12], $arr)) $this->setUsRegisterdate($arr[$keys[12]]);
1211                if (array_key_exists($keys[13], $arr)) $this->setUsRating($arr[$keys[13]]);
1212                if (array_key_exists($keys[14], $arr)) $this->setUsDownload($arr[$keys[14]]);
1213                if (array_key_exists($keys[15], $arr)) $this->setUsAvatar($arr[$keys[15]]);
1214                if (array_key_exists($keys[16], $arr)) $this->setUsStatus($arr[$keys[16]]);
1215                if (array_key_exists($keys[17], $arr)) $this->setUsKey($arr[$keys[17]]);
1216                if (array_key_exists($keys[18], $arr)) $this->setUsCompany($arr[$keys[18]]);
1217                if (array_key_exists($keys[19], $arr)) $this->setUsScore($arr[$keys[19]]);
1218                if (array_key_exists($keys[20], $arr)) $this->setUsPointplus($arr[$keys[20]]);
1219                if (array_key_exists($keys[21], $arr)) $this->setUsChecked($arr[$keys[21]]);
1220                if (array_key_exists($keys[22], $arr)) $this->setUsCheckinfo($arr[$keys[22]]);
1221                if (array_key_exists($keys[23], $arr)) $this->setUsIdmd5($arr[$keys[23]]);
1222                if (array_key_exists($keys[24], $arr)) $this->setUsHomepage($arr[$keys[24]]);
1223                if (array_key_exists($keys[25], $arr)) $this->setUsMoney($arr[$keys[25]]);
1224        }
1225
1226       
1227        public function buildCriteria()
1228        {
1229                $criteria = new Criteria(TbluserPeer::DATABASE_NAME);
1230
1231                if ($this->isColumnModified(TbluserPeer::US_ID)) $criteria->add(TbluserPeer::US_ID, $this->us_id);
1232                if ($this->isColumnModified(TbluserPeer::US_USERNAME)) $criteria->add(TbluserPeer::US_USERNAME, $this->us_username);
1233                if ($this->isColumnModified(TbluserPeer::US_PASSWORD)) $criteria->add(TbluserPeer::US_PASSWORD, $this->us_password);
1234                if ($this->isColumnModified(TbluserPeer::US_FIRSTNAME)) $criteria->add(TbluserPeer::US_FIRSTNAME, $this->us_firstname);
1235                if ($this->isColumnModified(TbluserPeer::US_LASTNAME)) $criteria->add(TbluserPeer::US_LASTNAME, $this->us_lastname);
1236                if ($this->isColumnModified(TbluserPeer::US_SEX)) $criteria->add(TbluserPeer::US_SEX, $this->us_sex);
1237                if ($this->isColumnModified(TbluserPeer::US_EMAIL)) $criteria->add(TbluserPeer::US_EMAIL, $this->us_email);
1238                if ($this->isColumnModified(TbluserPeer::US_PHONE)) $criteria->add(TbluserPeer::US_PHONE, $this->us_phone);
1239                if ($this->isColumnModified(TbluserPeer::US_ACLGROUP)) $criteria->add(TbluserPeer::US_ACLGROUP, $this->us_aclgroup);
1240                if ($this->isColumnModified(TbluserPeer::US_SCHOOL)) $criteria->add(TbluserPeer::US_SCHOOL, $this->us_school);
1241                if ($this->isColumnModified(TbluserPeer::US_PROVINCE)) $criteria->add(TbluserPeer::US_PROVINCE, $this->us_province);
1242                if ($this->isColumnModified(TbluserPeer::US_LASTVISITED)) $criteria->add(TbluserPeer::US_LASTVISITED, $this->us_lastvisited);
1243                if ($this->isColumnModified(TbluserPeer::US_REGISTERDATE)) $criteria->add(TbluserPeer::US_REGISTERDATE, $this->us_registerdate);
1244                if ($this->isColumnModified(TbluserPeer::US_RATING)) $criteria->add(TbluserPeer::US_RATING, $this->us_rating);
1245                if ($this->isColumnModified(TbluserPeer::US_DOWNLOAD)) $criteria->add(TbluserPeer::US_DOWNLOAD, $this->us_download);
1246                if ($this->isColumnModified(TbluserPeer::US_AVATAR)) $criteria->add(TbluserPeer::US_AVATAR, $this->us_avatar);
1247                if ($this->isColumnModified(TbluserPeer::US_STATUS)) $criteria->add(TbluserPeer::US_STATUS, $this->us_status);
1248                if ($this->isColumnModified(TbluserPeer::US_KEY)) $criteria->add(TbluserPeer::US_KEY, $this->us_key);
1249                if ($this->isColumnModified(TbluserPeer::US_COMPANY)) $criteria->add(TbluserPeer::US_COMPANY, $this->us_company);
1250                if ($this->isColumnModified(TbluserPeer::US_SCORE)) $criteria->add(TbluserPeer::US_SCORE, $this->us_score);
1251                if ($this->isColumnModified(TbluserPeer::US_POINTPLUS)) $criteria->add(TbluserPeer::US_POINTPLUS, $this->us_pointplus);
1252                if ($this->isColumnModified(TbluserPeer::US_CHECKED)) $criteria->add(TbluserPeer::US_CHECKED, $this->us_checked);
1253                if ($this->isColumnModified(TbluserPeer::US_CHECKINFO)) $criteria->add(TbluserPeer::US_CHECKINFO, $this->us_checkinfo);
1254                if ($this->isColumnModified(TbluserPeer::US_IDMD5)) $criteria->add(TbluserPeer::US_IDMD5, $this->us_idmd5);
1255                if ($this->isColumnModified(TbluserPeer::US_HOMEPAGE)) $criteria->add(TbluserPeer::US_HOMEPAGE, $this->us_homepage);
1256                if ($this->isColumnModified(TbluserPeer::US_MONEY)) $criteria->add(TbluserPeer::US_MONEY, $this->us_money);
1257
1258                return $criteria;
1259        }
1260
1261       
1262        public function buildPkeyCriteria()
1263        {
1264                $criteria = new Criteria(TbluserPeer::DATABASE_NAME);
1265
1266                $criteria->add(TbluserPeer::US_ID, $this->us_id);
1267
1268                return $criteria;
1269        }
1270
1271       
1272        public function getPrimaryKey()
1273        {
1274                return $this->getUsId();
1275        }
1276
1277       
1278        public function setPrimaryKey($key)
1279        {
1280                $this->setUsId($key);
1281        }
1282
1283       
1284        public function copyInto($copyObj, $deepCopy = false)
1285        {
1286
1287                $copyObj->setUsUsername($this->us_username);
1288
1289                $copyObj->setUsPassword($this->us_password);
1290
1291                $copyObj->setUsFirstname($this->us_firstname);
1292
1293                $copyObj->setUsLastname($this->us_lastname);
1294
1295                $copyObj->setUsSex($this->us_sex);
1296
1297                $copyObj->setUsEmail($this->us_email);
1298
1299                $copyObj->setUsPhone($this->us_phone);
1300
1301                $copyObj->setUsAclgroup($this->us_aclgroup);
1302
1303                $copyObj->setUsSchool($this->us_school);
1304
1305                $copyObj->setUsProvince($this->us_province);
1306
1307                $copyObj->setUsLastvisited($this->us_lastvisited);
1308
1309                $copyObj->setUsRegisterdate($this->us_registerdate);
1310
1311                $copyObj->setUsRating($this->us_rating);
1312
1313                $copyObj->setUsDownload($this->us_download);
1314
1315                $copyObj->setUsAvatar($this->us_avatar);
1316
1317                $copyObj->setUsStatus($this->us_status);
1318
1319                $copyObj->setUsKey($this->us_key);
1320
1321                $copyObj->setUsCompany($this->us_company);
1322
1323                $copyObj->setUsScore($this->us_score);
1324
1325                $copyObj->setUsPointplus($this->us_pointplus);
1326
1327                $copyObj->setUsChecked($this->us_checked);
1328
1329                $copyObj->setUsCheckinfo($this->us_checkinfo);
1330
1331                $copyObj->setUsIdmd5($this->us_idmd5);
1332
1333                $copyObj->setUsHomepage($this->us_homepage);
1334
1335                $copyObj->setUsMoney($this->us_money);
1336
1337
1338                if ($deepCopy) {
1339                                                                        $copyObj->setNew(false);
1340
1341                        $relObj = $this->getTblblogcheckinfo();
1342                        if ($relObj) {
1343                                $copyObj->setTblblogcheckinfo($relObj->copy($deepCopy));
1344                        }
1345
1346                }
1347
1348                $copyObj->setNew(true);
1349
1350                $copyObj->setUsId(NULL);
1351        }
1352
1353       
1354        public function copy($deepCopy = false)
1355        {
1356                                $clazz = get_class($this);
1357                $copyObj = new $clazz();
1358                $this->copyInto($copyObj, $deepCopy);
1359                return $copyObj;
1360        }
1361
1362       
1363        public function getPeer()
1364        {
1365                if (self::$peer === null) {
1366                        self::$peer = new TbluserPeer();
1367                }
1368                return self::$peer;
1369        }
1370
1371       
1372        public function getTblblogcheckinfo(PropelPDO $con = null)
1373        {
1374
1375                if ($this->singleTblblogcheckinfo === null && !$this->isNew()) {
1376                        $this->singleTblblogcheckinfo = TblblogcheckinfoPeer::retrieveByPK($this->us_id, $con);
1377                }
1378
1379                return $this->singleTblblogcheckinfo;
1380        }
1381
1382       
1383        public function setTblblogcheckinfo(Tblblogcheckinfo $v)
1384        {
1385                $this->singleTblblogcheckinfo = $v;
1386
1387                                if ($v->getTbluser() === null) {
1388                        $v->setTbluser($this);
1389                }
1390
1391                return $this;
1392        }
1393
1394       
1395        public function clearAllReferences($deep = false)
1396        {
1397                if ($deep) {
1398                        if ($this->singleTblblogcheckinfo) {
1399                                $this->singleTblblogcheckinfo->clearAllReferences($deep);
1400                        }
1401                }
1402                $this->singleTblblogcheckinfo = null;
1403        }
1404
1405}
Note: See TracBrowser for help on using the repository browser.