root/trunk/lib/model/om/BaseSnippetComment.php

Revision 2, 23.2 kB (checked in by fabien, 6 years ago)

initial import

  • Property svn:mime-type set to text/x-php
  • Property svn:keywords set to Id
Line 
1 <?php
2
3 require_once 'propel/om/BaseObject.php';
4
5 require_once 'propel/om/Persistent.php';
6
7
8 include_once 'propel/util/Criteria.php';
9
10 include_once 'model/SnippetCommentPeer.php';
11
12 /**
13  * Base class that represents a row from the 'sn_comment' table.
14  *
15  *
16  *
17  * @package model.om
18  */
19 abstract class BaseSnippetComment extends BaseObject  implements Persistent {
20
21
22     /**
23      * The Peer class.
24      * Instance provides a convenient way of calling static methods on a class
25      * that calling code may not be able to identify.
26      * @var SnippetCommentPeer
27      */
28     protected static $peer;
29
30
31     /**
32      * The value for the id field.
33      * @var int
34      */
35     protected $id;
36
37
38     /**
39      * The value for the user_id field.
40      * @var int
41      */
42     protected $user_id;
43
44
45     /**
46      * The value for the snippet_id field.
47      * @var int
48      */
49     protected $snippet_id;
50
51
52     /**
53      * The value for the body field.
54      * @var string
55      */
56     protected $body;
57
58
59     /**
60      * The value for the html_body field.
61      * @var string
62      */
63     protected $html_body;
64
65
66     /**
67      * The value for the created_at field.
68      * @var int
69      */
70     protected $created_at;
71
72     /**
73      * @var SnippetUser
74      */
75     protected $aSnippetUser;
76
77     /**
78      * @var SnippetSnippet
79      */
80     protected $aSnippetSnippet;
81
82     /**
83      * Flag to prevent endless save loop, if this object is referenced
84      * by another object which falls in this transaction.
85      * @var boolean
86      */
87     protected $alreadyInSave = false;
88
89     /**
90      * Flag to prevent endless validation loop, if this object is referenced
91      * by another object which falls in this transaction.
92      * @var boolean
93      */
94     protected $alreadyInValidation = false;
95
96     /**
97      * Get the [id] column value.
98      *
99      * @return int
100      */
101     public function getId()
102     {
103
104         return $this->id;
105     }
106
107     /**
108      * Get the [user_id] column value.
109      *
110      * @return int
111      */
112     public function getUserId()
113     {
114
115         return $this->user_id;
116     }
117
118     /**
119      * Get the [snippet_id] column value.
120      *
121      * @return int
122      */
123     public function getSnippetId()
124     {
125
126         return $this->snippet_id;
127     }
128
129     /**
130      * Get the [body] column value.
131      *
132      * @return string
133      */
134     public function getBody()
135     {
136
137         return $this->body;
138     }
139
140     /**
141      * Get the [html_body] column value.
142      *
143      * @return string
144      */
145     public function getHtmlBody()
146     {
147
148         return $this->html_body;
149     }
150
151     /**
152      * Get the [optionally formatted] [created_at] column value.
153      *
154      * @param string $format The date/time format string (either date()-style or strftime()-style).
155      *                            If format is NULL, then the integer unix timestamp will be returned.
156      * @return mixed Formatted date/time value as string or integer unix timestamp (if format is NULL).
157      * @throws PropelException - if unable to convert the date/time to timestamp.
158      */
159     public function getCreatedAt($format = 'Y-m-d H:i:s')
160     {
161
162         if ($this->created_at === null || $this->created_at === '') {
163             return null;
164         } elseif (!is_int($this->created_at)) {
165             // a non-timestamp value was set externally, so we convert it
166             $ts = strtotime($this->created_at);
167             if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
168                 throw new PropelException("Unable to parse value of [created_at] as date/time value: " . var_export($this->created_at, true));
169             }
170         } else {
171             $ts = $this->created_at;
172         }
173         if ($format === null) {
174             return $ts;
175         } elseif (strpos($format, '%') !== false) {
176             return strftime($format, $ts);
177         } else {
178             return date($format, $ts);
179         }
180     }
181
182     /**
183      * Set the value of [id] column.
184      *
185      * @param int $v new value
186      * @return void
187      */
188     public function setId($v)
189     {
190
191         if ($this->id !== $v) {
192             $this->id = $v;
193             $this->modifiedColumns[] = SnippetCommentPeer::ID;
194         }
195
196     } // setId()
197
198     /**
199      * Set the value of [user_id] column.
200      *
201      * @param int $v new value
202      * @return void
203      */
204     public function setUserId($v)
205     {
206
207         if ($this->user_id !== $v) {
208             $this->user_id = $v;
209             $this->modifiedColumns[] = SnippetCommentPeer::USER_ID;
210         }
211
212         if ($this->aSnippetUser !== null && $this->aSnippetUser->getId() !== $v) {
213             $this->aSnippetUser = null;
214         }       
215
216     } // setUserId()
217
218     /**
219      * Set the value of [snippet_id] column.
220      *
221      * @param int $v new value
222      * @return void
223      */
224     public function setSnippetId($v)
225     {
226
227         if ($this->snippet_id !== $v) {
228             $this->snippet_id = $v;
229             $this->modifiedColumns[] = SnippetCommentPeer::SNIPPET_ID;
230         }
231
232         if ($this->aSnippetSnippet !== null && $this->aSnippetSnippet->getId() !== $v) {
233             $this->aSnippetSnippet = null;
234         }       
235
236     } // setSnippetId()
237
238     /**
239      * Set the value of [body] column.
240      *
241      * @param string $v new value
242      * @return void
243      */
244     public function setBody($v)
245     {
246
247         if ($this->body !== $v) {
248             $this->body = $v;
249             $this->modifiedColumns[] = SnippetCommentPeer::BODY;
250         }
251
252     } // setBody()
253
254     /**
255      * Set the value of [html_body] column.
256      *
257      * @param string $v new value
258      * @return void
259      */
260     public function setHtmlBody($v)
261     {
262
263         if ($this->html_body !== $v) {
264             $this->html_body = $v;
265             $this->modifiedColumns[] = SnippetCommentPeer::HTML_BODY;
266         }
267
268     } // setHtmlBody()
269
270     /**
271      * Set the value of [created_at] column.
272      *
273      * @param int $v new value
274      * @return void
275      */
276     public function setCreatedAt($v)
277     {
278
279         if ($v !== null && !is_int($v)) {
280             $ts = strtotime($v);
281             if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
282                 throw new PropelException("Unable to parse date/time value for [created_at] from input: " . var_export($v, true));
283             }
284         } else {
285             $ts = $v;
286         }
287         if ($this->created_at !== $ts) {
288             $this->created_at = $ts;
289             $this->modifiedColumns[] = SnippetCommentPeer::CREATED_AT;
290         }
291
292     } // setCreatedAt()
293
294     /**
295      * Hydrates (populates) the object variables with values from the database resultset.
296      *
297      * An offset (1-based "start column") is specified so that objects can be hydrated
298      * with a subset of the columns in the resultset rows.  This is needed, for example,
299      * for results of JOIN queries where the resultset row includes columns from two or
300      * more tables.
301      *
302      * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos.
303      * @param int $startcol 1-based offset column which indicates which restultset column to start with.
304      * @return int next starting column
305      * @throws PropelException  - Any caught Exception will be rewrapped as a PropelException.
306      */
307     public function hydrate(ResultSet $rs, $startcol = 1)
308     {
309         try {
310
311             $this->id = $rs->getInt($startcol + 0);
312
313             $this->user_id = $rs->getInt($startcol + 1);
314
315             $this->snippet_id = $rs->getInt($startcol + 2);
316
317             $this->body = $rs->getString($startcol + 3);
318
319             $this->html_body = $rs->getString($startcol + 4);
320
321             $this->created_at = $rs->getTimestamp($startcol + 5, null);
322
323             $this->resetModified();
324
325             $this->setNew(false);
326
327             // FIXME - using NUM_COLUMNS may be clearer.
328             return $startcol + 6; // 6 = SnippetCommentPeer::NUM_COLUMNS - SnippetCommentPeer::NUM_LAZY_LOAD_COLUMNS).
329
330         } catch (Exception $e) {
331             throw new PropelException("Error populating SnippetComment object", $e);
332         }
333     }
334
335     /**
336      * Removes this object from datastore and sets delete attribute.
337      *
338      * @param Connection $con
339      * @return void
340      * @throws PropelException
341      * @see BaseObject::setDeleted()
342      * @see BaseObject::isDeleted()
343      */
344     public function delete($con = null)
345     {
346         if ($this->isDeleted()) {
347             throw new PropelException("This object has already been deleted.");
348         }
349
350         if ($con === null) {
351             $con = Propel::getConnection(SnippetCommentPeer::DATABASE_NAME);
352         }
353
354         try {
355             $con->begin();
356             SnippetCommentPeer::doDelete($this, $con);
357             $this->setDeleted(true);
358             $con->commit();
359         } catch (PropelException $e) {
360             $con->rollback();
361             throw $e;
362         }
363     }
364
365     /**
366      * Stores the object in the database.  If the object is new,
367      * it inserts it; otherwise an update is performed.  This method
368      * wraps the doSave() worker method in a transaction.
369      *
370      * @param Connection $con
371      * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
372      * @throws PropelException
373      * @see doSave()
374      */
375     public function save($con = null)
376     {
377     if ($this->isNew() && !$this->isColumnModified('created_at'))
378     {
379       $this->setCreatedAt(time());
380     }
381
382         if ($this->isDeleted()) {
383             throw new PropelException("You cannot save an object that has been deleted.");
384         }
385
386         if ($con === null) {
387             $con = Propel::getConnection(SnippetCommentPeer::DATABASE_NAME);
388         }
389         
390         try {
391             $con->begin();
392             $affectedRows = $this->doSave($con);
393             $con->commit();
394             return $affectedRows;
395         } catch (PropelException $e) {
396             $con->rollback();
397             throw $e;
398         }
399     }
400
401     /**
402      * Stores the object in the database.
403      *
404      * If the object is new, it inserts it; otherwise an update is performed.
405      * All related objects are also updated in this method.
406      *
407      * @param Connection $con
408      * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
409      * @throws PropelException
410      * @see save()
411      */
412     protected function doSave($con)
413     {
414         $affectedRows = 0; // initialize var to track total num of affected rows   
415         if (!$this->alreadyInSave) {
416             $this->alreadyInSave = true;
417
418
419             // We call the save method on the following object(s) if they
420             // were passed to this object by their coresponding set
421             // method.  This object relates to these object(s) by a
422             // foreign key reference.
423
424             if ($this->aSnippetUser !== null) {
425                 if ($this->aSnippetUser->isModified()) {
426                     $affectedRows += $this->aSnippetUser->save($con);
427                 }
428                 $this->setSnippetUser($this->aSnippetUser);
429             }
430
431             if ($this->aSnippetSnippet !== null) {
432                 if ($this->aSnippetSnippet->isModified()) {
433                     $affectedRows += $this->aSnippetSnippet->save($con);
434                 }
435                 $this->setSnippetSnippet($this->aSnippetSnippet);
436             }
437     
438
439             // If this object has been modified, then save it to the database.
440             if ($this->isModified()) {
441                 if ($this->isNew()) {
442                     $pk = SnippetCommentPeer::doInsert($this, $con);
443                     $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which
444                                          // should always be true here (even though technically
445                                          // BasePeer::doInsert() can insert multiple rows).
446
447                     $this->setId($pk);  //[IMV] update autoincrement primary key
448
449                     $this->setNew(false);
450                 } else {
451                     $affectedRows += SnippetCommentPeer::doUpdate($this, $con);
452                 }
453                 $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
454             }
455
456             $this->alreadyInSave = false;
457         }
458         return $affectedRows;
459     } // doSave()
460
461     /**
462      * Array of ValidationFailed objects.
463      * @var array ValidationFailed[]
464      */
465     protected $validationFailures = array();
466
467     /**
468      * Gets any ValidationFailed objects that resulted from last call to validate().
469      *
470      *
471      * @return array ValidationFailed[]
472      * @see validate()
473      */
474     public function getValidationFailures()
475     {
476         return $this->validationFailures;
477     }
478
479     /**
480      * Validates the objects modified field values and all objects related to this table.
481      *
482      * If $columns is either a column name or an array of column names
483      * only those columns are validated.
484      *
485      * @param mixed $columns Column name or an array of column names.
486      * @return boolean Whether all columns pass validation.
487      * @see doValidate()
488      * @see getValidationFailures()
489      */
490     public function validate($columns = null)
491     {
492         $res = $this->doValidate($columns);
493         if ($res === true) {
494             $this->validationFailures = array();
495             return true;
496         } else {
497             $this->validationFailures = $res;
498             return false;
499         }
500     }
501
502     /**
503      * This function performs the validation work for complex object models.
504      *
505      * In addition to checking the current object, all related objects will
506      * also be validated.  If all pass then <code>true</code> is returned; otherwise
507      * an aggreagated array of ValidationFailed objects will be returned.
508      *
509      * @param array $columns Array of column names to validate.
510      * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
511      */
512     protected function doValidate($columns = null)
513     {
514         if (!$this->alreadyInValidation) {
515             $this->alreadyInValidation = true;
516             $retval = null;
517
518             $failureMap = array();
519
520
521             // We call the validate method on the following object(s) if they
522             // were passed to this object by their coresponding set
523             // method.  This object relates to these object(s) by a
524             // foreign key reference.
525
526             if ($this->aSnippetUser !== null) {
527                 if (!$this->aSnippetUser->validate($columns)) {
528                     $failureMap = array_merge($failureMap, $this->aSnippetUser->getValidationFailures());
529                 }
530             }
531
532             if ($this->aSnippetSnippet !== null) {
533                 if (!$this->aSnippetSnippet->validate($columns)) {
534                     $failureMap = array_merge($failureMap, $this->aSnippetSnippet->getValidationFailures());
535                 }
536             }
537
538
539             if (($retval = SnippetCommentPeer::doValidate($this, $columns)) !== true) {
540                 $failureMap = array_merge($failureMap, $retval);
541             }
542
543
544
545             $this->alreadyInValidation = false;
546         }
547
548         return (!empty($failureMap) ? $failureMap : true);
549     }
550
551     /**
552      * Retrieves a field from the object by name passed in as a string.
553      *
554      * @param string $name name
555      * @param string $type The type of fieldname the $name is of:
556      *                     one of the class type constants TYPE_PHPNAME,
557      *                     TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
558      * @return mixed Value of field.
559      */
560     public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
561     {
562         $pos = SnippetCommentPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
563         return $this->getByPosition($pos);
564     }
565
566     /**
567      * Retrieves a field from the object by Position as specified in the xml schema.
568      * Zero-based.
569      *
570      * @param int $pos position in xml schema
571      * @return mixed Value of field at $pos
572      */
573     public function getByPosition($pos)
574     {
575         switch($pos) {
576             case 0:
577                 return $this->getId();
578                 break;
579             case 1:
580                 return $this->getUserId();
581                 break;
582             case 2:
583                 return $this->getSnippetId();
584                 break;
585             case 3:
586                 return $this->getBody();
587                 break;
588             case 4:
589                 return $this->getHtmlBody();
590                 break;
591             case 5:
592                 return $this->getCreatedAt();
593                 break;
594             default:
595                 return null;
596                 break;
597         } // switch()
598     }
599
600     /**
601      * Exports the object as an array.
602      *
603      * You can specify the key type of the array by passing one of the class
604      * type constants.
605      *
606      * @param string $keyType One of the class type constants TYPE_PHPNAME,
607      *                        TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
608      * @return an associative array containing the field names (as keys) and field values
609      */
610     public function toArray($keyType = BasePeer::TYPE_PHPNAME)
611     {
612         $keys = SnippetCommentPeer::getFieldNames($keyType);
613         $result = array(
614             $keys[0] => $this->getId(),
615             $keys[1] => $this->getUserId(),
616             $keys[2] => $this->getSnippetId(),
617             $keys[3] => $this->getBody(),
618             $keys[4] => $this->getHtmlBody(),
619             $keys[5] => $this->getCreatedAt(),
620         );
621         return $result;
622     }
623
624     /**
625      * Sets a field from the object by name passed in as a string.
626      *
627      * @param string $name peer name
628      * @param mixed $value field value
629      * @param string $type The type of fieldname the $name is of:
630      *                     one of the class type constants TYPE_PHPNAME,
631      *                     TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
632      * @return void
633      */
634     public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
635     {
636         $pos = SnippetCommentPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
637         return $this->setByPosition($pos, $value);
638     }
639
640     /**
641      * Sets a field from the object by Position as specified in the xml schema.
642      * Zero-based.
643      *
644      * @param int $pos position in xml schema
645      * @param mixed $value field value
646      * @return void
647      */
648     public function setByPosition($pos, $value)
649     {
650         switch($pos) {
651             case 0:
652                 $this->setId($value);
653                 break;
654             case 1:
655                 $this->setUserId($value);
656                 break;
657             case 2:
658                 $this->setSnippetId($value);
659                 break;
660             case 3:
661                 $this->setBody($value);
662                 break;
663             case 4:
664                 $this->setHtmlBody($value);
665                 break;
666             case 5:
667                 $this->setCreatedAt($value);
668                 break;
669         } // switch()
670     }
671
672     /**
673      * Populates the object using an array.
674      *
675      * This is particularly useful when populating an object from one of the
676      * request arrays (e.g. $_POST).  This method goes through the column
677      * names, checking to see whether a matching key exists in populated
678      * array. If so the setByName() method is called for that column.
679      *
680      * You can specify the key type of the array by additionally passing one
681      * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME,
682      * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId')
683      *
684      * @param array  $arr     An array to populate the object from.
685      * @param string $keyType The type of keys the array uses.
686      * @return void
687      */
688     public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
689     {
690         $keys = SnippetCommentPeer::getFieldNames($keyType);
691
692         if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
693         if (array_key_exists($keys[1], $arr)) $this->setUserId($arr[$keys[1]]);
694         if (array_key_exists($keys[2], $arr)) $this->setSnippetId($arr[$keys[2]]);
695         if (array_key_exists($keys[3], $arr)) $this->setBody($arr[$keys[3]]);
696         if (array_key_exists($keys[4], $arr)) $this->setHtmlBody($arr[$keys[4]]);
697         if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]);
698     }
699
700     /**
701      * Build a Criteria object containing the values of all modified columns in this object.
702      *
703      * @return Criteria The Criteria object containing all modified values.
704      */
705     public function buildCriteria()
706     {
707         $criteria = new Criteria(SnippetCommentPeer::DATABASE_NAME);
708
709         if ($this->isColumnModified(SnippetCommentPeer::ID)) $criteria->add(SnippetCommentPeer::ID, $this->id);
710         if ($this->isColumnModified(SnippetCommentPeer::USER_ID)) $criteria->add(SnippetCommentPeer::USER_ID, $this->user_id);
711         if ($this->isColumnModified(SnippetCommentPeer::SNIPPET_ID)) $criteria->add(SnippetCommentPeer::SNIPPET_ID, $this->snippet_id);
712         if ($this->isColumnModified(SnippetCommentPeer::BODY)) $criteria->add(SnippetCommentPeer::BODY, $this->body);
713         if ($this->isColumnModified(SnippetCommentPeer::HTML_BODY)) $criteria->add(SnippetCommentPeer::HTML_BODY, $this->html_body);
714         if ($this->isColumnModified(SnippetCommentPeer::CREATED_AT)) $criteria->add(SnippetCommentPeer::CREATED_AT, $this->created_at);
715
716         return $criteria;
717     }
718
719     /**
720      * Builds a Criteria object containing the primary key for this object.
721      *
722      * Unlike buildCriteria() this method includes the primary key values regardless
723      * of whether or not they have been modified.
724      *
725      * @return Criteria The Criteria object containing value(s) for primary key(s).
726      */
727     public function buildPkeyCriteria()
728     {
729         $criteria = new Criteria(SnippetCommentPeer::DATABASE_NAME);
730
731         $criteria->add(SnippetCommentPeer::ID, $this->id);
732
733         return $criteria;
734     }
735
736     /**
737      * Returns the primary key for this object (row).
738      * @return int
739      */
740     public function getPrimaryKey()
741     {
742         return $this->getId();
743     }
744
745     /**
746      * Generic method to set the primary key (id column).
747      *
748      * @param int $key Primary key.
749      * @return void
750      */
751     public function setPrimaryKey($key)
752     {
753         $this->setId($key);
754     }
755
756     /**
757      * Sets contents of passed object to values from current object.
758      *
759      * If desired, this method can also make copies of all associated (fkey referrers)
760      * objects.
761      *
762      * @param object $copyObj An object of SnippetComment (or compatible) type.
763      * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
764      * @throws PropelException
765      */
766     public function copyInto($copyObj, $deepCopy = false)
767     {
768
769         $copyObj->setUserId($this->user_id);
770
771         $copyObj->setSnippetId($this->snippet_id);
772
773         $copyObj->setBody($this->body);
774
775         $copyObj->setHtmlBody($this->html_body);
776
777         $copyObj->setCreatedAt($this->created_at);
778
779
780         $copyObj->setNew(true);
781
782         $copyObj->setId(NULL); // this is a pkey column, so set to default value
783
784     }
785
786     /**
787      * Makes a copy of this object that will be inserted as a new row in table when saved.
788      * It creates a new object filling in the simple attributes, but skipping any primary
789      * keys that are defined for the table.
790      *
791      * If desired, this method can also make copies of all associated (fkey referrers)
792      * objects.
793      *
794      * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
795      * @return SnippetComment Clone of current object.
796      * @throws PropelException
797      */
798     public function copy($deepCopy = false)
799     {
800         // we use get_class(), because this might be a subclass
801         $clazz = get_class($this);
802         $copyObj = new $clazz();
803         $this->copyInto($copyObj, $deepCopy);
804         return $copyObj;
805     }
806
807     /**
808      * Returns a peer instance associated with this om.
809      *
810      * Since Peer classes are not to have any instance attributes, this method returns the
811      * same instance for all member of this class. The method could therefore
812      * be static, but this would prevent one from overriding the behavior.
813      *
814      * @return SnippetCommentPeer
815      */
816     public function getPeer()
817     {
818         if (self::$peer === null) {
819             self::$peer = new SnippetCommentPeer();
820         }
821         return self::$peer;
822     }
823
824     /**
825      * Declares an association between this object and a SnippetUser object.
826      *
827      * @param SnippetUser $v
828      * @return void
829      * @throws PropelException
830      */
831     public function setSnippetUser($v)
832     {
833
834
835         if ($v === null) {
836             $this->setUserId(NULL);
837         } else {
838             $this->setUserId($v->getId());
839         }
840
841
842         $this->aSnippetUser = $v;
843     }
844
845
846     /**
847      * Get the associated SnippetUser object
848      *
849      * @param Connection Optional Connection object.
850      * @return SnippetUser The associated SnippetUser object.
851      * @throws PropelException
852      */
853     public function getSnippetUser($con = null)
854     {
855         // include the related Peer class
856         include_once 'model/om/BaseSnippetUserPeer.php';
857
858         if ($this->aSnippetUser === null && ($this->user_id !== null)) {
859
860             $this->aSnippetUser = SnippetUserPeer::retrieveByPK($this->user_id, $con);
861                     
862             /* The following can be used instead of the line above to
863                guarantee the related object contains a reference
864                to this object, but this level of coupling
865                may be undesirable in many circumstances.
866                As it can lead to a db query with many results that may
867                never be used.
868                $obj = SnippetUserPeer::retrieveByPK($this->user_id, $con);
869                $obj->addSnippetUsers($this);
870              */
871         }
872         return $this->aSnippetUser;
873     }
874
875     /**
876      * Declares an association between this object and a SnippetSnippet object.
877      *
878      * @param SnippetSnippet $v
879      * @return void
880      * @throws PropelException
881      */
882     public function setSnippetSnippet($v)
883     {
884
885
886         if ($v === null) {
887             $this->setSnippetId(NULL);
888         } else {
889             $this->setSnippetId($v->getId());
890         }
891
892
893         $this->aSnippetSnippet = $v;
894     }
895
896
897     /**
898      * Get the associated SnippetSnippet object
899      *
900      * @param Connection Optional Connection object.
901      * @return SnippetSnippet The associated SnippetSnippet object.
902      * @throws PropelException
903      */
904     public function getSnippetSnippet($con = null)
905     {
906         // include the related Peer class
907         include_once 'model/om/BaseSnippetSnippetPeer.php';
908
909         if ($this->aSnippetSnippet === null && ($this->snippet_id !== null)) {
910
911             $this->aSnippetSnippet = SnippetSnippetPeer::retrieveByPK($this->snippet_id, $con);
912                     
913             /* The following can be used instead of the line above to
914                guarantee the related object contains a reference
915                to this object, but this level of coupling
916                may be undesirable in many circumstances.
917                As it can lead to a db query with many results that may
918                never be used.
919                $obj = SnippetSnippetPeer::retrieveByPK($this->snippet_id, $con);
920                $obj->addSnippetSnippets($this);
921              */
922         }
923         return $this->aSnippetSnippet;
924     }
925
926 } // BaseSnippetComment
927
Note: See TracBrowser for help on using the browser.