This file is indexed.

/usr/share/php/propel/map/RelationMap.php is in php-propel-runtime 1.6.9-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
<?php

/**
 * This file is part of the Propel package.
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @license    MIT License
 */

/**
 * RelationMap is used to model a database relationship.
 *
 * GENERAL NOTE
 * ------------
 * The propel.map classes are abstract building-block classes for modeling
 * the database at runtime.  These classes are similar (a lite version) to the
 * propel.engine.database.model classes, which are build-time modeling classes.
 * These classes in themselves do not do any database metadata lookups.
 *
 * @author     Francois Zaninotto
 * @version    $Revision$
 * @package    propel.runtime.map
 */
class RelationMap
{

  const
    // types
    MANY_TO_ONE = 1,
    ONE_TO_MANY = 2,
    ONE_TO_ONE = 3,
    MANY_TO_MANY = 4,
    // representations
    LOCAL_TO_FOREIGN = 0,
    LEFT_TO_RIGHT = 1;

  protected
    $name,
    $pluralName,
    $type,
    $localTable,
    $foreignTable,
    $localColumns = array(),
    $foreignColumns = array(),
    $onUpdate, $onDelete;

  /**
   * Constructor.
   *
   * @param      string $name Name of the relation.
   * @param      string $pluralName Plural Name of the relation.
   *                                Defaults to the Name of the relation concatenated with 's'.
   */
  public function __construct($name)
  {
    $this->name = $name;
  }

  /**
   * Get the name of this relation.
   *
   * @return     string The name of the relation.
   */
  public function getName()
  {
    return $this->name;
  }

  public function setPluralName($pluralName)
  {
    $this->pluralName = $pluralName;
  }

  /**
   * Get the plural name of this relation.
   *
   * @return     string The plural name of the relation.
   */
  public function getPluralName()
  {
    return null !== $this->pluralName ? $this->pluralName : ($this->name . 's');
  }

  /**
   * Set the type
   *
   * @param      integer $type The relation type (either self::MANY_TO_ONE, self::ONE_TO_MANY, or self::ONE_TO_ONE)
   */
  public function setType($type)
  {
    $this->type = $type;
  }

  /**
   * Get the type
   *
   * @return      integer the relation type
   */
  public function getType()
  {
    return $this->type;
  }

  /**
   * Set the local table
   *
   * @param      TableMap $table The local table for this relationship
   */
  public function setLocalTable($table)
  {
    $this->localTable = $table;
  }

  /**
   * Get the local table
   *
   * @return      TableMap The local table for this relationship
   */
  public function getLocalTable()
  {
    return $this->localTable;
  }

  /**
   * Set the foreign table
   *
   * @param      TableMap $table The foreign table for this relationship
   */
  public function setForeignTable($table)
  {
    $this->foreignTable = $table;
  }

  /**
   * Get the foreign table
   *
   * @return    TableMap The foreign table for this relationship
   */
  public function getForeignTable()
  {
    return $this->foreignTable;
  }

  /**
   * Get the left table of the relation
   *
   * @return    TableMap The left table for this relationship
   */
  public function getLeftTable()
  {
      return ($this->getType() == RelationMap::MANY_TO_ONE) ? $this->getLocalTable() : $this->getForeignTable();
  }

  /**
   * Get the right table of the relation
   *
   * @return    TableMap The right table for this relationship
   */
  public function getRightTable()
  {
      return ($this->getType() == RelationMap::MANY_TO_ONE) ? $this->getForeignTable() : $this->getLocalTable();
  }

  /**
   * Add a column mapping
   *
   * @param   ColumnMap $local The local column
   * @param   ColumnMap $foreign The foreign column
   */
  public function addColumnMapping(ColumnMap $local, ColumnMap $foreign)
  {
    $this->localColumns[] = $local;
    $this->foreignColumns[] = $foreign;
  }

    /**
     * Get an associative array mapping local column names to foreign column names
     * The arrangement of the returned array depends on the $direction parameter:
     *  - If the value is RelationMap::LOCAL_TO_FOREIGN, then the returned array is local => foreign
     *  - If the value is RelationMap::LEFT_TO_RIGHT, then the returned array is left => right
     *
     * @param  int   $direction How the associative array must return columns
     * @return Array Associative array (local => foreign) of fully qualified column names
     */
    public function getColumnMappings($direction = RelationMap::LOCAL_TO_FOREIGN)
    {
        $h = array();
        if ($direction == RelationMap::LEFT_TO_RIGHT && $this->getType() == RelationMap::MANY_TO_ONE) {
                $direction = RelationMap::LOCAL_TO_FOREIGN;
        }
        for ($i=0, $size=count($this->localColumns); $i < $size; $i++) {
            if ($direction == RelationMap::LOCAL_TO_FOREIGN) {
                $h[$this->localColumns[$i]->getFullyQualifiedName()] = $this->foreignColumns[$i]->getFullyQualifiedName();
            } else {
                $h[$this->foreignColumns[$i]->getFullyQualifiedName()] = $this->localColumns[$i]->getFullyQualifiedName();
            }
        }

        return $h;
    }

    /**
     * Returns true if the relation has more than one column mapping
     *
     * @return boolean
     */
    public function isComposite()
    {
        return $this->countColumnMappings() > 1;
    }

    /**
     * Return the number of column mappings
     *
     * @return int
     */
    public function countColumnMappings()
    {
        return count($this->localColumns);
    }

  /**
   * Get the local columns
   *
   * @return      Array list of ColumnMap objects
   */
  public function getLocalColumns()
  {
    return $this->localColumns;
  }

  /**
   * Get the foreign columns
   *
   * @return      Array list of ColumnMap objects
   */
  public function getForeignColumns()
  {
    return $this->foreignColumns;
  }

    /**
   * Get the left columns of the relation
   *
   * @return    array of ColumnMap objects
   */
  public function getLeftColumns()
  {
      return ($this->getType() == RelationMap::MANY_TO_ONE) ? $this->getLocalColumns() : $this->getForeignColumns();
  }

  /**
   * Get the right columns of the relation
   *
   * @return    array of ColumnMap objects
   */
  public function getRightColumns()
  {
      return ($this->getType() == RelationMap::MANY_TO_ONE) ? $this->getForeignColumns() : $this->getLocalColumns();
  }

  /**
   * Set the onUpdate behavior
   *
   * @param      string $onUpdate
   */
  public function setOnUpdate($onUpdate)
  {
    $this->onUpdate = $onUpdate;
  }

  /**
   * Get the onUpdate behavior
   *
   * @return      integer the relation type
   */
  public function getOnUpdate()
  {
    return $this->onUpdate;
  }

  /**
   * Set the onDelete behavior
   *
   * @param      string $onDelete
   */
  public function setOnDelete($onDelete)
  {
    $this->onDelete = $onDelete;
  }

  /**
   * Get the onDelete behavior
   *
   * @return      integer the relation type
   */
  public function getOnDelete()
  {
    return $this->onDelete;
  }

  /**
   * Gets the symmetrical relation
   *
   * @return    RelationMap
   *
   * @throws PropelException
   */
  public function getSymmetricalRelation()
  {
      $localMapping = array($this->getLeftColumns(), $this->getRightColumns());
      foreach ($this->getRightTable()->getRelations() as $relation) {
          if ($localMapping == array($relation->getRightColumns(), $relation->getLeftColumns())) {
              return $relation;
          }
      }

      throw new PropelException('The relation could not be resolved.');
  }
}