]> wagnertech.de Git - projects.git/blob - verleihnix/Verleihnix/impl/data/build/classes/propel/om/BaseWerkzeug.php
eclipse-cpp added
[projects.git] / verleihnix / Verleihnix / impl / data / build / classes / propel / om / BaseWerkzeug.php
1 <?php
2
3
4 /**
5  * Base class that represents a row from the 'werkzeug' table.
6  *
7  *
8  *
9  * @package    propel.generator.propel.om
10  */
11 abstract class BaseWerkzeug extends BaseObject implements Persistent
12 {
13     /**
14      * Peer class name
15      */
16     const PEER = 'WerkzeugPeer';
17
18     /**
19      * The Peer class.
20      * Instance provides a convenient way of calling static methods on a class
21      * that calling code may not be able to identify.
22      * @var        WerkzeugPeer
23      */
24     protected static $peer;
25
26     /**
27      * The flag var to prevent infinite loop in deep copy
28      * @var       boolean
29      */
30     protected $startCopy = false;
31
32     /**
33      * The value for the id field.
34      * @var        int
35      */
36     protected $id;
37
38     /**
39      * The value for the mod field.
40      * @var        int
41      */
42     protected $mod;
43
44     /**
45      * The value for the typ field.
46      * @var        string
47      */
48     protected $typ;
49
50     /**
51      * The value for the beschreibung field.
52      * @var        string
53      */
54     protected $beschreibung;
55
56     /**
57      * The value for the eigentumer field.
58      * @var        string
59      */
60     protected $eigentumer;
61
62     /**
63      * The value for the zz_bei field.
64      * @var        string
65      */
66     protected $zz_bei;
67
68     /**
69      * Flag to prevent endless save loop, if this object is referenced
70      * by another object which falls in this transaction.
71      * @var        boolean
72      */
73     protected $alreadyInSave = false;
74
75     /**
76      * Flag to prevent endless validation loop, if this object is referenced
77      * by another object which falls in this transaction.
78      * @var        boolean
79      */
80     protected $alreadyInValidation = false;
81
82     /**
83      * Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
84      * @var        boolean
85      */
86     protected $alreadyInClearAllReferencesDeep = false;
87
88     /**
89      * Get the [id] column value.
90      *
91      * @return int
92      */
93     public function getId()
94     {
95
96         return $this->id;
97     }
98
99     /**
100      * Get the [mod] column value.
101      *
102      * @return int
103      */
104     public function getMod()
105     {
106
107         return $this->mod;
108     }
109
110     /**
111      * Get the [typ] column value.
112      *
113      * @return string
114      */
115     public function getTyp()
116     {
117
118         return $this->typ;
119     }
120
121     /**
122      * Get the [beschreibung] column value.
123      *
124      * @return string
125      */
126     public function getBeschreibung()
127     {
128
129         return $this->beschreibung;
130     }
131
132     /**
133      * Get the [eigentumer] column value.
134      *
135      * @return string
136      */
137     public function getEigentumer()
138     {
139
140         return $this->eigentumer;
141     }
142
143     /**
144      * Get the [zz_bei] column value.
145      *
146      * @return string
147      */
148     public function getZzBei()
149     {
150
151         return $this->zz_bei;
152     }
153
154     /**
155      * Set the value of [id] column.
156      *
157      * @param  int $v new value
158      * @return Werkzeug The current object (for fluent API support)
159      */
160     public function setId($v)
161     {
162         if ($v !== null && is_numeric($v)) {
163             $v = (int) $v;
164         }
165
166         if ($this->id !== $v) {
167             $this->id = $v;
168             $this->modifiedColumns[] = WerkzeugPeer::ID;
169         }
170
171
172         return $this;
173     } // setId()
174
175     /**
176      * Set the value of [mod] column.
177      *
178      * @param  int $v new value
179      * @return Werkzeug The current object (for fluent API support)
180      */
181     public function setMod($v)
182     {
183         if ($v !== null && is_numeric($v)) {
184             $v = (int) $v;
185         }
186
187         if ($this->mod !== $v) {
188             $this->mod = $v;
189             $this->modifiedColumns[] = WerkzeugPeer::MOD;
190         }
191
192
193         return $this;
194     } // setMod()
195
196     /**
197      * Set the value of [typ] column.
198      *
199      * @param  string $v new value
200      * @return Werkzeug The current object (for fluent API support)
201      */
202     public function setTyp($v)
203     {
204         if ($v !== null) {
205             $v = (string) $v;
206         }
207
208         if ($this->typ !== $v) {
209             $this->typ = $v;
210             $this->modifiedColumns[] = WerkzeugPeer::TYP;
211         }
212
213
214         return $this;
215     } // setTyp()
216
217     /**
218      * Set the value of [beschreibung] column.
219      *
220      * @param  string $v new value
221      * @return Werkzeug The current object (for fluent API support)
222      */
223     public function setBeschreibung($v)
224     {
225         if ($v !== null) {
226             $v = (string) $v;
227         }
228
229         if ($this->beschreibung !== $v) {
230             $this->beschreibung = $v;
231             $this->modifiedColumns[] = WerkzeugPeer::BESCHREIBUNG;
232         }
233
234
235         return $this;
236     } // setBeschreibung()
237
238     /**
239      * Set the value of [eigentumer] column.
240      *
241      * @param  string $v new value
242      * @return Werkzeug The current object (for fluent API support)
243      */
244     public function setEigentumer($v)
245     {
246         if ($v !== null) {
247             $v = (string) $v;
248         }
249
250         if ($this->eigentumer !== $v) {
251             $this->eigentumer = $v;
252             $this->modifiedColumns[] = WerkzeugPeer::EIGENTUMER;
253         }
254
255
256         return $this;
257     } // setEigentumer()
258
259     /**
260      * Set the value of [zz_bei] column.
261      *
262      * @param  string $v new value
263      * @return Werkzeug The current object (for fluent API support)
264      */
265     public function setZzBei($v)
266     {
267         if ($v !== null) {
268             $v = (string) $v;
269         }
270
271         if ($this->zz_bei !== $v) {
272             $this->zz_bei = $v;
273             $this->modifiedColumns[] = WerkzeugPeer::ZZ_BEI;
274         }
275
276
277         return $this;
278     } // setZzBei()
279
280     /**
281      * Indicates whether the columns in this object are only set to default values.
282      *
283      * This method can be used in conjunction with isModified() to indicate whether an object is both
284      * modified _and_ has some values set which are non-default.
285      *
286      * @return boolean Whether the columns in this object are only been set with default values.
287      */
288     public function hasOnlyDefaultValues()
289     {
290         // otherwise, everything was equal, so return true
291         return true;
292     } // hasOnlyDefaultValues()
293
294     /**
295      * Hydrates (populates) the object variables with values from the database resultset.
296      *
297      * An offset (0-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 array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
303      * @param int $startcol 0-based offset column which indicates which resultset column to start with.
304      * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
305      * @return int             next starting column
306      * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
307      */
308     public function hydrate($row, $startcol = 0, $rehydrate = false)
309     {
310         try {
311
312             $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
313             $this->mod = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
314             $this->typ = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
315             $this->beschreibung = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
316             $this->eigentumer = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
317             $this->zz_bei = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
318             $this->resetModified();
319
320             $this->setNew(false);
321
322             if ($rehydrate) {
323                 $this->ensureConsistency();
324             }
325             $this->postHydrate($row, $startcol, $rehydrate);
326
327             return $startcol + 6; // 6 = WerkzeugPeer::NUM_HYDRATE_COLUMNS.
328
329         } catch (Exception $e) {
330             throw new PropelException("Error populating Werkzeug object", $e);
331         }
332     }
333
334     /**
335      * Checks and repairs the internal consistency of the object.
336      *
337      * This method is executed after an already-instantiated object is re-hydrated
338      * from the database.  It exists to check any foreign keys to make sure that
339      * the objects related to the current object are correct based on foreign key.
340      *
341      * You can override this method in the stub class, but you should always invoke
342      * the base method from the overridden method (i.e. parent::ensureConsistency()),
343      * in case your model changes.
344      *
345      * @throws PropelException
346      */
347     public function ensureConsistency()
348     {
349
350     } // ensureConsistency
351
352     /**
353      * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
354      *
355      * This will only work if the object has been saved and has a valid primary key set.
356      *
357      * @param boolean $deep (optional) Whether to also de-associated any related objects.
358      * @param PropelPDO $con (optional) The PropelPDO connection to use.
359      * @return void
360      * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
361      */
362     public function reload($deep = false, PropelPDO $con = null)
363     {
364         if ($this->isDeleted()) {
365             throw new PropelException("Cannot reload a deleted object.");
366         }
367
368         if ($this->isNew()) {
369             throw new PropelException("Cannot reload an unsaved object.");
370         }
371
372         if ($con === null) {
373             $con = Propel::getConnection(WerkzeugPeer::DATABASE_NAME, Propel::CONNECTION_READ);
374         }
375
376         // We don't need to alter the object instance pool; we're just modifying this instance
377         // already in the pool.
378
379         $stmt = WerkzeugPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
380         $row = $stmt->fetch(PDO::FETCH_NUM);
381         $stmt->closeCursor();
382         if (!$row) {
383             throw new PropelException('Cannot find matching row in the database to reload object values.');
384         }
385         $this->hydrate($row, 0, true); // rehydrate
386
387         if ($deep) {  // also de-associate any related objects?
388
389         } // if (deep)
390     }
391
392     /**
393      * Removes this object from datastore and sets delete attribute.
394      *
395      * @param PropelPDO $con
396      * @return void
397      * @throws PropelException
398      * @throws Exception
399      * @see        BaseObject::setDeleted()
400      * @see        BaseObject::isDeleted()
401      */
402     public function delete(PropelPDO $con = null)
403     {
404         if ($this->isDeleted()) {
405             throw new PropelException("This object has already been deleted.");
406         }
407
408         if ($con === null) {
409             $con = Propel::getConnection(WerkzeugPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
410         }
411
412         $con->beginTransaction();
413         try {
414             $deleteQuery = WerkzeugQuery::create()
415                 ->filterByPrimaryKey($this->getPrimaryKey());
416             $ret = $this->preDelete($con);
417             if ($ret) {
418                 $deleteQuery->delete($con);
419                 $this->postDelete($con);
420                 $con->commit();
421                 $this->setDeleted(true);
422             } else {
423                 $con->commit();
424             }
425         } catch (Exception $e) {
426             $con->rollBack();
427             throw $e;
428         }
429     }
430
431     /**
432      * Persists this object to the database.
433      *
434      * If the object is new, it inserts it; otherwise an update is performed.
435      * All modified related objects will also be persisted in the doSave()
436      * method.  This method wraps all precipitate database operations in a
437      * single transaction.
438      *
439      * @param PropelPDO $con
440      * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
441      * @throws PropelException
442      * @throws Exception
443      * @see        doSave()
444      */
445     public function save(PropelPDO $con = null)
446     {
447         if ($this->isDeleted()) {
448             throw new PropelException("You cannot save an object that has been deleted.");
449         }
450
451         if ($con === null) {
452             $con = Propel::getConnection(WerkzeugPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
453         }
454
455         $con->beginTransaction();
456         $isInsert = $this->isNew();
457         try {
458             $ret = $this->preSave($con);
459             if ($isInsert) {
460                 $ret = $ret && $this->preInsert($con);
461             } else {
462                 $ret = $ret && $this->preUpdate($con);
463             }
464             if ($ret) {
465                 $affectedRows = $this->doSave($con);
466                 if ($isInsert) {
467                     $this->postInsert($con);
468                 } else {
469                     $this->postUpdate($con);
470                 }
471                 $this->postSave($con);
472                 WerkzeugPeer::addInstanceToPool($this);
473             } else {
474                 $affectedRows = 0;
475             }
476             $con->commit();
477
478             return $affectedRows;
479         } catch (Exception $e) {
480             $con->rollBack();
481             throw $e;
482         }
483     }
484
485     /**
486      * Performs the work of inserting or updating the row in the database.
487      *
488      * If the object is new, it inserts it; otherwise an update is performed.
489      * All related objects are also updated in this method.
490      *
491      * @param PropelPDO $con
492      * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
493      * @throws PropelException
494      * @see        save()
495      */
496     protected function doSave(PropelPDO $con)
497     {
498         $affectedRows = 0; // initialize var to track total num of affected rows
499         if (!$this->alreadyInSave) {
500             $this->alreadyInSave = true;
501
502             if ($this->isNew() || $this->isModified()) {
503                 // persist changes
504                 if ($this->isNew()) {
505                     $this->doInsert($con);
506                 } else {
507                     $this->doUpdate($con);
508                 }
509                 $affectedRows += 1;
510                 $this->resetModified();
511             }
512
513             $this->alreadyInSave = false;
514
515         }
516
517         return $affectedRows;
518     } // doSave()
519
520     /**
521      * Insert the row in the database.
522      *
523      * @param PropelPDO $con
524      *
525      * @throws PropelException
526      * @see        doSave()
527      */
528     protected function doInsert(PropelPDO $con)
529     {
530         $modifiedColumns = array();
531         $index = 0;
532
533         $this->modifiedColumns[] = WerkzeugPeer::ID;
534         if (null !== $this->id) {
535             throw new PropelException('Cannot insert a value for auto-increment primary key (' . WerkzeugPeer::ID . ')');
536         }
537
538          // check the columns in natural order for more readable SQL queries
539         if ($this->isColumnModified(WerkzeugPeer::ID)) {
540             $modifiedColumns[':p' . $index++]  = '`id`';
541         }
542         if ($this->isColumnModified(WerkzeugPeer::MOD)) {
543             $modifiedColumns[':p' . $index++]  = '`mod`';
544         }
545         if ($this->isColumnModified(WerkzeugPeer::TYP)) {
546             $modifiedColumns[':p' . $index++]  = '`typ`';
547         }
548         if ($this->isColumnModified(WerkzeugPeer::BESCHREIBUNG)) {
549             $modifiedColumns[':p' . $index++]  = '`beschreibung`';
550         }
551         if ($this->isColumnModified(WerkzeugPeer::EIGENTUMER)) {
552             $modifiedColumns[':p' . $index++]  = '`eigentumer`';
553         }
554         if ($this->isColumnModified(WerkzeugPeer::ZZ_BEI)) {
555             $modifiedColumns[':p' . $index++]  = '`zz_bei`';
556         }
557
558         $sql = sprintf(
559             'INSERT INTO `werkzeug` (%s) VALUES (%s)',
560             implode(', ', $modifiedColumns),
561             implode(', ', array_keys($modifiedColumns))
562         );
563
564         try {
565             $stmt = $con->prepare($sql);
566             foreach ($modifiedColumns as $identifier => $columnName) {
567                 switch ($columnName) {
568                     case '`id`':
569                         $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
570                         break;
571                     case '`mod`':
572                         $stmt->bindValue($identifier, $this->mod, PDO::PARAM_INT);
573                         break;
574                     case '`typ`':
575                         $stmt->bindValue($identifier, $this->typ, PDO::PARAM_STR);
576                         break;
577                     case '`beschreibung`':
578                         $stmt->bindValue($identifier, $this->beschreibung, PDO::PARAM_STR);
579                         break;
580                     case '`eigentumer`':
581                         $stmt->bindValue($identifier, $this->eigentumer, PDO::PARAM_STR);
582                         break;
583                     case '`zz_bei`':
584                         $stmt->bindValue($identifier, $this->zz_bei, PDO::PARAM_STR);
585                         break;
586                 }
587             }
588             $stmt->execute();
589         } catch (Exception $e) {
590             Propel::log($e->getMessage(), Propel::LOG_ERR);
591             throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
592         }
593
594         try {
595             $pk = $con->lastInsertId();
596         } catch (Exception $e) {
597             throw new PropelException('Unable to get autoincrement id.', $e);
598         }
599         $this->setId($pk);
600
601         $this->setNew(false);
602     }
603
604     /**
605      * Update the row in the database.
606      *
607      * @param PropelPDO $con
608      *
609      * @see        doSave()
610      */
611     protected function doUpdate(PropelPDO $con)
612     {
613         $selectCriteria = $this->buildPkeyCriteria();
614         $valuesCriteria = $this->buildCriteria();
615         BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
616     }
617
618     /**
619      * Array of ValidationFailed objects.
620      * @var        array ValidationFailed[]
621      */
622     protected $validationFailures = array();
623
624     /**
625      * Gets any ValidationFailed objects that resulted from last call to validate().
626      *
627      *
628      * @return array ValidationFailed[]
629      * @see        validate()
630      */
631     public function getValidationFailures()
632     {
633         return $this->validationFailures;
634     }
635
636     /**
637      * Validates the objects modified field values and all objects related to this table.
638      *
639      * If $columns is either a column name or an array of column names
640      * only those columns are validated.
641      *
642      * @param mixed $columns Column name or an array of column names.
643      * @return boolean Whether all columns pass validation.
644      * @see        doValidate()
645      * @see        getValidationFailures()
646      */
647     public function validate($columns = null)
648     {
649         $res = $this->doValidate($columns);
650         if ($res === true) {
651             $this->validationFailures = array();
652
653             return true;
654         }
655
656         $this->validationFailures = $res;
657
658         return false;
659     }
660
661     /**
662      * This function performs the validation work for complex object models.
663      *
664      * In addition to checking the current object, all related objects will
665      * also be validated.  If all pass then <code>true</code> is returned; otherwise
666      * an aggregated array of ValidationFailed objects will be returned.
667      *
668      * @param array $columns Array of column names to validate.
669      * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objects otherwise.
670      */
671     protected function doValidate($columns = null)
672     {
673         if (!$this->alreadyInValidation) {
674             $this->alreadyInValidation = true;
675             $retval = null;
676
677             $failureMap = array();
678
679
680             if (($retval = WerkzeugPeer::doValidate($this, $columns)) !== true) {
681                 $failureMap = array_merge($failureMap, $retval);
682             }
683
684
685
686             $this->alreadyInValidation = false;
687         }
688
689         return (!empty($failureMap) ? $failureMap : true);
690     }
691
692     /**
693      * Retrieves a field from the object by name passed in as a string.
694      *
695      * @param string $name name
696      * @param string $type The type of fieldname the $name is of:
697      *               one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
698      *               BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
699      *               Defaults to BasePeer::TYPE_PHPNAME
700      * @return mixed Value of field.
701      */
702     public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
703     {
704         $pos = WerkzeugPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
705         $field = $this->getByPosition($pos);
706
707         return $field;
708     }
709
710     /**
711      * Retrieves a field from the object by Position as specified in the xml schema.
712      * Zero-based.
713      *
714      * @param int $pos position in xml schema
715      * @return mixed Value of field at $pos
716      */
717     public function getByPosition($pos)
718     {
719         switch ($pos) {
720             case 0:
721                 return $this->getId();
722                 break;
723             case 1:
724                 return $this->getMod();
725                 break;
726             case 2:
727                 return $this->getTyp();
728                 break;
729             case 3:
730                 return $this->getBeschreibung();
731                 break;
732             case 4:
733                 return $this->getEigentumer();
734                 break;
735             case 5:
736                 return $this->getZzBei();
737                 break;
738             default:
739                 return null;
740                 break;
741         } // switch()
742     }
743
744     /**
745      * Exports the object as an array.
746      *
747      * You can specify the key type of the array by passing one of the class
748      * type constants.
749      *
750      * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
751      *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
752      *                    Defaults to BasePeer::TYPE_PHPNAME.
753      * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
754      * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
755      *
756      * @return array an associative array containing the field names (as keys) and field values
757      */
758     public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array())
759     {
760         if (isset($alreadyDumpedObjects['Werkzeug'][$this->getPrimaryKey()])) {
761             return '*RECURSION*';
762         }
763         $alreadyDumpedObjects['Werkzeug'][$this->getPrimaryKey()] = true;
764         $keys = WerkzeugPeer::getFieldNames($keyType);
765         $result = array(
766             $keys[0] => $this->getId(),
767             $keys[1] => $this->getMod(),
768             $keys[2] => $this->getTyp(),
769             $keys[3] => $this->getBeschreibung(),
770             $keys[4] => $this->getEigentumer(),
771             $keys[5] => $this->getZzBei(),
772         );
773         $virtualColumns = $this->virtualColumns;
774         foreach ($virtualColumns as $key => $virtualColumn) {
775             $result[$key] = $virtualColumn;
776         }
777
778
779         return $result;
780     }
781
782     /**
783      * Sets a field from the object by name passed in as a string.
784      *
785      * @param string $name peer name
786      * @param mixed $value field value
787      * @param string $type The type of fieldname the $name is of:
788      *                     one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
789      *                     BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
790      *                     Defaults to BasePeer::TYPE_PHPNAME
791      * @return void
792      */
793     public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
794     {
795         $pos = WerkzeugPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
796
797         $this->setByPosition($pos, $value);
798     }
799
800     /**
801      * Sets a field from the object by Position as specified in the xml schema.
802      * Zero-based.
803      *
804      * @param int $pos position in xml schema
805      * @param mixed $value field value
806      * @return void
807      */
808     public function setByPosition($pos, $value)
809     {
810         switch ($pos) {
811             case 0:
812                 $this->setId($value);
813                 break;
814             case 1:
815                 $this->setMod($value);
816                 break;
817             case 2:
818                 $this->setTyp($value);
819                 break;
820             case 3:
821                 $this->setBeschreibung($value);
822                 break;
823             case 4:
824                 $this->setEigentumer($value);
825                 break;
826             case 5:
827                 $this->setZzBei($value);
828                 break;
829         } // switch()
830     }
831
832     /**
833      * Populates the object using an array.
834      *
835      * This is particularly useful when populating an object from one of the
836      * request arrays (e.g. $_POST).  This method goes through the column
837      * names, checking to see whether a matching key exists in populated
838      * array. If so the setByName() method is called for that column.
839      *
840      * You can specify the key type of the array by additionally passing one
841      * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
842      * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
843      * The default key type is the column's BasePeer::TYPE_PHPNAME
844      *
845      * @param array  $arr     An array to populate the object from.
846      * @param string $keyType The type of keys the array uses.
847      * @return void
848      */
849     public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
850     {
851         $keys = WerkzeugPeer::getFieldNames($keyType);
852
853         if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
854         if (array_key_exists($keys[1], $arr)) $this->setMod($arr[$keys[1]]);
855         if (array_key_exists($keys[2], $arr)) $this->setTyp($arr[$keys[2]]);
856         if (array_key_exists($keys[3], $arr)) $this->setBeschreibung($arr[$keys[3]]);
857         if (array_key_exists($keys[4], $arr)) $this->setEigentumer($arr[$keys[4]]);
858         if (array_key_exists($keys[5], $arr)) $this->setZzBei($arr[$keys[5]]);
859     }
860
861     /**
862      * Build a Criteria object containing the values of all modified columns in this object.
863      *
864      * @return Criteria The Criteria object containing all modified values.
865      */
866     public function buildCriteria()
867     {
868         $criteria = new Criteria(WerkzeugPeer::DATABASE_NAME);
869
870         if ($this->isColumnModified(WerkzeugPeer::ID)) $criteria->add(WerkzeugPeer::ID, $this->id);
871         if ($this->isColumnModified(WerkzeugPeer::MOD)) $criteria->add(WerkzeugPeer::MOD, $this->mod);
872         if ($this->isColumnModified(WerkzeugPeer::TYP)) $criteria->add(WerkzeugPeer::TYP, $this->typ);
873         if ($this->isColumnModified(WerkzeugPeer::BESCHREIBUNG)) $criteria->add(WerkzeugPeer::BESCHREIBUNG, $this->beschreibung);
874         if ($this->isColumnModified(WerkzeugPeer::EIGENTUMER)) $criteria->add(WerkzeugPeer::EIGENTUMER, $this->eigentumer);
875         if ($this->isColumnModified(WerkzeugPeer::ZZ_BEI)) $criteria->add(WerkzeugPeer::ZZ_BEI, $this->zz_bei);
876
877         return $criteria;
878     }
879
880     /**
881      * Builds a Criteria object containing the primary key for this object.
882      *
883      * Unlike buildCriteria() this method includes the primary key values regardless
884      * of whether or not they have been modified.
885      *
886      * @return Criteria The Criteria object containing value(s) for primary key(s).
887      */
888     public function buildPkeyCriteria()
889     {
890         $criteria = new Criteria(WerkzeugPeer::DATABASE_NAME);
891         $criteria->add(WerkzeugPeer::ID, $this->id);
892
893         return $criteria;
894     }
895
896     /**
897      * Returns the primary key for this object (row).
898      * @return int
899      */
900     public function getPrimaryKey()
901     {
902         return $this->getId();
903     }
904
905     /**
906      * Generic method to set the primary key (id column).
907      *
908      * @param  int $key Primary key.
909      * @return void
910      */
911     public function setPrimaryKey($key)
912     {
913         $this->setId($key);
914     }
915
916     /**
917      * Returns true if the primary key for this object is null.
918      * @return boolean
919      */
920     public function isPrimaryKeyNull()
921     {
922
923         return null === $this->getId();
924     }
925
926     /**
927      * Sets contents of passed object to values from current object.
928      *
929      * If desired, this method can also make copies of all associated (fkey referrers)
930      * objects.
931      *
932      * @param object $copyObj An object of Werkzeug (or compatible) type.
933      * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
934      * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
935      * @throws PropelException
936      */
937     public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
938     {
939         $copyObj->setMod($this->getMod());
940         $copyObj->setTyp($this->getTyp());
941         $copyObj->setBeschreibung($this->getBeschreibung());
942         $copyObj->setEigentumer($this->getEigentumer());
943         $copyObj->setZzBei($this->getZzBei());
944         if ($makeNew) {
945             $copyObj->setNew(true);
946             $copyObj->setId(NULL); // this is a auto-increment column, so set to default value
947         }
948     }
949
950     /**
951      * Makes a copy of this object that will be inserted as a new row in table when saved.
952      * It creates a new object filling in the simple attributes, but skipping any primary
953      * keys that are defined for the table.
954      *
955      * If desired, this method can also make copies of all associated (fkey referrers)
956      * objects.
957      *
958      * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
959      * @return Werkzeug Clone of current object.
960      * @throws PropelException
961      */
962     public function copy($deepCopy = false)
963     {
964         // we use get_class(), because this might be a subclass
965         $clazz = get_class($this);
966         $copyObj = new $clazz();
967         $this->copyInto($copyObj, $deepCopy);
968
969         return $copyObj;
970     }
971
972     /**
973      * Returns a peer instance associated with this om.
974      *
975      * Since Peer classes are not to have any instance attributes, this method returns the
976      * same instance for all member of this class. The method could therefore
977      * be static, but this would prevent one from overriding the behavior.
978      *
979      * @return WerkzeugPeer
980      */
981     public function getPeer()
982     {
983         if (self::$peer === null) {
984             self::$peer = new WerkzeugPeer();
985         }
986
987         return self::$peer;
988     }
989
990     /**
991      * Clears the current object and sets all attributes to their default values
992      */
993     public function clear()
994     {
995         $this->id = null;
996         $this->mod = null;
997         $this->typ = null;
998         $this->beschreibung = null;
999         $this->eigentumer = null;
1000         $this->zz_bei = null;
1001         $this->alreadyInSave = false;
1002         $this->alreadyInValidation = false;
1003         $this->alreadyInClearAllReferencesDeep = false;
1004         $this->clearAllReferences();
1005         $this->resetModified();
1006         $this->setNew(true);
1007         $this->setDeleted(false);
1008     }
1009
1010     /**
1011      * Resets all references to other model objects or collections of model objects.
1012      *
1013      * This method is a user-space workaround for PHP's inability to garbage collect
1014      * objects with circular references (even in PHP 5.3). This is currently necessary
1015      * when using Propel in certain daemon or large-volume/high-memory operations.
1016      *
1017      * @param boolean $deep Whether to also clear the references on all referrer objects.
1018      */
1019     public function clearAllReferences($deep = false)
1020     {
1021         if ($deep && !$this->alreadyInClearAllReferencesDeep) {
1022             $this->alreadyInClearAllReferencesDeep = true;
1023
1024             $this->alreadyInClearAllReferencesDeep = false;
1025         } // if ($deep)
1026
1027     }
1028
1029     /**
1030      * return the string representation of this object
1031      *
1032      * @return string
1033      */
1034     public function __toString()
1035     {
1036         return (string) $this->exportTo(WerkzeugPeer::DEFAULT_STRING_FORMAT);
1037     }
1038
1039     /**
1040      * return true is the object is in saving state
1041      *
1042      * @return boolean
1043      */
1044     public function isAlreadyInSave()
1045     {
1046         return $this->alreadyInSave;
1047     }
1048
1049 }