Completed
Push — development ( 227e3a...98bb7e )
by Andrij
14:37
created

PageLinkProductsTableMap::addSelectColumns()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 7

Duplication

Lines 10
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 7
c 1
b 0
f 0
nc 2
nop 2
dl 10
loc 10
rs 9.4285
1
<?php
2
3
namespace mod_link\models\Map;
4
5
use Propel\Runtime\Propel;
6
use Propel\Runtime\ActiveQuery\Criteria;
7
use Propel\Runtime\ActiveQuery\InstancePoolTrait;
8
use Propel\Runtime\Connection\ConnectionInterface;
9
use Propel\Runtime\DataFetcher\DataFetcherInterface;
10
use Propel\Runtime\Exception\PropelException;
11
use Propel\Runtime\Map\RelationMap;
12
use Propel\Runtime\Map\TableMap;
13
use Propel\Runtime\Map\TableMapTrait;
14
use mod_link\models\PageLinkProducts;
15
use mod_link\models\PageLinkProductsQuery;
16
17
18
/**
19
 * This class defines the structure of the 'page_link_products' table.
20
 *
21
 *
22
 *
23
 * This map class is used by Propel to do runtime db structure discovery.
0 ignored issues
show
introduced by
There must be exactly one blank line between descriptions in a doc comment
Loading history...
24
 * For example, the createSelectSql() method checks the type of a given column used in an
25
 * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
26
 * (i.e. if it's a text column type).
27
 *
28
 */
0 ignored issues
show
introduced by
Additional blank lines found at end of doc comment
Loading history...
29 View Code Duplication
class PageLinkProductsTableMap extends TableMap
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
30
{
0 ignored issues
show
introduced by
Opening brace of a class must be on the same line as the definition
Loading history...
31
    use InstancePoolTrait;
32
    use TableMapTrait;
33
34
    /**
35
     * The (dot-path) name of this class
36
     */
37
    const CLASS_NAME = 'mod_link.models.Map.PageLinkProductsTableMap';
38
39
    /**
40
     * The default database name for this class
41
     */
42
    const DATABASE_NAME = 'Shop';
43
44
    /**
45
     * The table name for this class
46
     */
47
    const TABLE_NAME = 'page_link_products';
48
49
    /**
50
     * The related Propel class for this table
51
     */
52
    const OM_CLASS = '\\mod_link\\models\\PageLinkProducts';
53
54
    /**
55
     * A class that can be returned by this tableMap
56
     */
57
    const CLASS_DEFAULT = 'mod_link.models.PageLinkProducts';
58
59
    /**
60
     * The total number of columns
61
     */
62
    const NUM_COLUMNS = 2;
63
64
    /**
65
     * The number of lazy-loaded columns
66
     */
67
    const NUM_LAZY_LOAD_COLUMNS = 0;
68
69
    /**
70
     * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
71
     */
72
    const NUM_HYDRATE_COLUMNS = 2;
73
74
    /**
75
     * the column name for the link_id field
76
     */
77
    const COL_LINK_ID = 'page_link_products.link_id';
78
79
    /**
80
     * the column name for the product_id field
81
     */
82
    const COL_PRODUCT_ID = 'page_link_products.product_id';
83
84
    /**
85
     * The default string format for model objects of the related table
86
     */
87
    const DEFAULT_STRING_FORMAT = 'YAML';
88
89
    /**
90
     * holds an array of fieldnames
91
     *
92
     * first dimension keys are the type constants
0 ignored issues
show
introduced by
Doc comment long description must start with a capital letter
Loading history...
93
     * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
94
     */
95
    protected static $fieldNames = array (
0 ignored issues
show
Coding Style introduced by
There must be no space between the "array" keyword and the opening parenthesis
Loading history...
96
        self::TYPE_PHPNAME       => array('LinkId', 'ProductId', ),
0 ignored issues
show
Coding Style introduced by
Comma not allowed after last value in single-line array declaration
Loading history...
introduced by
There should be no white space before a closing ")"
Loading history...
97
        self::TYPE_CAMELNAME     => array('linkId', 'productId', ),
0 ignored issues
show
Coding Style introduced by
Comma not allowed after last value in single-line array declaration
Loading history...
introduced by
There should be no white space before a closing ")"
Loading history...
98
        self::TYPE_COLNAME       => array(PageLinkProductsTableMap::COL_LINK_ID, PageLinkProductsTableMap::COL_PRODUCT_ID, ),
0 ignored issues
show
introduced by
If the line declaring an array spans longer than 80 characters, each element should be broken into its own line
Loading history...
Coding Style introduced by
As per coding style, self should be used for accessing local static members.

This check looks for accesses to local static members using the fully qualified name instead of self::.

<?php

class Certificate {
    const TRIPLEDES_CBC = 'ASDFGHJKL';

    private $key;

    public function __construct()
    {
        $this->key = Certificate::TRIPLEDES_CBC;
    }
}

While this is perfectly valid, the fully qualified name of Certificate::TRIPLEDES_CBC could just as well be replaced by self::TRIPLEDES_CBC. Referencing local members with self:: assured the access will still work when the class is renamed, makes it perfectly clear that the member is in fact local and will usually be shorter.

Loading history...
Coding Style introduced by
Comma not allowed after last value in single-line array declaration
Loading history...
introduced by
There should be no white space before a closing ")"
Loading history...
99
        self::TYPE_FIELDNAME     => array('link_id', 'product_id', ),
0 ignored issues
show
Coding Style introduced by
Comma not allowed after last value in single-line array declaration
Loading history...
introduced by
There should be no white space before a closing ")"
Loading history...
100
        self::TYPE_NUM           => array(0, 1, )
0 ignored issues
show
Coding Style introduced by
Comma not allowed after last value in single-line array declaration
Loading history...
introduced by
There should be no white space before a closing ")"
Loading history...
101
    );
102
103
    /**
104
     * holds an array of keys for quick access to the fieldnames array
105
     *
106
     * first dimension keys are the type constants
0 ignored issues
show
introduced by
Doc comment long description must start with a capital letter
Loading history...
107
     * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
108
     */
109
    protected static $fieldKeys = array (
0 ignored issues
show
Coding Style introduced by
There must be no space between the "array" keyword and the opening parenthesis
Loading history...
110
        self::TYPE_PHPNAME       => array('LinkId' => 0, 'ProductId' => 1, ),
0 ignored issues
show
Coding Style introduced by
Comma not allowed after last value in single-line array declaration
Loading history...
introduced by
There should be no white space before a closing ")"
Loading history...
111
        self::TYPE_CAMELNAME     => array('linkId' => 0, 'productId' => 1, ),
0 ignored issues
show
Coding Style introduced by
Comma not allowed after last value in single-line array declaration
Loading history...
introduced by
There should be no white space before a closing ")"
Loading history...
112
        self::TYPE_COLNAME       => array(PageLinkProductsTableMap::COL_LINK_ID => 0, PageLinkProductsTableMap::COL_PRODUCT_ID => 1, ),
0 ignored issues
show
introduced by
If the line declaring an array spans longer than 80 characters, each element should be broken into its own line
Loading history...
Coding Style introduced by
As per coding style, self should be used for accessing local static members.

This check looks for accesses to local static members using the fully qualified name instead of self::.

<?php

class Certificate {
    const TRIPLEDES_CBC = 'ASDFGHJKL';

    private $key;

    public function __construct()
    {
        $this->key = Certificate::TRIPLEDES_CBC;
    }
}

While this is perfectly valid, the fully qualified name of Certificate::TRIPLEDES_CBC could just as well be replaced by self::TRIPLEDES_CBC. Referencing local members with self:: assured the access will still work when the class is renamed, makes it perfectly clear that the member is in fact local and will usually be shorter.

Loading history...
Coding Style introduced by
Comma not allowed after last value in single-line array declaration
Loading history...
introduced by
There should be no white space before a closing ")"
Loading history...
113
        self::TYPE_FIELDNAME     => array('link_id' => 0, 'product_id' => 1, ),
0 ignored issues
show
Coding Style introduced by
Comma not allowed after last value in single-line array declaration
Loading history...
introduced by
There should be no white space before a closing ")"
Loading history...
114
        self::TYPE_NUM           => array(0, 1, )
0 ignored issues
show
Coding Style introduced by
Comma not allowed after last value in single-line array declaration
Loading history...
introduced by
There should be no white space before a closing ")"
Loading history...
115
    );
116
117
    /**
118
     * Initialize the table attributes and columns
119
     * Relations are not initialized by this method since they are lazy loaded
120
     *
121
     * @return void
0 ignored issues
show
introduced by
If there is no return value for a function, there must not be a @return tag.
Loading history...
122
     * @throws PropelException
0 ignored issues
show
introduced by
Comment missing or not on the next line for @throws tag in function comment
Loading history...
123
     */
124
    public function initialize()
125
    {
126
        // attributes
127
        $this->setName('page_link_products');
128
        $this->setPhpName('PageLinkProducts');
129
        $this->setIdentifierQuoting(false);
130
        $this->setClassName('\\mod_link\\models\\PageLinkProducts');
131
        $this->setPackage('mod_link.models');
132
        $this->setUseIdGenerator(false);
133
        $this->setIsCrossRef(true);
134
        // columns
135
        $this->addForeignPrimaryKey('link_id', 'LinkId', 'INTEGER' , 'page_link', 'id', true, null, null);
0 ignored issues
show
Coding Style introduced by
Space found before comma in function call
Loading history...
136
        $this->addPrimaryKey('product_id', 'ProductId', 'INTEGER', true, null, null);
137
    } // initialize()
138
139
    /**
140
     * Build the RelationMap objects for this table relationships
141
     */
142
    public function buildRelations()
143
    {
144
        $this->addRelation('PageLink', '\\mod_link\\models\\PageLink', RelationMap::MANY_TO_ONE, array (
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, each argument should be on a separate line.

For a function calls that spawns multiple lines, the coding style suggests to split arguments to separate lines like this:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
);
Loading history...
Coding Style introduced by
There must be no space between the "array" keyword and the opening parenthesis
Loading history...
145
  0 =>
146
  array (
0 ignored issues
show
Coding Style introduced by
There must be no space between the "array" keyword and the opening parenthesis
Loading history...
147
    0 => ':link_id',
148
    1 => ':id',
149
  ),
150
), null, null, null, false);
0 ignored issues
show
introduced by
Line indented incorrectly; expected at least 8 spaces, found 0
Loading history...
Coding Style introduced by
For multi-line function calls, each argument should be on a separate line.

For a function calls that spawns multiple lines, the coding style suggests to split arguments to separate lines like this:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
);
Loading history...
151
    } // buildRelations()
152
153
    /**
154
     * Adds an object to the instance pool.
155
     *
156
     * Propel keeps cached copies of objects in an instance pool when they are retrieved
157
     * from the database. In some cases you may need to explicitly add objects
158
     * to the cache in order to ensure that the same objects are always returned by find*()
159
     * and findPk*() calls.
160
     *
161
     * @param \mod_link\models\PageLinkProducts $obj A \mod_link\models\PageLinkProducts object.
162
     * @param string $key             (optional) key to use for instance map (for performance boost if key was already calculated externally).
163
     */
164
    public static function addInstanceToPool($obj, $key = null)
165
    {
166
        if (Propel::isInstancePoolingEnabled()) {
167
            if (null === $key) {
168
                $key = serialize([(null === $obj->getLinkId() || is_scalar($obj->getLinkId()) || is_callable([$obj->getLinkId(), '__toString']) ? (string) $obj->getLinkId() : $obj->getLinkId()), (null === $obj->getProductId() || is_scalar($obj->getProductId()) || is_callable([$obj->getProductId(), '__toString']) ? (string) $obj->getProductId() : $obj->getProductId())]);
169
            } // if key === null
170
            self::$instances[$key] = $obj;
171
        }
172
    }
173
174
    /**
175
     * Removes an object from the instance pool.
176
     *
177
     * Propel keeps cached copies of objects in an instance pool when they are retrieved
178
     * from the database.  In some cases -- especially when you override doDelete
179
     * methods in your stub classes -- you may need to explicitly remove objects
180
     * from the cache in order to prevent returning objects that no longer exist.
181
     *
182
     * @param mixed $value A \mod_link\models\PageLinkProducts object or a primary key value.
183
     */
184
    public static function removeInstanceFromPool($value)
185
    {
186
        if (Propel::isInstancePoolingEnabled() && null !== $value) {
187
            if (is_object($value) && $value instanceof \mod_link\models\PageLinkProducts) {
0 ignored issues
show
Bug introduced by
The class mod_link\models\PageLinkProducts does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
188
                $key = serialize([(null === $value->getLinkId() || is_scalar($value->getLinkId()) || is_callable([$value->getLinkId(), '__toString']) ? (string) $value->getLinkId() : $value->getLinkId()), (null === $value->getProductId() || is_scalar($value->getProductId()) || is_callable([$value->getProductId(), '__toString']) ? (string) $value->getProductId() : $value->getProductId())]);
189
190
            } elseif (is_array($value) && count($value) === 2) {
191
                // assume we've been passed a primary key";
192
                $key = serialize([(null === $value[0] || is_scalar($value[0]) || is_callable([$value[0], '__toString']) ? (string) $value[0] : $value[0]), (null === $value[1] || is_scalar($value[1]) || is_callable([$value[1], '__toString']) ? (string) $value[1] : $value[1])]);
193
            } elseif ($value instanceof Criteria) {
194
                self::$instances = [];
195
196
                return;
197
            } else {
198
                $e = new PropelException("Invalid value passed to removeInstanceFromPool().  Expected primary key or \mod_link\models\PageLinkProducts object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value, true)));
199
                throw $e;
200
            }
201
202
            unset(self::$instances[$key]);
203
        }
204
    }
205
206
    /**
207
     * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
208
     *
209
     * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
210
     * a multi-column primary key, a serialize()d version of the primary key will be returned.
211
     *
212
     * @param array  $row       resultset row.
0 ignored issues
show
introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
213
     * @param int    $offset    The 0-based offset for reading from the resultset row.
0 ignored issues
show
introduced by
Expected 1 spaces after parameter type; 4 found
Loading history...
214
     * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
215
     *                           TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
0 ignored issues
show
introduced by
Parameter comment must end with a full stop
Loading history...
216
     *
217
     * @return string The primary key hash of the row
0 ignored issues
show
Documentation introduced by
Should the return type not be null|string?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
218
     */
219
    public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
220
    {
221
        // If the PK cannot be derived from the row, return NULL.
222
        if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('LinkId', TableMap::TYPE_PHPNAME, $indexType)] === null && $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('ProductId', TableMap::TYPE_PHPNAME, $indexType)] === null) {
223
            return null;
224
        }
225
226
        return serialize([(null === $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('LinkId', TableMap::TYPE_PHPNAME, $indexType)] || is_scalar($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('LinkId', TableMap::TYPE_PHPNAME, $indexType)]) || is_callable([$row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('LinkId', TableMap::TYPE_PHPNAME, $indexType)], '__toString']) ? (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('LinkId', TableMap::TYPE_PHPNAME, $indexType)] : $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('LinkId', TableMap::TYPE_PHPNAME, $indexType)]), (null === $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('ProductId', TableMap::TYPE_PHPNAME, $indexType)] || is_scalar($row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('ProductId', TableMap::TYPE_PHPNAME, $indexType)]) || is_callable([$row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('ProductId', TableMap::TYPE_PHPNAME, $indexType)], '__toString']) ? (string) $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('ProductId', TableMap::TYPE_PHPNAME, $indexType)] : $row[TableMap::TYPE_NUM == $indexType ? 1 + $offset : static::translateFieldName('ProductId', TableMap::TYPE_PHPNAME, $indexType)])]);
227
    }
228
229
    /**
230
     * Retrieves the primary key from the DB resultset row
231
     * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
232
     * a multi-column primary key, an array of the primary key columns will be returned.
233
     *
234
     * @param array  $row       resultset row.
0 ignored issues
show
introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
235
     * @param int    $offset    The 0-based offset for reading from the resultset row.
0 ignored issues
show
introduced by
Expected 1 spaces after parameter type; 4 found
Loading history...
236
     * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
237
     *                           TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM
0 ignored issues
show
introduced by
Parameter comment must end with a full stop
Loading history...
238
     *
239
     * @return mixed The primary key of the row
0 ignored issues
show
Documentation introduced by
Consider making the return type a bit more specific; maybe use integer[].

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
240
     */
241
    public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
242
    {
243
            $pks = [];
244
245
        $pks[] = (int) $row[
0 ignored issues
show
Coding Style introduced by
Space found after square bracket; expected "[$indexType" but found "[
$indexType"
Loading history...
246
            $indexType == TableMap::TYPE_NUM
247
                ? 0 + $offset
248
                : self::translateFieldName('LinkId', TableMap::TYPE_PHPNAME, $indexType)
249
        ];
0 ignored issues
show
Coding Style introduced by
Space found before square bracket; expected ")]" but found ")
]"
Loading history...
250
        $pks[] = (int) $row[
0 ignored issues
show
Coding Style introduced by
Space found after square bracket; expected "[$indexType" but found "[
$indexType"
Loading history...
251
            $indexType == TableMap::TYPE_NUM
252
                ? 1 + $offset
253
                : self::translateFieldName('ProductId', TableMap::TYPE_PHPNAME, $indexType)
254
        ];
0 ignored issues
show
Coding Style introduced by
Space found before square bracket; expected ")]" but found ")
]"
Loading history...
255
256
        return $pks;
257
    }
258
259
    /**
260
     * The class that the tableMap will make instances of.
261
     *
262
     * If $withPrefix is true, the returned path
263
     * uses a dot-path notation which is translated into a path
264
     * relative to a location on the PHP include_path.
265
     * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
266
     *
267
     * @param boolean $withPrefix Whether or not to return the path with the class name
268
     * @return string path.to.ClassName
269
     */
270
    public static function getOMClass($withPrefix = true)
271
    {
272
        return $withPrefix ? PageLinkProductsTableMap::CLASS_DEFAULT : PageLinkProductsTableMap::OM_CLASS;
0 ignored issues
show
Coding Style introduced by
As per coding style, self should be used for accessing local static members.

This check looks for accesses to local static members using the fully qualified name instead of self::.

<?php

class Certificate {
    const TRIPLEDES_CBC = 'ASDFGHJKL';

    private $key;

    public function __construct()
    {
        $this->key = Certificate::TRIPLEDES_CBC;
    }
}

While this is perfectly valid, the fully qualified name of Certificate::TRIPLEDES_CBC could just as well be replaced by self::TRIPLEDES_CBC. Referencing local members with self:: assured the access will still work when the class is renamed, makes it perfectly clear that the member is in fact local and will usually be shorter.

Loading history...
273
    }
274
275
    /**
276
     * Populates an object of the default type or an object that inherit from the default.
277
     *
278
     * @param array  $row       row returned by DataFetcher->fetch().
0 ignored issues
show
introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
279
     * @param int    $offset    The 0-based offset for reading from the resultset row.
0 ignored issues
show
introduced by
Expected 1 spaces after parameter type; 4 found
Loading history...
280
     * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType().
281
                                 One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME
282
     *                           TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM.
283
     *
284
     * @throws PropelException Any exceptions caught during processing will be
285
     *                         rethrown wrapped into a PropelException.
0 ignored issues
show
introduced by
@throws tag comment must start with a capital letter
Loading history...
286
     * @return array           (PageLinkProducts object, last column rank)
287
     */
288
    public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM)
289
    {
290
        $key = PageLinkProductsTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType);
0 ignored issues
show
Coding Style introduced by
As per coding style, self should be used for accessing local static members.

This check looks for accesses to local static members using the fully qualified name instead of self::.

<?php

class Certificate {
    const TRIPLEDES_CBC = 'ASDFGHJKL';

    private $key;

    public function __construct()
    {
        $this->key = Certificate::TRIPLEDES_CBC;
    }
}

While this is perfectly valid, the fully qualified name of Certificate::TRIPLEDES_CBC could just as well be replaced by self::TRIPLEDES_CBC. Referencing local members with self:: assured the access will still work when the class is renamed, makes it perfectly clear that the member is in fact local and will usually be shorter.

Loading history...
291
        if (null !== ($obj = PageLinkProductsTableMap::getInstanceFromPool($key))) {
0 ignored issues
show
Coding Style introduced by
As per coding style, self should be used for accessing local static members.

This check looks for accesses to local static members using the fully qualified name instead of self::.

<?php

class Certificate {
    const TRIPLEDES_CBC = 'ASDFGHJKL';

    private $key;

    public function __construct()
    {
        $this->key = Certificate::TRIPLEDES_CBC;
    }
}

While this is perfectly valid, the fully qualified name of Certificate::TRIPLEDES_CBC could just as well be replaced by self::TRIPLEDES_CBC. Referencing local members with self:: assured the access will still work when the class is renamed, makes it perfectly clear that the member is in fact local and will usually be shorter.

Loading history...
292
            // We no longer rehydrate the object, since this can cause data loss.
293
            // See http://www.propelorm.org/ticket/509
294
            // $obj->hydrate($row, $offset, true); // rehydrate
295
            $col = $offset + PageLinkProductsTableMap::NUM_HYDRATE_COLUMNS;
0 ignored issues
show
Coding Style introduced by
As per coding style, self should be used for accessing local static members.

This check looks for accesses to local static members using the fully qualified name instead of self::.

<?php

class Certificate {
    const TRIPLEDES_CBC = 'ASDFGHJKL';

    private $key;

    public function __construct()
    {
        $this->key = Certificate::TRIPLEDES_CBC;
    }
}

While this is perfectly valid, the fully qualified name of Certificate::TRIPLEDES_CBC could just as well be replaced by self::TRIPLEDES_CBC. Referencing local members with self:: assured the access will still work when the class is renamed, makes it perfectly clear that the member is in fact local and will usually be shorter.

Loading history...
296
        } else {
297
            $cls = PageLinkProductsTableMap::OM_CLASS;
0 ignored issues
show
Coding Style introduced by
As per coding style, self should be used for accessing local static members.

This check looks for accesses to local static members using the fully qualified name instead of self::.

<?php

class Certificate {
    const TRIPLEDES_CBC = 'ASDFGHJKL';

    private $key;

    public function __construct()
    {
        $this->key = Certificate::TRIPLEDES_CBC;
    }
}

While this is perfectly valid, the fully qualified name of Certificate::TRIPLEDES_CBC could just as well be replaced by self::TRIPLEDES_CBC. Referencing local members with self:: assured the access will still work when the class is renamed, makes it perfectly clear that the member is in fact local and will usually be shorter.

Loading history...
298
            /** @var PageLinkProducts $obj */
299
            $obj = new $cls();
300
            $col = $obj->hydrate($row, $offset, false, $indexType);
301
            PageLinkProductsTableMap::addInstanceToPool($obj, $key);
0 ignored issues
show
Coding Style introduced by
As per coding style, self should be used for accessing local static members.

This check looks for accesses to local static members using the fully qualified name instead of self::.

<?php

class Certificate {
    const TRIPLEDES_CBC = 'ASDFGHJKL';

    private $key;

    public function __construct()
    {
        $this->key = Certificate::TRIPLEDES_CBC;
    }
}

While this is perfectly valid, the fully qualified name of Certificate::TRIPLEDES_CBC could just as well be replaced by self::TRIPLEDES_CBC. Referencing local members with self:: assured the access will still work when the class is renamed, makes it perfectly clear that the member is in fact local and will usually be shorter.

Loading history...
302
        }
303
304
        return array($obj, $col);
305
    }
306
307
    /**
308
     * The returned array will contain objects of the default type or
309
     * objects that inherit from the default.
310
     *
311
     * @param DataFetcherInterface $dataFetcher
312
     * @return array
313
     * @throws PropelException Any exceptions caught during processing will be
314
     *                         rethrown wrapped into a PropelException.
0 ignored issues
show
introduced by
@throws tag comment must start with a capital letter
Loading history...
315
     */
316
    public static function populateObjects(DataFetcherInterface $dataFetcher)
317
    {
318
        $results = array();
319
320
        // set the class once to avoid overhead in the loop
321
        $cls = static::getOMClass(false);
322
        // populate the object(s)
323
        while ($row = $dataFetcher->fetch()) {
324
            $key = PageLinkProductsTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType());
0 ignored issues
show
Coding Style introduced by
As per coding style, self should be used for accessing local static members.

This check looks for accesses to local static members using the fully qualified name instead of self::.

<?php

class Certificate {
    const TRIPLEDES_CBC = 'ASDFGHJKL';

    private $key;

    public function __construct()
    {
        $this->key = Certificate::TRIPLEDES_CBC;
    }
}

While this is perfectly valid, the fully qualified name of Certificate::TRIPLEDES_CBC could just as well be replaced by self::TRIPLEDES_CBC. Referencing local members with self:: assured the access will still work when the class is renamed, makes it perfectly clear that the member is in fact local and will usually be shorter.

Loading history...
325
            if (null !== ($obj = PageLinkProductsTableMap::getInstanceFromPool($key))) {
0 ignored issues
show
Coding Style introduced by
As per coding style, self should be used for accessing local static members.

This check looks for accesses to local static members using the fully qualified name instead of self::.

<?php

class Certificate {
    const TRIPLEDES_CBC = 'ASDFGHJKL';

    private $key;

    public function __construct()
    {
        $this->key = Certificate::TRIPLEDES_CBC;
    }
}

While this is perfectly valid, the fully qualified name of Certificate::TRIPLEDES_CBC could just as well be replaced by self::TRIPLEDES_CBC. Referencing local members with self:: assured the access will still work when the class is renamed, makes it perfectly clear that the member is in fact local and will usually be shorter.

Loading history...
326
                // We no longer rehydrate the object, since this can cause data loss.
327
                // See http://www.propelorm.org/ticket/509
328
                // $obj->hydrate($row, 0, true); // rehydrate
329
                $results[] = $obj;
330
            } else {
331
                /** @var PageLinkProducts $obj */
332
                $obj = new $cls();
333
                $obj->hydrate($row);
334
                $results[] = $obj;
335
                PageLinkProductsTableMap::addInstanceToPool($obj, $key);
0 ignored issues
show
Coding Style introduced by
As per coding style, self should be used for accessing local static members.

This check looks for accesses to local static members using the fully qualified name instead of self::.

<?php

class Certificate {
    const TRIPLEDES_CBC = 'ASDFGHJKL';

    private $key;

    public function __construct()
    {
        $this->key = Certificate::TRIPLEDES_CBC;
    }
}

While this is perfectly valid, the fully qualified name of Certificate::TRIPLEDES_CBC could just as well be replaced by self::TRIPLEDES_CBC. Referencing local members with self:: assured the access will still work when the class is renamed, makes it perfectly clear that the member is in fact local and will usually be shorter.

Loading history...
336
            } // if key exists
337
        }
338
339
        return $results;
340
    }
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line after function; 0 found
Loading history...
341
    /**
342
     * Add all the columns needed to create a new object.
343
     *
344
     * Note: any columns that were marked with lazyLoad="true" in the
345
     * XML schema will not be added to the select list and only loaded
346
     * on demand.
347
     *
348
     * @param Criteria $criteria object containing the columns to add.
349
     * @param string   $alias    optional table alias
0 ignored issues
show
introduced by
Expected 1 spaces after parameter type; 3 found
Loading history...
350
     * @throws PropelException Any exceptions caught during processing will be
351
     *                         rethrown wrapped into a PropelException.
0 ignored issues
show
introduced by
@throws tag comment must start with a capital letter
Loading history...
352
     */
353
    public static function addSelectColumns(Criteria $criteria, $alias = null)
354
    {
355
        if (null === $alias) {
356
            $criteria->addSelectColumn(PageLinkProductsTableMap::COL_LINK_ID);
0 ignored issues
show
Coding Style introduced by
As per coding style, self should be used for accessing local static members.

This check looks for accesses to local static members using the fully qualified name instead of self::.

<?php

class Certificate {
    const TRIPLEDES_CBC = 'ASDFGHJKL';

    private $key;

    public function __construct()
    {
        $this->key = Certificate::TRIPLEDES_CBC;
    }
}

While this is perfectly valid, the fully qualified name of Certificate::TRIPLEDES_CBC could just as well be replaced by self::TRIPLEDES_CBC. Referencing local members with self:: assured the access will still work when the class is renamed, makes it perfectly clear that the member is in fact local and will usually be shorter.

Loading history...
357
            $criteria->addSelectColumn(PageLinkProductsTableMap::COL_PRODUCT_ID);
0 ignored issues
show
Coding Style introduced by
As per coding style, self should be used for accessing local static members.

This check looks for accesses to local static members using the fully qualified name instead of self::.

<?php

class Certificate {
    const TRIPLEDES_CBC = 'ASDFGHJKL';

    private $key;

    public function __construct()
    {
        $this->key = Certificate::TRIPLEDES_CBC;
    }
}

While this is perfectly valid, the fully qualified name of Certificate::TRIPLEDES_CBC could just as well be replaced by self::TRIPLEDES_CBC. Referencing local members with self:: assured the access will still work when the class is renamed, makes it perfectly clear that the member is in fact local and will usually be shorter.

Loading history...
358
        } else {
359
            $criteria->addSelectColumn($alias . '.link_id');
360
            $criteria->addSelectColumn($alias . '.product_id');
361
        }
362
    }
363
364
    /**
365
     * Returns the TableMap related to this object.
366
     * This method is not needed for general use but a specific application could have a need.
367
     * @return TableMap
368
     * @throws PropelException Any exceptions caught during processing will be
369
     *                         rethrown wrapped into a PropelException.
0 ignored issues
show
introduced by
@throws tag comment must start with a capital letter
Loading history...
370
     */
371
    public static function getTableMap()
372
    {
373
        return Propel::getServiceContainer()->getDatabaseMap(PageLinkProductsTableMap::DATABASE_NAME)->getTable(PageLinkProductsTableMap::TABLE_NAME);
0 ignored issues
show
Coding Style introduced by
As per coding style, self should be used for accessing local static members.

This check looks for accesses to local static members using the fully qualified name instead of self::.

<?php

class Certificate {
    const TRIPLEDES_CBC = 'ASDFGHJKL';

    private $key;

    public function __construct()
    {
        $this->key = Certificate::TRIPLEDES_CBC;
    }
}

While this is perfectly valid, the fully qualified name of Certificate::TRIPLEDES_CBC could just as well be replaced by self::TRIPLEDES_CBC. Referencing local members with self:: assured the access will still work when the class is renamed, makes it perfectly clear that the member is in fact local and will usually be shorter.

Loading history...
374
    }
375
376
    /**
377
     * Add a TableMap instance to the database for this tableMap class.
378
     */
379
    public static function buildTableMap()
380
    {
381
        $dbMap = Propel::getServiceContainer()->getDatabaseMap(PageLinkProductsTableMap::DATABASE_NAME);
0 ignored issues
show
Coding Style introduced by
As per coding style, self should be used for accessing local static members.

This check looks for accesses to local static members using the fully qualified name instead of self::.

<?php

class Certificate {
    const TRIPLEDES_CBC = 'ASDFGHJKL';

    private $key;

    public function __construct()
    {
        $this->key = Certificate::TRIPLEDES_CBC;
    }
}

While this is perfectly valid, the fully qualified name of Certificate::TRIPLEDES_CBC could just as well be replaced by self::TRIPLEDES_CBC. Referencing local members with self:: assured the access will still work when the class is renamed, makes it perfectly clear that the member is in fact local and will usually be shorter.

Loading history...
382
        if (!$dbMap->hasTable(PageLinkProductsTableMap::TABLE_NAME)) {
0 ignored issues
show
Coding Style introduced by
As per coding style, self should be used for accessing local static members.

This check looks for accesses to local static members using the fully qualified name instead of self::.

<?php

class Certificate {
    const TRIPLEDES_CBC = 'ASDFGHJKL';

    private $key;

    public function __construct()
    {
        $this->key = Certificate::TRIPLEDES_CBC;
    }
}

While this is perfectly valid, the fully qualified name of Certificate::TRIPLEDES_CBC could just as well be replaced by self::TRIPLEDES_CBC. Referencing local members with self:: assured the access will still work when the class is renamed, makes it perfectly clear that the member is in fact local and will usually be shorter.

Loading history...
383
            $dbMap->addTableObject(new PageLinkProductsTableMap());
384
        }
385
    }
386
387
    /**
388
     * Performs a DELETE on the database, given a PageLinkProducts or Criteria object OR a primary key value.
389
     *
390
     * @param mixed               $values Criteria or PageLinkProducts object or primary key or array of primary keys
0 ignored issues
show
introduced by
Expected 1 spaces after parameter type; 15 found
Loading history...
391
     *              which is used to create the DELETE statement
0 ignored issues
show
introduced by
Parameter comment must end with a full stop
Loading history...
392
     * @param  ConnectionInterface $con the connection to use
393
     * @return int             The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
394
     *                         if supported by native driver or if emulated using Propel.
395
     * @throws PropelException Any exceptions caught during processing will be
396
     *                         rethrown wrapped into a PropelException.
0 ignored issues
show
introduced by
@throws tag comment must start with a capital letter
Loading history...
397
     */
398
     public static function doDelete($values, ConnectionInterface $con = null)
399
     {
400
        if (null === $con) {
401
            $con = Propel::getServiceContainer()->getWriteConnection(PageLinkProductsTableMap::DATABASE_NAME);
0 ignored issues
show
Coding Style introduced by
As per coding style, self should be used for accessing local static members.

This check looks for accesses to local static members using the fully qualified name instead of self::.

<?php

class Certificate {
    const TRIPLEDES_CBC = 'ASDFGHJKL';

    private $key;

    public function __construct()
    {
        $this->key = Certificate::TRIPLEDES_CBC;
    }
}

While this is perfectly valid, the fully qualified name of Certificate::TRIPLEDES_CBC could just as well be replaced by self::TRIPLEDES_CBC. Referencing local members with self:: assured the access will still work when the class is renamed, makes it perfectly clear that the member is in fact local and will usually be shorter.

Loading history...
402
        }
403
404
        if ($values instanceof Criteria) {
405
            // rename for clarity
406
            $criteria = $values;
407
        } elseif ($values instanceof \mod_link\models\PageLinkProducts) { // it's a model object
0 ignored issues
show
Bug introduced by
The class mod_link\models\PageLinkProducts does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
introduced by
There should be no white space after an opening "{"
Loading history...
408
            // create criteria based on pk values
409
            $criteria = $values->buildPkeyCriteria();
410
        } else { // it's a primary key, or an array of pks
0 ignored issues
show
introduced by
There should be no white space after an opening "{"
Loading history...
411
            $criteria = new Criteria(PageLinkProductsTableMap::DATABASE_NAME);
0 ignored issues
show
Coding Style introduced by
As per coding style, self should be used for accessing local static members.

This check looks for accesses to local static members using the fully qualified name instead of self::.

<?php

class Certificate {
    const TRIPLEDES_CBC = 'ASDFGHJKL';

    private $key;

    public function __construct()
    {
        $this->key = Certificate::TRIPLEDES_CBC;
    }
}

While this is perfectly valid, the fully qualified name of Certificate::TRIPLEDES_CBC could just as well be replaced by self::TRIPLEDES_CBC. Referencing local members with self:: assured the access will still work when the class is renamed, makes it perfectly clear that the member is in fact local and will usually be shorter.

Loading history...
412
            // primary key is composite; we therefore, expect
413
            // the primary key passed to be an array of pkey values
414
            if (count($values) == count($values, COUNT_RECURSIVE)) {
415
                // array is not multi-dimensional
416
                $values = array($values);
417
            }
418
            foreach ($values as $value) {
419
                $criterion = $criteria->getNewCriterion(PageLinkProductsTableMap::COL_LINK_ID, $value[0]);
0 ignored issues
show
Coding Style introduced by
As per coding style, self should be used for accessing local static members.

This check looks for accesses to local static members using the fully qualified name instead of self::.

<?php

class Certificate {
    const TRIPLEDES_CBC = 'ASDFGHJKL';

    private $key;

    public function __construct()
    {
        $this->key = Certificate::TRIPLEDES_CBC;
    }
}

While this is perfectly valid, the fully qualified name of Certificate::TRIPLEDES_CBC could just as well be replaced by self::TRIPLEDES_CBC. Referencing local members with self:: assured the access will still work when the class is renamed, makes it perfectly clear that the member is in fact local and will usually be shorter.

Loading history...
420
                $criterion->addAnd($criteria->getNewCriterion(PageLinkProductsTableMap::COL_PRODUCT_ID, $value[1]));
0 ignored issues
show
Coding Style introduced by
As per coding style, self should be used for accessing local static members.

This check looks for accesses to local static members using the fully qualified name instead of self::.

<?php

class Certificate {
    const TRIPLEDES_CBC = 'ASDFGHJKL';

    private $key;

    public function __construct()
    {
        $this->key = Certificate::TRIPLEDES_CBC;
    }
}

While this is perfectly valid, the fully qualified name of Certificate::TRIPLEDES_CBC could just as well be replaced by self::TRIPLEDES_CBC. Referencing local members with self:: assured the access will still work when the class is renamed, makes it perfectly clear that the member is in fact local and will usually be shorter.

Loading history...
421
                $criteria->addOr($criterion);
422
            }
423
        }
424
425
        $query = PageLinkProductsQuery::create()->mergeWith($criteria);
426
427
        if ($values instanceof Criteria) {
428
            PageLinkProductsTableMap::clearInstancePool();
0 ignored issues
show
Coding Style introduced by
As per coding style, self should be used for accessing local static members.

This check looks for accesses to local static members using the fully qualified name instead of self::.

<?php

class Certificate {
    const TRIPLEDES_CBC = 'ASDFGHJKL';

    private $key;

    public function __construct()
    {
        $this->key = Certificate::TRIPLEDES_CBC;
    }
}

While this is perfectly valid, the fully qualified name of Certificate::TRIPLEDES_CBC could just as well be replaced by self::TRIPLEDES_CBC. Referencing local members with self:: assured the access will still work when the class is renamed, makes it perfectly clear that the member is in fact local and will usually be shorter.

Loading history...
429
        } elseif (!is_object($values)) { // it's a primary key, or an array of pks
0 ignored issues
show
introduced by
There should be no white space after an opening "{"
Loading history...
430
            foreach ((array) $values as $singleval) {
431
                PageLinkProductsTableMap::removeInstanceFromPool($singleval);
0 ignored issues
show
Coding Style introduced by
As per coding style, self should be used for accessing local static members.

This check looks for accesses to local static members using the fully qualified name instead of self::.

<?php

class Certificate {
    const TRIPLEDES_CBC = 'ASDFGHJKL';

    private $key;

    public function __construct()
    {
        $this->key = Certificate::TRIPLEDES_CBC;
    }
}

While this is perfectly valid, the fully qualified name of Certificate::TRIPLEDES_CBC could just as well be replaced by self::TRIPLEDES_CBC. Referencing local members with self:: assured the access will still work when the class is renamed, makes it perfectly clear that the member is in fact local and will usually be shorter.

Loading history...
432
            }
433
        }
434
435
        return $query->delete($con);
436
    }
0 ignored issues
show
introduced by
Closing brace indented incorrectly; expected 5 spaces, found 4
Loading history...
437
438
    /**
439
     * Deletes all rows from the page_link_products table.
440
     *
441
     * @param ConnectionInterface $con the connection to use
442
     * @return int The number of affected rows (if supported by underlying database driver).
443
     */
444
    public static function doDeleteAll(ConnectionInterface $con = null)
445
    {
446
        return PageLinkProductsQuery::create()->doDeleteAll($con);
447
    }
448
449
    /**
450
     * Performs an INSERT on the database, given a PageLinkProducts or Criteria object.
451
     *
452
     * @param mixed               $criteria Criteria or PageLinkProducts object containing data that is used to create the INSERT statement.
0 ignored issues
show
introduced by
Expected 1 spaces after parameter type; 15 found
Loading history...
453
     * @param ConnectionInterface $con the ConnectionInterface connection to use
454
     * @return mixed           The new primary key.
455
     * @throws PropelException Any exceptions caught during processing will be
456
     *                         rethrown wrapped into a PropelException.
0 ignored issues
show
introduced by
@throws tag comment must start with a capital letter
Loading history...
457
     */
458
    public static function doInsert($criteria, ConnectionInterface $con = null)
459
    {
460
        if (null === $con) {
461
            $con = Propel::getServiceContainer()->getWriteConnection(PageLinkProductsTableMap::DATABASE_NAME);
0 ignored issues
show
Coding Style introduced by
As per coding style, self should be used for accessing local static members.

This check looks for accesses to local static members using the fully qualified name instead of self::.

<?php

class Certificate {
    const TRIPLEDES_CBC = 'ASDFGHJKL';

    private $key;

    public function __construct()
    {
        $this->key = Certificate::TRIPLEDES_CBC;
    }
}

While this is perfectly valid, the fully qualified name of Certificate::TRIPLEDES_CBC could just as well be replaced by self::TRIPLEDES_CBC. Referencing local members with self:: assured the access will still work when the class is renamed, makes it perfectly clear that the member is in fact local and will usually be shorter.

Loading history...
462
        }
463
464
        if ($criteria instanceof Criteria) {
465
            $criteria = clone $criteria; // rename for clarity
466
        } else {
467
            $criteria = $criteria->buildCriteria(); // build Criteria from PageLinkProducts object
468
        }
469
0 ignored issues
show
Coding Style introduced by
Functions must not contain multiple empty lines in a row; found 2 empty lines
Loading history...
470
471
        // Set the correct dbName
472
        $query = PageLinkProductsQuery::create()->mergeWith($criteria);
473
474
        // use transaction because $criteria could contain info
475
        // for more than one table (I guess, conceivably)
476
        return $con->transaction(function () use ($con, $query) {
477
            return $query->doInsert($con);
478
        });
479
    }
480
481
} // PageLinkProductsTableMap
482
// This is the static code needed to register the TableMap for this table with the main Propel class.
483
//
484
PageLinkProductsTableMap::buildTableMap();
0 ignored issues
show
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
485