@@ -7,37 +7,37 @@ discard block |
||
7 | 7 | */ |
8 | 8 | class PropelMigration_1455269307 |
9 | 9 | { |
10 | - public $comment = ''; |
|
10 | + public $comment = ''; |
|
11 | 11 | |
12 | - public function preUp($manager) |
|
13 | - { |
|
14 | - // add the pre-migration code here |
|
15 | - } |
|
12 | + public function preUp($manager) |
|
13 | + { |
|
14 | + // add the pre-migration code here |
|
15 | + } |
|
16 | 16 | |
17 | - public function postUp($manager) |
|
18 | - { |
|
19 | - // add the post-migration code here |
|
20 | - } |
|
17 | + public function postUp($manager) |
|
18 | + { |
|
19 | + // add the post-migration code here |
|
20 | + } |
|
21 | 21 | |
22 | - public function preDown($manager) |
|
23 | - { |
|
24 | - // add the pre-migration code here |
|
25 | - } |
|
22 | + public function preDown($manager) |
|
23 | + { |
|
24 | + // add the pre-migration code here |
|
25 | + } |
|
26 | 26 | |
27 | - public function postDown($manager) |
|
28 | - { |
|
29 | - // add the post-migration code here |
|
30 | - } |
|
27 | + public function postDown($manager) |
|
28 | + { |
|
29 | + // add the post-migration code here |
|
30 | + } |
|
31 | 31 | |
32 | - /** |
|
33 | - * Get the SQL statements for the Up migration |
|
34 | - * |
|
35 | - * @return array list of the SQL strings to execute for the Up migration |
|
36 | - * the keys being the datasources |
|
37 | - */ |
|
38 | - public function getUpSQL() |
|
39 | - { |
|
40 | - return array ( |
|
32 | + /** |
|
33 | + * Get the SQL statements for the Up migration |
|
34 | + * |
|
35 | + * @return array list of the SQL strings to execute for the Up migration |
|
36 | + * the keys being the datasources |
|
37 | + */ |
|
38 | + public function getUpSQL() |
|
39 | + { |
|
40 | + return array ( |
|
41 | 41 | 'tvheadend_status_manager' => ' |
42 | 42 | PRAGMA foreign_keys = OFF; |
43 | 43 | |
@@ -46,17 +46,17 @@ discard block |
||
46 | 46 | PRAGMA foreign_keys = ON; |
47 | 47 | ', |
48 | 48 | ); |
49 | - } |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * Get the SQL statements for the Down migration |
|
53 | - * |
|
54 | - * @return array list of the SQL strings to execute for the Down migration |
|
55 | - * the keys being the datasources |
|
56 | - */ |
|
57 | - public function getDownSQL() |
|
58 | - { |
|
59 | - return array ( |
|
51 | + /** |
|
52 | + * Get the SQL statements for the Down migration |
|
53 | + * |
|
54 | + * @return array list of the SQL strings to execute for the Down migration |
|
55 | + * the keys being the datasources |
|
56 | + */ |
|
57 | + public function getDownSQL() |
|
58 | + { |
|
59 | + return array ( |
|
60 | 60 | 'tvheadend_status_manager' => ' |
61 | 61 | PRAGMA foreign_keys = OFF; |
62 | 62 | |
@@ -86,6 +86,6 @@ discard block |
||
86 | 86 | PRAGMA foreign_keys = ON; |
87 | 87 | ', |
88 | 88 | ); |
89 | - } |
|
89 | + } |
|
90 | 90 | |
91 | 91 | } |
92 | 92 | \ No newline at end of file |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function getUpSQL() |
39 | 39 | { |
40 | - return array ( |
|
40 | + return array( |
|
41 | 41 | 'tvheadend_status_manager' => ' |
42 | 42 | PRAGMA foreign_keys = OFF; |
43 | 43 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function getDownSQL() |
58 | 58 | { |
59 | - return array ( |
|
59 | + return array( |
|
60 | 60 | 'tvheadend_status_manager' => ' |
61 | 61 | PRAGMA foreign_keys = OFF; |
62 | 62 |
@@ -7,37 +7,37 @@ discard block |
||
7 | 7 | */ |
8 | 8 | class PropelMigration_1455269455 |
9 | 9 | { |
10 | - public $comment = ''; |
|
11 | - |
|
12 | - public function preUp($manager) |
|
13 | - { |
|
14 | - // add the pre-migration code here |
|
15 | - } |
|
16 | - |
|
17 | - public function postUp($manager) |
|
18 | - { |
|
19 | - // add the post-migration code here |
|
20 | - } |
|
21 | - |
|
22 | - public function preDown($manager) |
|
23 | - { |
|
24 | - // add the pre-migration code here |
|
25 | - } |
|
26 | - |
|
27 | - public function postDown($manager) |
|
28 | - { |
|
29 | - // add the post-migration code here |
|
30 | - } |
|
31 | - |
|
32 | - /** |
|
33 | - * Get the SQL statements for the Up migration |
|
34 | - * |
|
35 | - * @return array list of the SQL strings to execute for the Up migration |
|
36 | - * the keys being the datasources |
|
37 | - */ |
|
38 | - public function getUpSQL() |
|
39 | - { |
|
40 | - return array ( |
|
10 | + public $comment = ''; |
|
11 | + |
|
12 | + public function preUp($manager) |
|
13 | + { |
|
14 | + // add the pre-migration code here |
|
15 | + } |
|
16 | + |
|
17 | + public function postUp($manager) |
|
18 | + { |
|
19 | + // add the post-migration code here |
|
20 | + } |
|
21 | + |
|
22 | + public function preDown($manager) |
|
23 | + { |
|
24 | + // add the pre-migration code here |
|
25 | + } |
|
26 | + |
|
27 | + public function postDown($manager) |
|
28 | + { |
|
29 | + // add the post-migration code here |
|
30 | + } |
|
31 | + |
|
32 | + /** |
|
33 | + * Get the SQL statements for the Up migration |
|
34 | + * |
|
35 | + * @return array list of the SQL strings to execute for the Up migration |
|
36 | + * the keys being the datasources |
|
37 | + */ |
|
38 | + public function getUpSQL() |
|
39 | + { |
|
40 | + return array ( |
|
41 | 41 | 'tvheadend_status_manager' => ' |
42 | 42 | PRAGMA foreign_keys = OFF; |
43 | 43 | |
@@ -69,17 +69,17 @@ discard block |
||
69 | 69 | PRAGMA foreign_keys = ON; |
70 | 70 | ', |
71 | 71 | ); |
72 | - } |
|
73 | - |
|
74 | - /** |
|
75 | - * Get the SQL statements for the Down migration |
|
76 | - * |
|
77 | - * @return array list of the SQL strings to execute for the Down migration |
|
78 | - * the keys being the datasources |
|
79 | - */ |
|
80 | - public function getDownSQL() |
|
81 | - { |
|
82 | - return array ( |
|
72 | + } |
|
73 | + |
|
74 | + /** |
|
75 | + * Get the SQL statements for the Down migration |
|
76 | + * |
|
77 | + * @return array list of the SQL strings to execute for the Down migration |
|
78 | + * the keys being the datasources |
|
79 | + */ |
|
80 | + public function getDownSQL() |
|
81 | + { |
|
82 | + return array ( |
|
83 | 83 | 'tvheadend_status_manager' => ' |
84 | 84 | PRAGMA foreign_keys = OFF; |
85 | 85 | |
@@ -110,6 +110,6 @@ discard block |
||
110 | 110 | PRAGMA foreign_keys = ON; |
111 | 111 | ', |
112 | 112 | ); |
113 | - } |
|
113 | + } |
|
114 | 114 | |
115 | 115 | } |
116 | 116 | \ No newline at end of file |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function getUpSQL() |
39 | 39 | { |
40 | - return array ( |
|
40 | + return array( |
|
41 | 41 | 'tvheadend_status_manager' => ' |
42 | 42 | PRAGMA foreign_keys = OFF; |
43 | 43 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function getDownSQL() |
81 | 81 | { |
82 | - return array ( |
|
82 | + return array( |
|
83 | 83 | 'tvheadend_status_manager' => ' |
84 | 84 | PRAGMA foreign_keys = OFF; |
85 | 85 |
@@ -7,37 +7,37 @@ discard block |
||
7 | 7 | */ |
8 | 8 | class PropelMigration_1455269809 |
9 | 9 | { |
10 | - public $comment = ''; |
|
11 | - |
|
12 | - public function preUp($manager) |
|
13 | - { |
|
14 | - // add the pre-migration code here |
|
15 | - } |
|
16 | - |
|
17 | - public function postUp($manager) |
|
18 | - { |
|
19 | - // add the post-migration code here |
|
20 | - } |
|
21 | - |
|
22 | - public function preDown($manager) |
|
23 | - { |
|
24 | - // add the pre-migration code here |
|
25 | - } |
|
26 | - |
|
27 | - public function postDown($manager) |
|
28 | - { |
|
29 | - // add the post-migration code here |
|
30 | - } |
|
31 | - |
|
32 | - /** |
|
33 | - * Get the SQL statements for the Up migration |
|
34 | - * |
|
35 | - * @return array list of the SQL strings to execute for the Up migration |
|
36 | - * the keys being the datasources |
|
37 | - */ |
|
38 | - public function getUpSQL() |
|
39 | - { |
|
40 | - return array ( |
|
10 | + public $comment = ''; |
|
11 | + |
|
12 | + public function preUp($manager) |
|
13 | + { |
|
14 | + // add the pre-migration code here |
|
15 | + } |
|
16 | + |
|
17 | + public function postUp($manager) |
|
18 | + { |
|
19 | + // add the post-migration code here |
|
20 | + } |
|
21 | + |
|
22 | + public function preDown($manager) |
|
23 | + { |
|
24 | + // add the pre-migration code here |
|
25 | + } |
|
26 | + |
|
27 | + public function postDown($manager) |
|
28 | + { |
|
29 | + // add the post-migration code here |
|
30 | + } |
|
31 | + |
|
32 | + /** |
|
33 | + * Get the SQL statements for the Up migration |
|
34 | + * |
|
35 | + * @return array list of the SQL strings to execute for the Up migration |
|
36 | + * the keys being the datasources |
|
37 | + */ |
|
38 | + public function getUpSQL() |
|
39 | + { |
|
40 | + return array ( |
|
41 | 41 | 'tvheadend_status_manager' => ' |
42 | 42 | PRAGMA foreign_keys = OFF; |
43 | 43 | |
@@ -69,17 +69,17 @@ discard block |
||
69 | 69 | PRAGMA foreign_keys = ON; |
70 | 70 | ', |
71 | 71 | ); |
72 | - } |
|
73 | - |
|
74 | - /** |
|
75 | - * Get the SQL statements for the Down migration |
|
76 | - * |
|
77 | - * @return array list of the SQL strings to execute for the Down migration |
|
78 | - * the keys being the datasources |
|
79 | - */ |
|
80 | - public function getDownSQL() |
|
81 | - { |
|
82 | - return array ( |
|
72 | + } |
|
73 | + |
|
74 | + /** |
|
75 | + * Get the SQL statements for the Down migration |
|
76 | + * |
|
77 | + * @return array list of the SQL strings to execute for the Down migration |
|
78 | + * the keys being the datasources |
|
79 | + */ |
|
80 | + public function getDownSQL() |
|
81 | + { |
|
82 | + return array ( |
|
83 | 83 | 'tvheadend_status_manager' => ' |
84 | 84 | PRAGMA foreign_keys = OFF; |
85 | 85 | |
@@ -111,6 +111,6 @@ discard block |
||
111 | 111 | PRAGMA foreign_keys = ON; |
112 | 112 | ', |
113 | 113 | ); |
114 | - } |
|
114 | + } |
|
115 | 115 | |
116 | 116 | } |
117 | 117 | \ No newline at end of file |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function getUpSQL() |
39 | 39 | { |
40 | - return array ( |
|
40 | + return array( |
|
41 | 41 | 'tvheadend_status_manager' => ' |
42 | 42 | PRAGMA foreign_keys = OFF; |
43 | 43 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function getDownSQL() |
81 | 81 | { |
82 | - return array ( |
|
82 | + return array( |
|
83 | 83 | 'tvheadend_status_manager' => ' |
84 | 84 | PRAGMA foreign_keys = OFF; |
85 | 85 |
@@ -27,9 +27,9 @@ |
||
27 | 27 | public function filterBySubscriptionStatus($instanceName, SubscriptionStatus $status) |
28 | 28 | { |
29 | 29 | return $this->filterByInstanceName($instanceName) |
30 | - ->filterByNetwork(Subscription::parseNetwork($status)) |
|
31 | - ->filterByMux(Subscription::parseMux($status)) |
|
32 | - ->addDescendingOrderByColumn('started'); |
|
30 | + ->filterByNetwork(Subscription::parseNetwork($status)) |
|
31 | + ->filterByMux(Subscription::parseMux($status)) |
|
32 | + ->addDescendingOrderByColumn('started'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | } |
@@ -28,429 +28,429 @@ |
||
28 | 28 | */ |
29 | 29 | class InputTableMap extends TableMap |
30 | 30 | { |
31 | - use InstancePoolTrait; |
|
32 | - use TableMapTrait; |
|
33 | - |
|
34 | - /** |
|
35 | - * The (dot-path) name of this class |
|
36 | - */ |
|
37 | - const CLASS_NAME = 'Jalle19.StatusManager.Database.Map.InputTableMap'; |
|
38 | - |
|
39 | - /** |
|
40 | - * The default database name for this class |
|
41 | - */ |
|
42 | - const DATABASE_NAME = 'tvheadend_status_manager'; |
|
43 | - |
|
44 | - /** |
|
45 | - * The table name for this class |
|
46 | - */ |
|
47 | - const TABLE_NAME = 'input'; |
|
48 | - |
|
49 | - /** |
|
50 | - * The related Propel class for this table |
|
51 | - */ |
|
52 | - const OM_CLASS = '\\Jalle19\\StatusManager\\Database\\Input'; |
|
53 | - |
|
54 | - /** |
|
55 | - * A class that can be returned by this tableMap |
|
56 | - */ |
|
57 | - const CLASS_DEFAULT = 'Jalle19.StatusManager.Database.Input'; |
|
58 | - |
|
59 | - /** |
|
60 | - * The total number of columns |
|
61 | - */ |
|
62 | - const NUM_COLUMNS = 7; |
|
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 = 7; |
|
73 | - |
|
74 | - /** |
|
75 | - * the column name for the uuid field |
|
76 | - */ |
|
77 | - const COL_UUID = 'input.uuid'; |
|
78 | - |
|
79 | - /** |
|
80 | - * the column name for the instance_name field |
|
81 | - */ |
|
82 | - const COL_INSTANCE_NAME = 'input.instance_name'; |
|
83 | - |
|
84 | - /** |
|
85 | - * the column name for the started field |
|
86 | - */ |
|
87 | - const COL_STARTED = 'input.started'; |
|
88 | - |
|
89 | - /** |
|
90 | - * the column name for the input field |
|
91 | - */ |
|
92 | - const COL_INPUT = 'input.input'; |
|
93 | - |
|
94 | - /** |
|
95 | - * the column name for the network field |
|
96 | - */ |
|
97 | - const COL_NETWORK = 'input.network'; |
|
98 | - |
|
99 | - /** |
|
100 | - * the column name for the mux field |
|
101 | - */ |
|
102 | - const COL_MUX = 'input.mux'; |
|
103 | - |
|
104 | - /** |
|
105 | - * the column name for the weight field |
|
106 | - */ |
|
107 | - const COL_WEIGHT = 'input.weight'; |
|
108 | - |
|
109 | - /** |
|
110 | - * The default string format for model objects of the related table |
|
111 | - */ |
|
112 | - const DEFAULT_STRING_FORMAT = 'YAML'; |
|
113 | - |
|
114 | - /** |
|
115 | - * holds an array of fieldnames |
|
116 | - * |
|
117 | - * first dimension keys are the type constants |
|
118 | - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' |
|
119 | - */ |
|
120 | - protected static $fieldNames = array ( |
|
121 | - self::TYPE_PHPNAME => array('Uuid', 'InstanceName', 'Started', 'Input', 'Network', 'Mux', 'Weight', ), |
|
122 | - self::TYPE_CAMELNAME => array('uuid', 'instanceName', 'started', 'input', 'network', 'mux', 'weight', ), |
|
123 | - self::TYPE_COLNAME => array(InputTableMap::COL_UUID, InputTableMap::COL_INSTANCE_NAME, InputTableMap::COL_STARTED, InputTableMap::COL_INPUT, InputTableMap::COL_NETWORK, InputTableMap::COL_MUX, InputTableMap::COL_WEIGHT, ), |
|
124 | - self::TYPE_FIELDNAME => array('uuid', 'instance_name', 'started', 'input', 'network', 'mux', 'weight', ), |
|
125 | - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, ) |
|
126 | - ); |
|
127 | - |
|
128 | - /** |
|
129 | - * holds an array of keys for quick access to the fieldnames array |
|
130 | - * |
|
131 | - * first dimension keys are the type constants |
|
132 | - * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 |
|
133 | - */ |
|
134 | - protected static $fieldKeys = array ( |
|
135 | - self::TYPE_PHPNAME => array('Uuid' => 0, 'InstanceName' => 1, 'Started' => 2, 'Input' => 3, 'Network' => 4, 'Mux' => 5, 'Weight' => 6, ), |
|
136 | - self::TYPE_CAMELNAME => array('uuid' => 0, 'instanceName' => 1, 'started' => 2, 'input' => 3, 'network' => 4, 'mux' => 5, 'weight' => 6, ), |
|
137 | - self::TYPE_COLNAME => array(InputTableMap::COL_UUID => 0, InputTableMap::COL_INSTANCE_NAME => 1, InputTableMap::COL_STARTED => 2, InputTableMap::COL_INPUT => 3, InputTableMap::COL_NETWORK => 4, InputTableMap::COL_MUX => 5, InputTableMap::COL_WEIGHT => 6, ), |
|
138 | - self::TYPE_FIELDNAME => array('uuid' => 0, 'instance_name' => 1, 'started' => 2, 'input' => 3, 'network' => 4, 'mux' => 5, 'weight' => 6, ), |
|
139 | - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, ) |
|
140 | - ); |
|
141 | - |
|
142 | - /** |
|
143 | - * Initialize the table attributes and columns |
|
144 | - * Relations are not initialized by this method since they are lazy loaded |
|
145 | - * |
|
146 | - * @return void |
|
147 | - * @throws PropelException |
|
148 | - */ |
|
149 | - public function initialize() |
|
150 | - { |
|
151 | - // attributes |
|
152 | - $this->setName('input'); |
|
153 | - $this->setPhpName('Input'); |
|
154 | - $this->setIdentifierQuoting(false); |
|
155 | - $this->setClassName('\\Jalle19\\StatusManager\\Database\\Input'); |
|
156 | - $this->setPackage('Jalle19.StatusManager.Database'); |
|
157 | - $this->setUseIdGenerator(false); |
|
158 | - // columns |
|
159 | - $this->addPrimaryKey('uuid', 'Uuid', 'VARCHAR', true, 255, null); |
|
160 | - $this->addForeignKey('instance_name', 'InstanceName', 'VARCHAR', 'instance', 'name', true, 255, null); |
|
161 | - $this->addColumn('started', 'Started', 'TIMESTAMP', true, null, null); |
|
162 | - $this->addColumn('input', 'Input', 'VARCHAR', true, 255, null); |
|
163 | - $this->addColumn('network', 'Network', 'VARCHAR', true, 255, null); |
|
164 | - $this->addColumn('mux', 'Mux', 'VARCHAR', true, 255, null); |
|
165 | - $this->addColumn('weight', 'Weight', 'INTEGER', true, null, null); |
|
166 | - } // initialize() |
|
167 | - |
|
168 | - /** |
|
169 | - * Build the RelationMap objects for this table relationships |
|
170 | - */ |
|
171 | - public function buildRelations() |
|
172 | - { |
|
173 | - $this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array ( |
|
31 | + use InstancePoolTrait; |
|
32 | + use TableMapTrait; |
|
33 | + |
|
34 | + /** |
|
35 | + * The (dot-path) name of this class |
|
36 | + */ |
|
37 | + const CLASS_NAME = 'Jalle19.StatusManager.Database.Map.InputTableMap'; |
|
38 | + |
|
39 | + /** |
|
40 | + * The default database name for this class |
|
41 | + */ |
|
42 | + const DATABASE_NAME = 'tvheadend_status_manager'; |
|
43 | + |
|
44 | + /** |
|
45 | + * The table name for this class |
|
46 | + */ |
|
47 | + const TABLE_NAME = 'input'; |
|
48 | + |
|
49 | + /** |
|
50 | + * The related Propel class for this table |
|
51 | + */ |
|
52 | + const OM_CLASS = '\\Jalle19\\StatusManager\\Database\\Input'; |
|
53 | + |
|
54 | + /** |
|
55 | + * A class that can be returned by this tableMap |
|
56 | + */ |
|
57 | + const CLASS_DEFAULT = 'Jalle19.StatusManager.Database.Input'; |
|
58 | + |
|
59 | + /** |
|
60 | + * The total number of columns |
|
61 | + */ |
|
62 | + const NUM_COLUMNS = 7; |
|
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 = 7; |
|
73 | + |
|
74 | + /** |
|
75 | + * the column name for the uuid field |
|
76 | + */ |
|
77 | + const COL_UUID = 'input.uuid'; |
|
78 | + |
|
79 | + /** |
|
80 | + * the column name for the instance_name field |
|
81 | + */ |
|
82 | + const COL_INSTANCE_NAME = 'input.instance_name'; |
|
83 | + |
|
84 | + /** |
|
85 | + * the column name for the started field |
|
86 | + */ |
|
87 | + const COL_STARTED = 'input.started'; |
|
88 | + |
|
89 | + /** |
|
90 | + * the column name for the input field |
|
91 | + */ |
|
92 | + const COL_INPUT = 'input.input'; |
|
93 | + |
|
94 | + /** |
|
95 | + * the column name for the network field |
|
96 | + */ |
|
97 | + const COL_NETWORK = 'input.network'; |
|
98 | + |
|
99 | + /** |
|
100 | + * the column name for the mux field |
|
101 | + */ |
|
102 | + const COL_MUX = 'input.mux'; |
|
103 | + |
|
104 | + /** |
|
105 | + * the column name for the weight field |
|
106 | + */ |
|
107 | + const COL_WEIGHT = 'input.weight'; |
|
108 | + |
|
109 | + /** |
|
110 | + * The default string format for model objects of the related table |
|
111 | + */ |
|
112 | + const DEFAULT_STRING_FORMAT = 'YAML'; |
|
113 | + |
|
114 | + /** |
|
115 | + * holds an array of fieldnames |
|
116 | + * |
|
117 | + * first dimension keys are the type constants |
|
118 | + * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' |
|
119 | + */ |
|
120 | + protected static $fieldNames = array ( |
|
121 | + self::TYPE_PHPNAME => array('Uuid', 'InstanceName', 'Started', 'Input', 'Network', 'Mux', 'Weight', ), |
|
122 | + self::TYPE_CAMELNAME => array('uuid', 'instanceName', 'started', 'input', 'network', 'mux', 'weight', ), |
|
123 | + self::TYPE_COLNAME => array(InputTableMap::COL_UUID, InputTableMap::COL_INSTANCE_NAME, InputTableMap::COL_STARTED, InputTableMap::COL_INPUT, InputTableMap::COL_NETWORK, InputTableMap::COL_MUX, InputTableMap::COL_WEIGHT, ), |
|
124 | + self::TYPE_FIELDNAME => array('uuid', 'instance_name', 'started', 'input', 'network', 'mux', 'weight', ), |
|
125 | + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, ) |
|
126 | + ); |
|
127 | + |
|
128 | + /** |
|
129 | + * holds an array of keys for quick access to the fieldnames array |
|
130 | + * |
|
131 | + * first dimension keys are the type constants |
|
132 | + * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 |
|
133 | + */ |
|
134 | + protected static $fieldKeys = array ( |
|
135 | + self::TYPE_PHPNAME => array('Uuid' => 0, 'InstanceName' => 1, 'Started' => 2, 'Input' => 3, 'Network' => 4, 'Mux' => 5, 'Weight' => 6, ), |
|
136 | + self::TYPE_CAMELNAME => array('uuid' => 0, 'instanceName' => 1, 'started' => 2, 'input' => 3, 'network' => 4, 'mux' => 5, 'weight' => 6, ), |
|
137 | + self::TYPE_COLNAME => array(InputTableMap::COL_UUID => 0, InputTableMap::COL_INSTANCE_NAME => 1, InputTableMap::COL_STARTED => 2, InputTableMap::COL_INPUT => 3, InputTableMap::COL_NETWORK => 4, InputTableMap::COL_MUX => 5, InputTableMap::COL_WEIGHT => 6, ), |
|
138 | + self::TYPE_FIELDNAME => array('uuid' => 0, 'instance_name' => 1, 'started' => 2, 'input' => 3, 'network' => 4, 'mux' => 5, 'weight' => 6, ), |
|
139 | + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, ) |
|
140 | + ); |
|
141 | + |
|
142 | + /** |
|
143 | + * Initialize the table attributes and columns |
|
144 | + * Relations are not initialized by this method since they are lazy loaded |
|
145 | + * |
|
146 | + * @return void |
|
147 | + * @throws PropelException |
|
148 | + */ |
|
149 | + public function initialize() |
|
150 | + { |
|
151 | + // attributes |
|
152 | + $this->setName('input'); |
|
153 | + $this->setPhpName('Input'); |
|
154 | + $this->setIdentifierQuoting(false); |
|
155 | + $this->setClassName('\\Jalle19\\StatusManager\\Database\\Input'); |
|
156 | + $this->setPackage('Jalle19.StatusManager.Database'); |
|
157 | + $this->setUseIdGenerator(false); |
|
158 | + // columns |
|
159 | + $this->addPrimaryKey('uuid', 'Uuid', 'VARCHAR', true, 255, null); |
|
160 | + $this->addForeignKey('instance_name', 'InstanceName', 'VARCHAR', 'instance', 'name', true, 255, null); |
|
161 | + $this->addColumn('started', 'Started', 'TIMESTAMP', true, null, null); |
|
162 | + $this->addColumn('input', 'Input', 'VARCHAR', true, 255, null); |
|
163 | + $this->addColumn('network', 'Network', 'VARCHAR', true, 255, null); |
|
164 | + $this->addColumn('mux', 'Mux', 'VARCHAR', true, 255, null); |
|
165 | + $this->addColumn('weight', 'Weight', 'INTEGER', true, null, null); |
|
166 | + } // initialize() |
|
167 | + |
|
168 | + /** |
|
169 | + * Build the RelationMap objects for this table relationships |
|
170 | + */ |
|
171 | + public function buildRelations() |
|
172 | + { |
|
173 | + $this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array ( |
|
174 | 174 | 0 => |
175 | 175 | array ( |
176 | - 0 => ':instance_name', |
|
177 | - 1 => ':name', |
|
176 | + 0 => ':instance_name', |
|
177 | + 1 => ':name', |
|
178 | 178 | ), |
179 | 179 | ), null, null, null, false); |
180 | - $this->addRelation('Subscription', '\\Jalle19\\StatusManager\\Database\\Subscription', RelationMap::ONE_TO_MANY, array ( |
|
180 | + $this->addRelation('Subscription', '\\Jalle19\\StatusManager\\Database\\Subscription', RelationMap::ONE_TO_MANY, array ( |
|
181 | 181 | 0 => |
182 | 182 | array ( |
183 | - 0 => ':input_uuid', |
|
184 | - 1 => ':uuid', |
|
183 | + 0 => ':input_uuid', |
|
184 | + 1 => ':uuid', |
|
185 | 185 | ), |
186 | 186 | ), null, null, 'Subscriptions', false); |
187 | - } // buildRelations() |
|
188 | - |
|
189 | - /** |
|
190 | - * 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. |
|
191 | - * |
|
192 | - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with |
|
193 | - * a multi-column primary key, a serialize()d version of the primary key will be returned. |
|
194 | - * |
|
195 | - * @param array $row resultset row. |
|
196 | - * @param int $offset The 0-based offset for reading from the resultset row. |
|
197 | - * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
|
198 | - * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM |
|
199 | - * |
|
200 | - * @return string The primary key hash of the row |
|
201 | - */ |
|
202 | - public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
203 | - { |
|
204 | - // If the PK cannot be derived from the row, return NULL. |
|
205 | - if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Uuid', TableMap::TYPE_PHPNAME, $indexType)] === null) { |
|
206 | - return null; |
|
207 | - } |
|
208 | - |
|
209 | - return null === $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Uuid', TableMap::TYPE_PHPNAME, $indexType)] || is_scalar($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Uuid', TableMap::TYPE_PHPNAME, $indexType)]) || is_callable([$row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Uuid', TableMap::TYPE_PHPNAME, $indexType)], '__toString']) ? (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Uuid', TableMap::TYPE_PHPNAME, $indexType)] : $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Uuid', TableMap::TYPE_PHPNAME, $indexType)]; |
|
210 | - } |
|
211 | - |
|
212 | - /** |
|
213 | - * Retrieves the primary key from the DB resultset row |
|
214 | - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with |
|
215 | - * a multi-column primary key, an array of the primary key columns will be returned. |
|
216 | - * |
|
217 | - * @param array $row resultset row. |
|
218 | - * @param int $offset The 0-based offset for reading from the resultset row. |
|
219 | - * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
|
220 | - * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM |
|
221 | - * |
|
222 | - * @return mixed The primary key of the row |
|
223 | - */ |
|
224 | - public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
225 | - { |
|
226 | - return (string) $row[ |
|
227 | - $indexType == TableMap::TYPE_NUM |
|
228 | - ? 0 + $offset |
|
229 | - : self::translateFieldName('Uuid', TableMap::TYPE_PHPNAME, $indexType) |
|
230 | - ]; |
|
231 | - } |
|
232 | - |
|
233 | - /** |
|
234 | - * The class that the tableMap will make instances of. |
|
235 | - * |
|
236 | - * If $withPrefix is true, the returned path |
|
237 | - * uses a dot-path notation which is translated into a path |
|
238 | - * relative to a location on the PHP include_path. |
|
239 | - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') |
|
240 | - * |
|
241 | - * @param boolean $withPrefix Whether or not to return the path with the class name |
|
242 | - * @return string path.to.ClassName |
|
243 | - */ |
|
244 | - public static function getOMClass($withPrefix = true) |
|
245 | - { |
|
246 | - return $withPrefix ? InputTableMap::CLASS_DEFAULT : InputTableMap::OM_CLASS; |
|
247 | - } |
|
248 | - |
|
249 | - /** |
|
250 | - * Populates an object of the default type or an object that inherit from the default. |
|
251 | - * |
|
252 | - * @param array $row row returned by DataFetcher->fetch(). |
|
253 | - * @param int $offset The 0-based offset for reading from the resultset row. |
|
254 | - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). |
|
187 | + } // buildRelations() |
|
188 | + |
|
189 | + /** |
|
190 | + * 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. |
|
191 | + * |
|
192 | + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with |
|
193 | + * a multi-column primary key, a serialize()d version of the primary key will be returned. |
|
194 | + * |
|
195 | + * @param array $row resultset row. |
|
196 | + * @param int $offset The 0-based offset for reading from the resultset row. |
|
197 | + * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
|
198 | + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM |
|
199 | + * |
|
200 | + * @return string The primary key hash of the row |
|
201 | + */ |
|
202 | + public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
203 | + { |
|
204 | + // If the PK cannot be derived from the row, return NULL. |
|
205 | + if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Uuid', TableMap::TYPE_PHPNAME, $indexType)] === null) { |
|
206 | + return null; |
|
207 | + } |
|
208 | + |
|
209 | + return null === $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Uuid', TableMap::TYPE_PHPNAME, $indexType)] || is_scalar($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Uuid', TableMap::TYPE_PHPNAME, $indexType)]) || is_callable([$row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Uuid', TableMap::TYPE_PHPNAME, $indexType)], '__toString']) ? (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Uuid', TableMap::TYPE_PHPNAME, $indexType)] : $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Uuid', TableMap::TYPE_PHPNAME, $indexType)]; |
|
210 | + } |
|
211 | + |
|
212 | + /** |
|
213 | + * Retrieves the primary key from the DB resultset row |
|
214 | + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with |
|
215 | + * a multi-column primary key, an array of the primary key columns will be returned. |
|
216 | + * |
|
217 | + * @param array $row resultset row. |
|
218 | + * @param int $offset The 0-based offset for reading from the resultset row. |
|
219 | + * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
|
220 | + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM |
|
221 | + * |
|
222 | + * @return mixed The primary key of the row |
|
223 | + */ |
|
224 | + public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
225 | + { |
|
226 | + return (string) $row[ |
|
227 | + $indexType == TableMap::TYPE_NUM |
|
228 | + ? 0 + $offset |
|
229 | + : self::translateFieldName('Uuid', TableMap::TYPE_PHPNAME, $indexType) |
|
230 | + ]; |
|
231 | + } |
|
232 | + |
|
233 | + /** |
|
234 | + * The class that the tableMap will make instances of. |
|
235 | + * |
|
236 | + * If $withPrefix is true, the returned path |
|
237 | + * uses a dot-path notation which is translated into a path |
|
238 | + * relative to a location on the PHP include_path. |
|
239 | + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') |
|
240 | + * |
|
241 | + * @param boolean $withPrefix Whether or not to return the path with the class name |
|
242 | + * @return string path.to.ClassName |
|
243 | + */ |
|
244 | + public static function getOMClass($withPrefix = true) |
|
245 | + { |
|
246 | + return $withPrefix ? InputTableMap::CLASS_DEFAULT : InputTableMap::OM_CLASS; |
|
247 | + } |
|
248 | + |
|
249 | + /** |
|
250 | + * Populates an object of the default type or an object that inherit from the default. |
|
251 | + * |
|
252 | + * @param array $row row returned by DataFetcher->fetch(). |
|
253 | + * @param int $offset The 0-based offset for reading from the resultset row. |
|
254 | + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). |
|
255 | 255 | One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
256 | - * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
|
257 | - * |
|
258 | - * @throws PropelException Any exceptions caught during processing will be |
|
259 | - * rethrown wrapped into a PropelException. |
|
260 | - * @return array (Input object, last column rank) |
|
261 | - */ |
|
262 | - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
263 | - { |
|
264 | - $key = InputTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); |
|
265 | - if (null !== ($obj = InputTableMap::getInstanceFromPool($key))) { |
|
266 | - // We no longer rehydrate the object, since this can cause data loss. |
|
267 | - // See http://www.propelorm.org/ticket/509 |
|
268 | - // $obj->hydrate($row, $offset, true); // rehydrate |
|
269 | - $col = $offset + InputTableMap::NUM_HYDRATE_COLUMNS; |
|
270 | - } else { |
|
271 | - $cls = InputTableMap::OM_CLASS; |
|
272 | - /** @var Input $obj */ |
|
273 | - $obj = new $cls(); |
|
274 | - $col = $obj->hydrate($row, $offset, false, $indexType); |
|
275 | - InputTableMap::addInstanceToPool($obj, $key); |
|
276 | - } |
|
277 | - |
|
278 | - return array($obj, $col); |
|
279 | - } |
|
280 | - |
|
281 | - /** |
|
282 | - * The returned array will contain objects of the default type or |
|
283 | - * objects that inherit from the default. |
|
284 | - * |
|
285 | - * @param DataFetcherInterface $dataFetcher |
|
286 | - * @return array |
|
287 | - * @throws PropelException Any exceptions caught during processing will be |
|
288 | - * rethrown wrapped into a PropelException. |
|
289 | - */ |
|
290 | - public static function populateObjects(DataFetcherInterface $dataFetcher) |
|
291 | - { |
|
292 | - $results = array(); |
|
293 | - |
|
294 | - // set the class once to avoid overhead in the loop |
|
295 | - $cls = static::getOMClass(false); |
|
296 | - // populate the object(s) |
|
297 | - while ($row = $dataFetcher->fetch()) { |
|
298 | - $key = InputTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); |
|
299 | - if (null !== ($obj = InputTableMap::getInstanceFromPool($key))) { |
|
300 | - // We no longer rehydrate the object, since this can cause data loss. |
|
301 | - // See http://www.propelorm.org/ticket/509 |
|
302 | - // $obj->hydrate($row, 0, true); // rehydrate |
|
303 | - $results[] = $obj; |
|
304 | - } else { |
|
305 | - /** @var Input $obj */ |
|
306 | - $obj = new $cls(); |
|
307 | - $obj->hydrate($row); |
|
308 | - $results[] = $obj; |
|
309 | - InputTableMap::addInstanceToPool($obj, $key); |
|
310 | - } // if key exists |
|
311 | - } |
|
312 | - |
|
313 | - return $results; |
|
314 | - } |
|
315 | - /** |
|
316 | - * Add all the columns needed to create a new object. |
|
317 | - * |
|
318 | - * Note: any columns that were marked with lazyLoad="true" in the |
|
319 | - * XML schema will not be added to the select list and only loaded |
|
320 | - * on demand. |
|
321 | - * |
|
322 | - * @param Criteria $criteria object containing the columns to add. |
|
323 | - * @param string $alias optional table alias |
|
324 | - * @throws PropelException Any exceptions caught during processing will be |
|
325 | - * rethrown wrapped into a PropelException. |
|
326 | - */ |
|
327 | - public static function addSelectColumns(Criteria $criteria, $alias = null) |
|
328 | - { |
|
329 | - if (null === $alias) { |
|
330 | - $criteria->addSelectColumn(InputTableMap::COL_UUID); |
|
331 | - $criteria->addSelectColumn(InputTableMap::COL_INSTANCE_NAME); |
|
332 | - $criteria->addSelectColumn(InputTableMap::COL_STARTED); |
|
333 | - $criteria->addSelectColumn(InputTableMap::COL_INPUT); |
|
334 | - $criteria->addSelectColumn(InputTableMap::COL_NETWORK); |
|
335 | - $criteria->addSelectColumn(InputTableMap::COL_MUX); |
|
336 | - $criteria->addSelectColumn(InputTableMap::COL_WEIGHT); |
|
337 | - } else { |
|
338 | - $criteria->addSelectColumn($alias . '.uuid'); |
|
339 | - $criteria->addSelectColumn($alias . '.instance_name'); |
|
340 | - $criteria->addSelectColumn($alias . '.started'); |
|
341 | - $criteria->addSelectColumn($alias . '.input'); |
|
342 | - $criteria->addSelectColumn($alias . '.network'); |
|
343 | - $criteria->addSelectColumn($alias . '.mux'); |
|
344 | - $criteria->addSelectColumn($alias . '.weight'); |
|
345 | - } |
|
346 | - } |
|
347 | - |
|
348 | - /** |
|
349 | - * Returns the TableMap related to this object. |
|
350 | - * This method is not needed for general use but a specific application could have a need. |
|
351 | - * @return TableMap |
|
352 | - * @throws PropelException Any exceptions caught during processing will be |
|
353 | - * rethrown wrapped into a PropelException. |
|
354 | - */ |
|
355 | - public static function getTableMap() |
|
356 | - { |
|
357 | - return Propel::getServiceContainer()->getDatabaseMap(InputTableMap::DATABASE_NAME)->getTable(InputTableMap::TABLE_NAME); |
|
358 | - } |
|
359 | - |
|
360 | - /** |
|
361 | - * Add a TableMap instance to the database for this tableMap class. |
|
362 | - */ |
|
363 | - public static function buildTableMap() |
|
364 | - { |
|
365 | - $dbMap = Propel::getServiceContainer()->getDatabaseMap(InputTableMap::DATABASE_NAME); |
|
366 | - if (!$dbMap->hasTable(InputTableMap::TABLE_NAME)) { |
|
367 | - $dbMap->addTableObject(new InputTableMap()); |
|
368 | - } |
|
369 | - } |
|
370 | - |
|
371 | - /** |
|
372 | - * Performs a DELETE on the database, given a Input or Criteria object OR a primary key value. |
|
373 | - * |
|
374 | - * @param mixed $values Criteria or Input object or primary key or array of primary keys |
|
375 | - * which is used to create the DELETE statement |
|
376 | - * @param ConnectionInterface $con the connection to use |
|
377 | - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows |
|
378 | - * if supported by native driver or if emulated using Propel. |
|
379 | - * @throws PropelException Any exceptions caught during processing will be |
|
380 | - * rethrown wrapped into a PropelException. |
|
381 | - */ |
|
382 | - public static function doDelete($values, ConnectionInterface $con = null) |
|
383 | - { |
|
384 | - if (null === $con) { |
|
385 | - $con = Propel::getServiceContainer()->getWriteConnection(InputTableMap::DATABASE_NAME); |
|
386 | - } |
|
387 | - |
|
388 | - if ($values instanceof Criteria) { |
|
389 | - // rename for clarity |
|
390 | - $criteria = $values; |
|
391 | - } elseif ($values instanceof \Jalle19\StatusManager\Database\Input) { // it's a model object |
|
392 | - // create criteria based on pk values |
|
393 | - $criteria = $values->buildPkeyCriteria(); |
|
394 | - } else { // it's a primary key, or an array of pks |
|
395 | - $criteria = new Criteria(InputTableMap::DATABASE_NAME); |
|
396 | - $criteria->add(InputTableMap::COL_UUID, (array) $values, Criteria::IN); |
|
397 | - } |
|
398 | - |
|
399 | - $query = InputQuery::create()->mergeWith($criteria); |
|
400 | - |
|
401 | - if ($values instanceof Criteria) { |
|
402 | - InputTableMap::clearInstancePool(); |
|
403 | - } elseif (!is_object($values)) { // it's a primary key, or an array of pks |
|
404 | - foreach ((array) $values as $singleval) { |
|
405 | - InputTableMap::removeInstanceFromPool($singleval); |
|
406 | - } |
|
407 | - } |
|
408 | - |
|
409 | - return $query->delete($con); |
|
410 | - } |
|
411 | - |
|
412 | - /** |
|
413 | - * Deletes all rows from the input table. |
|
414 | - * |
|
415 | - * @param ConnectionInterface $con the connection to use |
|
416 | - * @return int The number of affected rows (if supported by underlying database driver). |
|
417 | - */ |
|
418 | - public static function doDeleteAll(ConnectionInterface $con = null) |
|
419 | - { |
|
420 | - return InputQuery::create()->doDeleteAll($con); |
|
421 | - } |
|
422 | - |
|
423 | - /** |
|
424 | - * Performs an INSERT on the database, given a Input or Criteria object. |
|
425 | - * |
|
426 | - * @param mixed $criteria Criteria or Input object containing data that is used to create the INSERT statement. |
|
427 | - * @param ConnectionInterface $con the ConnectionInterface connection to use |
|
428 | - * @return mixed The new primary key. |
|
429 | - * @throws PropelException Any exceptions caught during processing will be |
|
430 | - * rethrown wrapped into a PropelException. |
|
431 | - */ |
|
432 | - public static function doInsert($criteria, ConnectionInterface $con = null) |
|
433 | - { |
|
434 | - if (null === $con) { |
|
435 | - $con = Propel::getServiceContainer()->getWriteConnection(InputTableMap::DATABASE_NAME); |
|
436 | - } |
|
437 | - |
|
438 | - if ($criteria instanceof Criteria) { |
|
439 | - $criteria = clone $criteria; // rename for clarity |
|
440 | - } else { |
|
441 | - $criteria = $criteria->buildCriteria(); // build Criteria from Input object |
|
442 | - } |
|
443 | - |
|
444 | - |
|
445 | - // Set the correct dbName |
|
446 | - $query = InputQuery::create()->mergeWith($criteria); |
|
447 | - |
|
448 | - // use transaction because $criteria could contain info |
|
449 | - // for more than one table (I guess, conceivably) |
|
450 | - return $con->transaction(function () use ($con, $query) { |
|
451 | - return $query->doInsert($con); |
|
452 | - }); |
|
453 | - } |
|
256 | + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
|
257 | + * |
|
258 | + * @throws PropelException Any exceptions caught during processing will be |
|
259 | + * rethrown wrapped into a PropelException. |
|
260 | + * @return array (Input object, last column rank) |
|
261 | + */ |
|
262 | + public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
263 | + { |
|
264 | + $key = InputTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); |
|
265 | + if (null !== ($obj = InputTableMap::getInstanceFromPool($key))) { |
|
266 | + // We no longer rehydrate the object, since this can cause data loss. |
|
267 | + // See http://www.propelorm.org/ticket/509 |
|
268 | + // $obj->hydrate($row, $offset, true); // rehydrate |
|
269 | + $col = $offset + InputTableMap::NUM_HYDRATE_COLUMNS; |
|
270 | + } else { |
|
271 | + $cls = InputTableMap::OM_CLASS; |
|
272 | + /** @var Input $obj */ |
|
273 | + $obj = new $cls(); |
|
274 | + $col = $obj->hydrate($row, $offset, false, $indexType); |
|
275 | + InputTableMap::addInstanceToPool($obj, $key); |
|
276 | + } |
|
277 | + |
|
278 | + return array($obj, $col); |
|
279 | + } |
|
280 | + |
|
281 | + /** |
|
282 | + * The returned array will contain objects of the default type or |
|
283 | + * objects that inherit from the default. |
|
284 | + * |
|
285 | + * @param DataFetcherInterface $dataFetcher |
|
286 | + * @return array |
|
287 | + * @throws PropelException Any exceptions caught during processing will be |
|
288 | + * rethrown wrapped into a PropelException. |
|
289 | + */ |
|
290 | + public static function populateObjects(DataFetcherInterface $dataFetcher) |
|
291 | + { |
|
292 | + $results = array(); |
|
293 | + |
|
294 | + // set the class once to avoid overhead in the loop |
|
295 | + $cls = static::getOMClass(false); |
|
296 | + // populate the object(s) |
|
297 | + while ($row = $dataFetcher->fetch()) { |
|
298 | + $key = InputTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); |
|
299 | + if (null !== ($obj = InputTableMap::getInstanceFromPool($key))) { |
|
300 | + // We no longer rehydrate the object, since this can cause data loss. |
|
301 | + // See http://www.propelorm.org/ticket/509 |
|
302 | + // $obj->hydrate($row, 0, true); // rehydrate |
|
303 | + $results[] = $obj; |
|
304 | + } else { |
|
305 | + /** @var Input $obj */ |
|
306 | + $obj = new $cls(); |
|
307 | + $obj->hydrate($row); |
|
308 | + $results[] = $obj; |
|
309 | + InputTableMap::addInstanceToPool($obj, $key); |
|
310 | + } // if key exists |
|
311 | + } |
|
312 | + |
|
313 | + return $results; |
|
314 | + } |
|
315 | + /** |
|
316 | + * Add all the columns needed to create a new object. |
|
317 | + * |
|
318 | + * Note: any columns that were marked with lazyLoad="true" in the |
|
319 | + * XML schema will not be added to the select list and only loaded |
|
320 | + * on demand. |
|
321 | + * |
|
322 | + * @param Criteria $criteria object containing the columns to add. |
|
323 | + * @param string $alias optional table alias |
|
324 | + * @throws PropelException Any exceptions caught during processing will be |
|
325 | + * rethrown wrapped into a PropelException. |
|
326 | + */ |
|
327 | + public static function addSelectColumns(Criteria $criteria, $alias = null) |
|
328 | + { |
|
329 | + if (null === $alias) { |
|
330 | + $criteria->addSelectColumn(InputTableMap::COL_UUID); |
|
331 | + $criteria->addSelectColumn(InputTableMap::COL_INSTANCE_NAME); |
|
332 | + $criteria->addSelectColumn(InputTableMap::COL_STARTED); |
|
333 | + $criteria->addSelectColumn(InputTableMap::COL_INPUT); |
|
334 | + $criteria->addSelectColumn(InputTableMap::COL_NETWORK); |
|
335 | + $criteria->addSelectColumn(InputTableMap::COL_MUX); |
|
336 | + $criteria->addSelectColumn(InputTableMap::COL_WEIGHT); |
|
337 | + } else { |
|
338 | + $criteria->addSelectColumn($alias . '.uuid'); |
|
339 | + $criteria->addSelectColumn($alias . '.instance_name'); |
|
340 | + $criteria->addSelectColumn($alias . '.started'); |
|
341 | + $criteria->addSelectColumn($alias . '.input'); |
|
342 | + $criteria->addSelectColumn($alias . '.network'); |
|
343 | + $criteria->addSelectColumn($alias . '.mux'); |
|
344 | + $criteria->addSelectColumn($alias . '.weight'); |
|
345 | + } |
|
346 | + } |
|
347 | + |
|
348 | + /** |
|
349 | + * Returns the TableMap related to this object. |
|
350 | + * This method is not needed for general use but a specific application could have a need. |
|
351 | + * @return TableMap |
|
352 | + * @throws PropelException Any exceptions caught during processing will be |
|
353 | + * rethrown wrapped into a PropelException. |
|
354 | + */ |
|
355 | + public static function getTableMap() |
|
356 | + { |
|
357 | + return Propel::getServiceContainer()->getDatabaseMap(InputTableMap::DATABASE_NAME)->getTable(InputTableMap::TABLE_NAME); |
|
358 | + } |
|
359 | + |
|
360 | + /** |
|
361 | + * Add a TableMap instance to the database for this tableMap class. |
|
362 | + */ |
|
363 | + public static function buildTableMap() |
|
364 | + { |
|
365 | + $dbMap = Propel::getServiceContainer()->getDatabaseMap(InputTableMap::DATABASE_NAME); |
|
366 | + if (!$dbMap->hasTable(InputTableMap::TABLE_NAME)) { |
|
367 | + $dbMap->addTableObject(new InputTableMap()); |
|
368 | + } |
|
369 | + } |
|
370 | + |
|
371 | + /** |
|
372 | + * Performs a DELETE on the database, given a Input or Criteria object OR a primary key value. |
|
373 | + * |
|
374 | + * @param mixed $values Criteria or Input object or primary key or array of primary keys |
|
375 | + * which is used to create the DELETE statement |
|
376 | + * @param ConnectionInterface $con the connection to use |
|
377 | + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows |
|
378 | + * if supported by native driver or if emulated using Propel. |
|
379 | + * @throws PropelException Any exceptions caught during processing will be |
|
380 | + * rethrown wrapped into a PropelException. |
|
381 | + */ |
|
382 | + public static function doDelete($values, ConnectionInterface $con = null) |
|
383 | + { |
|
384 | + if (null === $con) { |
|
385 | + $con = Propel::getServiceContainer()->getWriteConnection(InputTableMap::DATABASE_NAME); |
|
386 | + } |
|
387 | + |
|
388 | + if ($values instanceof Criteria) { |
|
389 | + // rename for clarity |
|
390 | + $criteria = $values; |
|
391 | + } elseif ($values instanceof \Jalle19\StatusManager\Database\Input) { // it's a model object |
|
392 | + // create criteria based on pk values |
|
393 | + $criteria = $values->buildPkeyCriteria(); |
|
394 | + } else { // it's a primary key, or an array of pks |
|
395 | + $criteria = new Criteria(InputTableMap::DATABASE_NAME); |
|
396 | + $criteria->add(InputTableMap::COL_UUID, (array) $values, Criteria::IN); |
|
397 | + } |
|
398 | + |
|
399 | + $query = InputQuery::create()->mergeWith($criteria); |
|
400 | + |
|
401 | + if ($values instanceof Criteria) { |
|
402 | + InputTableMap::clearInstancePool(); |
|
403 | + } elseif (!is_object($values)) { // it's a primary key, or an array of pks |
|
404 | + foreach ((array) $values as $singleval) { |
|
405 | + InputTableMap::removeInstanceFromPool($singleval); |
|
406 | + } |
|
407 | + } |
|
408 | + |
|
409 | + return $query->delete($con); |
|
410 | + } |
|
411 | + |
|
412 | + /** |
|
413 | + * Deletes all rows from the input table. |
|
414 | + * |
|
415 | + * @param ConnectionInterface $con the connection to use |
|
416 | + * @return int The number of affected rows (if supported by underlying database driver). |
|
417 | + */ |
|
418 | + public static function doDeleteAll(ConnectionInterface $con = null) |
|
419 | + { |
|
420 | + return InputQuery::create()->doDeleteAll($con); |
|
421 | + } |
|
422 | + |
|
423 | + /** |
|
424 | + * Performs an INSERT on the database, given a Input or Criteria object. |
|
425 | + * |
|
426 | + * @param mixed $criteria Criteria or Input object containing data that is used to create the INSERT statement. |
|
427 | + * @param ConnectionInterface $con the ConnectionInterface connection to use |
|
428 | + * @return mixed The new primary key. |
|
429 | + * @throws PropelException Any exceptions caught during processing will be |
|
430 | + * rethrown wrapped into a PropelException. |
|
431 | + */ |
|
432 | + public static function doInsert($criteria, ConnectionInterface $con = null) |
|
433 | + { |
|
434 | + if (null === $con) { |
|
435 | + $con = Propel::getServiceContainer()->getWriteConnection(InputTableMap::DATABASE_NAME); |
|
436 | + } |
|
437 | + |
|
438 | + if ($criteria instanceof Criteria) { |
|
439 | + $criteria = clone $criteria; // rename for clarity |
|
440 | + } else { |
|
441 | + $criteria = $criteria->buildCriteria(); // build Criteria from Input object |
|
442 | + } |
|
443 | + |
|
444 | + |
|
445 | + // Set the correct dbName |
|
446 | + $query = InputQuery::create()->mergeWith($criteria); |
|
447 | + |
|
448 | + // use transaction because $criteria could contain info |
|
449 | + // for more than one table (I guess, conceivably) |
|
450 | + return $con->transaction(function () use ($con, $query) { |
|
451 | + return $query->doInsert($con); |
|
452 | + }); |
|
453 | + } |
|
454 | 454 | |
455 | 455 | } // InputTableMap |
456 | 456 | // This is the static code needed to register the TableMap for this table with the main Propel class. |
@@ -117,12 +117,12 @@ discard block |
||
117 | 117 | * first dimension keys are the type constants |
118 | 118 | * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' |
119 | 119 | */ |
120 | - protected static $fieldNames = array ( |
|
121 | - self::TYPE_PHPNAME => array('Uuid', 'InstanceName', 'Started', 'Input', 'Network', 'Mux', 'Weight', ), |
|
122 | - self::TYPE_CAMELNAME => array('uuid', 'instanceName', 'started', 'input', 'network', 'mux', 'weight', ), |
|
123 | - self::TYPE_COLNAME => array(InputTableMap::COL_UUID, InputTableMap::COL_INSTANCE_NAME, InputTableMap::COL_STARTED, InputTableMap::COL_INPUT, InputTableMap::COL_NETWORK, InputTableMap::COL_MUX, InputTableMap::COL_WEIGHT, ), |
|
124 | - self::TYPE_FIELDNAME => array('uuid', 'instance_name', 'started', 'input', 'network', 'mux', 'weight', ), |
|
125 | - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, ) |
|
120 | + protected static $fieldNames = array( |
|
121 | + self::TYPE_PHPNAME => array('Uuid', 'InstanceName', 'Started', 'Input', 'Network', 'Mux', 'Weight',), |
|
122 | + self::TYPE_CAMELNAME => array('uuid', 'instanceName', 'started', 'input', 'network', 'mux', 'weight',), |
|
123 | + self::TYPE_COLNAME => array(InputTableMap::COL_UUID, InputTableMap::COL_INSTANCE_NAME, InputTableMap::COL_STARTED, InputTableMap::COL_INPUT, InputTableMap::COL_NETWORK, InputTableMap::COL_MUX, InputTableMap::COL_WEIGHT,), |
|
124 | + self::TYPE_FIELDNAME => array('uuid', 'instance_name', 'started', 'input', 'network', 'mux', 'weight',), |
|
125 | + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6,) |
|
126 | 126 | ); |
127 | 127 | |
128 | 128 | /** |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | * first dimension keys are the type constants |
132 | 132 | * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 |
133 | 133 | */ |
134 | - protected static $fieldKeys = array ( |
|
135 | - self::TYPE_PHPNAME => array('Uuid' => 0, 'InstanceName' => 1, 'Started' => 2, 'Input' => 3, 'Network' => 4, 'Mux' => 5, 'Weight' => 6, ), |
|
136 | - self::TYPE_CAMELNAME => array('uuid' => 0, 'instanceName' => 1, 'started' => 2, 'input' => 3, 'network' => 4, 'mux' => 5, 'weight' => 6, ), |
|
137 | - self::TYPE_COLNAME => array(InputTableMap::COL_UUID => 0, InputTableMap::COL_INSTANCE_NAME => 1, InputTableMap::COL_STARTED => 2, InputTableMap::COL_INPUT => 3, InputTableMap::COL_NETWORK => 4, InputTableMap::COL_MUX => 5, InputTableMap::COL_WEIGHT => 6, ), |
|
138 | - self::TYPE_FIELDNAME => array('uuid' => 0, 'instance_name' => 1, 'started' => 2, 'input' => 3, 'network' => 4, 'mux' => 5, 'weight' => 6, ), |
|
139 | - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, ) |
|
134 | + protected static $fieldKeys = array( |
|
135 | + self::TYPE_PHPNAME => array('Uuid' => 0, 'InstanceName' => 1, 'Started' => 2, 'Input' => 3, 'Network' => 4, 'Mux' => 5, 'Weight' => 6,), |
|
136 | + self::TYPE_CAMELNAME => array('uuid' => 0, 'instanceName' => 1, 'started' => 2, 'input' => 3, 'network' => 4, 'mux' => 5, 'weight' => 6,), |
|
137 | + self::TYPE_COLNAME => array(InputTableMap::COL_UUID => 0, InputTableMap::COL_INSTANCE_NAME => 1, InputTableMap::COL_STARTED => 2, InputTableMap::COL_INPUT => 3, InputTableMap::COL_NETWORK => 4, InputTableMap::COL_MUX => 5, InputTableMap::COL_WEIGHT => 6,), |
|
138 | + self::TYPE_FIELDNAME => array('uuid' => 0, 'instance_name' => 1, 'started' => 2, 'input' => 3, 'network' => 4, 'mux' => 5, 'weight' => 6,), |
|
139 | + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6,) |
|
140 | 140 | ); |
141 | 141 | |
142 | 142 | /** |
@@ -170,16 +170,16 @@ discard block |
||
170 | 170 | */ |
171 | 171 | public function buildRelations() |
172 | 172 | { |
173 | - $this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array ( |
|
173 | + $this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array( |
|
174 | 174 | 0 => |
175 | - array ( |
|
175 | + array( |
|
176 | 176 | 0 => ':instance_name', |
177 | 177 | 1 => ':name', |
178 | 178 | ), |
179 | 179 | ), null, null, null, false); |
180 | - $this->addRelation('Subscription', '\\Jalle19\\StatusManager\\Database\\Subscription', RelationMap::ONE_TO_MANY, array ( |
|
180 | + $this->addRelation('Subscription', '\\Jalle19\\StatusManager\\Database\\Subscription', RelationMap::ONE_TO_MANY, array( |
|
181 | 181 | 0 => |
182 | - array ( |
|
182 | + array( |
|
183 | 183 | 0 => ':input_uuid', |
184 | 184 | 1 => ':uuid', |
185 | 185 | ), |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | |
448 | 448 | // use transaction because $criteria could contain info |
449 | 449 | // for more than one table (I guess, conceivably) |
450 | - return $con->transaction(function () use ($con, $query) { |
|
450 | + return $con->transaction(function() use ($con, $query) { |
|
451 | 451 | return $query->doInsert($con); |
452 | 452 | }); |
453 | 453 | } |
@@ -28,402 +28,402 @@ |
||
28 | 28 | */ |
29 | 29 | class InstanceTableMap extends TableMap |
30 | 30 | { |
31 | - use InstancePoolTrait; |
|
32 | - use TableMapTrait; |
|
33 | - |
|
34 | - /** |
|
35 | - * The (dot-path) name of this class |
|
36 | - */ |
|
37 | - const CLASS_NAME = 'Jalle19.StatusManager.Database.Map.InstanceTableMap'; |
|
38 | - |
|
39 | - /** |
|
40 | - * The default database name for this class |
|
41 | - */ |
|
42 | - const DATABASE_NAME = 'tvheadend_status_manager'; |
|
43 | - |
|
44 | - /** |
|
45 | - * The table name for this class |
|
46 | - */ |
|
47 | - const TABLE_NAME = 'instance'; |
|
48 | - |
|
49 | - /** |
|
50 | - * The related Propel class for this table |
|
51 | - */ |
|
52 | - const OM_CLASS = '\\Jalle19\\StatusManager\\Database\\Instance'; |
|
53 | - |
|
54 | - /** |
|
55 | - * A class that can be returned by this tableMap |
|
56 | - */ |
|
57 | - const CLASS_DEFAULT = 'Jalle19.StatusManager.Database.Instance'; |
|
58 | - |
|
59 | - /** |
|
60 | - * The total number of columns |
|
61 | - */ |
|
62 | - const NUM_COLUMNS = 1; |
|
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 = 1; |
|
73 | - |
|
74 | - /** |
|
75 | - * the column name for the name field |
|
76 | - */ |
|
77 | - const COL_NAME = 'instance.name'; |
|
78 | - |
|
79 | - /** |
|
80 | - * The default string format for model objects of the related table |
|
81 | - */ |
|
82 | - const DEFAULT_STRING_FORMAT = 'YAML'; |
|
83 | - |
|
84 | - /** |
|
85 | - * holds an array of fieldnames |
|
86 | - * |
|
87 | - * first dimension keys are the type constants |
|
88 | - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' |
|
89 | - */ |
|
90 | - protected static $fieldNames = array ( |
|
91 | - self::TYPE_PHPNAME => array('Name', ), |
|
92 | - self::TYPE_CAMELNAME => array('name', ), |
|
93 | - self::TYPE_COLNAME => array(InstanceTableMap::COL_NAME, ), |
|
94 | - self::TYPE_FIELDNAME => array('name', ), |
|
95 | - self::TYPE_NUM => array(0, ) |
|
96 | - ); |
|
97 | - |
|
98 | - /** |
|
99 | - * holds an array of keys for quick access to the fieldnames array |
|
100 | - * |
|
101 | - * first dimension keys are the type constants |
|
102 | - * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 |
|
103 | - */ |
|
104 | - protected static $fieldKeys = array ( |
|
105 | - self::TYPE_PHPNAME => array('Name' => 0, ), |
|
106 | - self::TYPE_CAMELNAME => array('name' => 0, ), |
|
107 | - self::TYPE_COLNAME => array(InstanceTableMap::COL_NAME => 0, ), |
|
108 | - self::TYPE_FIELDNAME => array('name' => 0, ), |
|
109 | - self::TYPE_NUM => array(0, ) |
|
110 | - ); |
|
111 | - |
|
112 | - /** |
|
113 | - * Initialize the table attributes and columns |
|
114 | - * Relations are not initialized by this method since they are lazy loaded |
|
115 | - * |
|
116 | - * @return void |
|
117 | - * @throws PropelException |
|
118 | - */ |
|
119 | - public function initialize() |
|
120 | - { |
|
121 | - // attributes |
|
122 | - $this->setName('instance'); |
|
123 | - $this->setPhpName('Instance'); |
|
124 | - $this->setIdentifierQuoting(false); |
|
125 | - $this->setClassName('\\Jalle19\\StatusManager\\Database\\Instance'); |
|
126 | - $this->setPackage('Jalle19.StatusManager.Database'); |
|
127 | - $this->setUseIdGenerator(false); |
|
128 | - // columns |
|
129 | - $this->addPrimaryKey('name', 'Name', 'VARCHAR', true, 255, null); |
|
130 | - } // initialize() |
|
131 | - |
|
132 | - /** |
|
133 | - * Build the RelationMap objects for this table relationships |
|
134 | - */ |
|
135 | - public function buildRelations() |
|
136 | - { |
|
137 | - $this->addRelation('User', '\\Jalle19\\StatusManager\\Database\\User', RelationMap::ONE_TO_MANY, array ( |
|
31 | + use InstancePoolTrait; |
|
32 | + use TableMapTrait; |
|
33 | + |
|
34 | + /** |
|
35 | + * The (dot-path) name of this class |
|
36 | + */ |
|
37 | + const CLASS_NAME = 'Jalle19.StatusManager.Database.Map.InstanceTableMap'; |
|
38 | + |
|
39 | + /** |
|
40 | + * The default database name for this class |
|
41 | + */ |
|
42 | + const DATABASE_NAME = 'tvheadend_status_manager'; |
|
43 | + |
|
44 | + /** |
|
45 | + * The table name for this class |
|
46 | + */ |
|
47 | + const TABLE_NAME = 'instance'; |
|
48 | + |
|
49 | + /** |
|
50 | + * The related Propel class for this table |
|
51 | + */ |
|
52 | + const OM_CLASS = '\\Jalle19\\StatusManager\\Database\\Instance'; |
|
53 | + |
|
54 | + /** |
|
55 | + * A class that can be returned by this tableMap |
|
56 | + */ |
|
57 | + const CLASS_DEFAULT = 'Jalle19.StatusManager.Database.Instance'; |
|
58 | + |
|
59 | + /** |
|
60 | + * The total number of columns |
|
61 | + */ |
|
62 | + const NUM_COLUMNS = 1; |
|
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 = 1; |
|
73 | + |
|
74 | + /** |
|
75 | + * the column name for the name field |
|
76 | + */ |
|
77 | + const COL_NAME = 'instance.name'; |
|
78 | + |
|
79 | + /** |
|
80 | + * The default string format for model objects of the related table |
|
81 | + */ |
|
82 | + const DEFAULT_STRING_FORMAT = 'YAML'; |
|
83 | + |
|
84 | + /** |
|
85 | + * holds an array of fieldnames |
|
86 | + * |
|
87 | + * first dimension keys are the type constants |
|
88 | + * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' |
|
89 | + */ |
|
90 | + protected static $fieldNames = array ( |
|
91 | + self::TYPE_PHPNAME => array('Name', ), |
|
92 | + self::TYPE_CAMELNAME => array('name', ), |
|
93 | + self::TYPE_COLNAME => array(InstanceTableMap::COL_NAME, ), |
|
94 | + self::TYPE_FIELDNAME => array('name', ), |
|
95 | + self::TYPE_NUM => array(0, ) |
|
96 | + ); |
|
97 | + |
|
98 | + /** |
|
99 | + * holds an array of keys for quick access to the fieldnames array |
|
100 | + * |
|
101 | + * first dimension keys are the type constants |
|
102 | + * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 |
|
103 | + */ |
|
104 | + protected static $fieldKeys = array ( |
|
105 | + self::TYPE_PHPNAME => array('Name' => 0, ), |
|
106 | + self::TYPE_CAMELNAME => array('name' => 0, ), |
|
107 | + self::TYPE_COLNAME => array(InstanceTableMap::COL_NAME => 0, ), |
|
108 | + self::TYPE_FIELDNAME => array('name' => 0, ), |
|
109 | + self::TYPE_NUM => array(0, ) |
|
110 | + ); |
|
111 | + |
|
112 | + /** |
|
113 | + * Initialize the table attributes and columns |
|
114 | + * Relations are not initialized by this method since they are lazy loaded |
|
115 | + * |
|
116 | + * @return void |
|
117 | + * @throws PropelException |
|
118 | + */ |
|
119 | + public function initialize() |
|
120 | + { |
|
121 | + // attributes |
|
122 | + $this->setName('instance'); |
|
123 | + $this->setPhpName('Instance'); |
|
124 | + $this->setIdentifierQuoting(false); |
|
125 | + $this->setClassName('\\Jalle19\\StatusManager\\Database\\Instance'); |
|
126 | + $this->setPackage('Jalle19.StatusManager.Database'); |
|
127 | + $this->setUseIdGenerator(false); |
|
128 | + // columns |
|
129 | + $this->addPrimaryKey('name', 'Name', 'VARCHAR', true, 255, null); |
|
130 | + } // initialize() |
|
131 | + |
|
132 | + /** |
|
133 | + * Build the RelationMap objects for this table relationships |
|
134 | + */ |
|
135 | + public function buildRelations() |
|
136 | + { |
|
137 | + $this->addRelation('User', '\\Jalle19\\StatusManager\\Database\\User', RelationMap::ONE_TO_MANY, array ( |
|
138 | 138 | 0 => |
139 | 139 | array ( |
140 | - 0 => ':instance_name', |
|
141 | - 1 => ':name', |
|
140 | + 0 => ':instance_name', |
|
141 | + 1 => ':name', |
|
142 | 142 | ), |
143 | 143 | ), null, null, 'Users', false); |
144 | - $this->addRelation('Connection', '\\Jalle19\\StatusManager\\Database\\Connection', RelationMap::ONE_TO_MANY, array ( |
|
144 | + $this->addRelation('Connection', '\\Jalle19\\StatusManager\\Database\\Connection', RelationMap::ONE_TO_MANY, array ( |
|
145 | 145 | 0 => |
146 | 146 | array ( |
147 | - 0 => ':instance_name', |
|
148 | - 1 => ':name', |
|
147 | + 0 => ':instance_name', |
|
148 | + 1 => ':name', |
|
149 | 149 | ), |
150 | 150 | ), null, null, 'Connections', false); |
151 | - $this->addRelation('Input', '\\Jalle19\\StatusManager\\Database\\Input', RelationMap::ONE_TO_MANY, array ( |
|
151 | + $this->addRelation('Input', '\\Jalle19\\StatusManager\\Database\\Input', RelationMap::ONE_TO_MANY, array ( |
|
152 | 152 | 0 => |
153 | 153 | array ( |
154 | - 0 => ':instance_name', |
|
155 | - 1 => ':name', |
|
154 | + 0 => ':instance_name', |
|
155 | + 1 => ':name', |
|
156 | 156 | ), |
157 | 157 | ), null, null, 'Inputs', false); |
158 | - $this->addRelation('Channel', '\\Jalle19\\StatusManager\\Database\\Channel', RelationMap::ONE_TO_MANY, array ( |
|
158 | + $this->addRelation('Channel', '\\Jalle19\\StatusManager\\Database\\Channel', RelationMap::ONE_TO_MANY, array ( |
|
159 | 159 | 0 => |
160 | 160 | array ( |
161 | - 0 => ':instance_name', |
|
162 | - 1 => ':name', |
|
161 | + 0 => ':instance_name', |
|
162 | + 1 => ':name', |
|
163 | 163 | ), |
164 | 164 | ), null, null, 'Channels', false); |
165 | - $this->addRelation('Subscription', '\\Jalle19\\StatusManager\\Database\\Subscription', RelationMap::ONE_TO_MANY, array ( |
|
165 | + $this->addRelation('Subscription', '\\Jalle19\\StatusManager\\Database\\Subscription', RelationMap::ONE_TO_MANY, array ( |
|
166 | 166 | 0 => |
167 | 167 | array ( |
168 | - 0 => ':instance_name', |
|
169 | - 1 => ':name', |
|
168 | + 0 => ':instance_name', |
|
169 | + 1 => ':name', |
|
170 | 170 | ), |
171 | 171 | ), null, null, 'Subscriptions', false); |
172 | - } // buildRelations() |
|
173 | - |
|
174 | - /** |
|
175 | - * 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. |
|
176 | - * |
|
177 | - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with |
|
178 | - * a multi-column primary key, a serialize()d version of the primary key will be returned. |
|
179 | - * |
|
180 | - * @param array $row resultset row. |
|
181 | - * @param int $offset The 0-based offset for reading from the resultset row. |
|
182 | - * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
|
183 | - * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM |
|
184 | - * |
|
185 | - * @return string The primary key hash of the row |
|
186 | - */ |
|
187 | - public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
188 | - { |
|
189 | - // If the PK cannot be derived from the row, return NULL. |
|
190 | - if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)] === null) { |
|
191 | - return null; |
|
192 | - } |
|
193 | - |
|
194 | - return null === $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)] || is_scalar($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)]) || is_callable([$row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)], '__toString']) ? (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)] : $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)]; |
|
195 | - } |
|
196 | - |
|
197 | - /** |
|
198 | - * Retrieves the primary key from the DB resultset row |
|
199 | - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with |
|
200 | - * a multi-column primary key, an array of the primary key columns will be returned. |
|
201 | - * |
|
202 | - * @param array $row resultset row. |
|
203 | - * @param int $offset The 0-based offset for reading from the resultset row. |
|
204 | - * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
|
205 | - * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM |
|
206 | - * |
|
207 | - * @return mixed The primary key of the row |
|
208 | - */ |
|
209 | - public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
210 | - { |
|
211 | - return (string) $row[ |
|
212 | - $indexType == TableMap::TYPE_NUM |
|
213 | - ? 0 + $offset |
|
214 | - : self::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType) |
|
215 | - ]; |
|
216 | - } |
|
217 | - |
|
218 | - /** |
|
219 | - * The class that the tableMap will make instances of. |
|
220 | - * |
|
221 | - * If $withPrefix is true, the returned path |
|
222 | - * uses a dot-path notation which is translated into a path |
|
223 | - * relative to a location on the PHP include_path. |
|
224 | - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') |
|
225 | - * |
|
226 | - * @param boolean $withPrefix Whether or not to return the path with the class name |
|
227 | - * @return string path.to.ClassName |
|
228 | - */ |
|
229 | - public static function getOMClass($withPrefix = true) |
|
230 | - { |
|
231 | - return $withPrefix ? InstanceTableMap::CLASS_DEFAULT : InstanceTableMap::OM_CLASS; |
|
232 | - } |
|
233 | - |
|
234 | - /** |
|
235 | - * Populates an object of the default type or an object that inherit from the default. |
|
236 | - * |
|
237 | - * @param array $row row returned by DataFetcher->fetch(). |
|
238 | - * @param int $offset The 0-based offset for reading from the resultset row. |
|
239 | - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). |
|
172 | + } // buildRelations() |
|
173 | + |
|
174 | + /** |
|
175 | + * 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. |
|
176 | + * |
|
177 | + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with |
|
178 | + * a multi-column primary key, a serialize()d version of the primary key will be returned. |
|
179 | + * |
|
180 | + * @param array $row resultset row. |
|
181 | + * @param int $offset The 0-based offset for reading from the resultset row. |
|
182 | + * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
|
183 | + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM |
|
184 | + * |
|
185 | + * @return string The primary key hash of the row |
|
186 | + */ |
|
187 | + public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
188 | + { |
|
189 | + // If the PK cannot be derived from the row, return NULL. |
|
190 | + if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)] === null) { |
|
191 | + return null; |
|
192 | + } |
|
193 | + |
|
194 | + return null === $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)] || is_scalar($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)]) || is_callable([$row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)], '__toString']) ? (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)] : $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType)]; |
|
195 | + } |
|
196 | + |
|
197 | + /** |
|
198 | + * Retrieves the primary key from the DB resultset row |
|
199 | + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with |
|
200 | + * a multi-column primary key, an array of the primary key columns will be returned. |
|
201 | + * |
|
202 | + * @param array $row resultset row. |
|
203 | + * @param int $offset The 0-based offset for reading from the resultset row. |
|
204 | + * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
|
205 | + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM |
|
206 | + * |
|
207 | + * @return mixed The primary key of the row |
|
208 | + */ |
|
209 | + public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
210 | + { |
|
211 | + return (string) $row[ |
|
212 | + $indexType == TableMap::TYPE_NUM |
|
213 | + ? 0 + $offset |
|
214 | + : self::translateFieldName('Name', TableMap::TYPE_PHPNAME, $indexType) |
|
215 | + ]; |
|
216 | + } |
|
217 | + |
|
218 | + /** |
|
219 | + * The class that the tableMap will make instances of. |
|
220 | + * |
|
221 | + * If $withPrefix is true, the returned path |
|
222 | + * uses a dot-path notation which is translated into a path |
|
223 | + * relative to a location on the PHP include_path. |
|
224 | + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') |
|
225 | + * |
|
226 | + * @param boolean $withPrefix Whether or not to return the path with the class name |
|
227 | + * @return string path.to.ClassName |
|
228 | + */ |
|
229 | + public static function getOMClass($withPrefix = true) |
|
230 | + { |
|
231 | + return $withPrefix ? InstanceTableMap::CLASS_DEFAULT : InstanceTableMap::OM_CLASS; |
|
232 | + } |
|
233 | + |
|
234 | + /** |
|
235 | + * Populates an object of the default type or an object that inherit from the default. |
|
236 | + * |
|
237 | + * @param array $row row returned by DataFetcher->fetch(). |
|
238 | + * @param int $offset The 0-based offset for reading from the resultset row. |
|
239 | + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). |
|
240 | 240 | One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
241 | - * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
|
242 | - * |
|
243 | - * @throws PropelException Any exceptions caught during processing will be |
|
244 | - * rethrown wrapped into a PropelException. |
|
245 | - * @return array (Instance object, last column rank) |
|
246 | - */ |
|
247 | - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
248 | - { |
|
249 | - $key = InstanceTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); |
|
250 | - if (null !== ($obj = InstanceTableMap::getInstanceFromPool($key))) { |
|
251 | - // We no longer rehydrate the object, since this can cause data loss. |
|
252 | - // See http://www.propelorm.org/ticket/509 |
|
253 | - // $obj->hydrate($row, $offset, true); // rehydrate |
|
254 | - $col = $offset + InstanceTableMap::NUM_HYDRATE_COLUMNS; |
|
255 | - } else { |
|
256 | - $cls = InstanceTableMap::OM_CLASS; |
|
257 | - /** @var Instance $obj */ |
|
258 | - $obj = new $cls(); |
|
259 | - $col = $obj->hydrate($row, $offset, false, $indexType); |
|
260 | - InstanceTableMap::addInstanceToPool($obj, $key); |
|
261 | - } |
|
262 | - |
|
263 | - return array($obj, $col); |
|
264 | - } |
|
265 | - |
|
266 | - /** |
|
267 | - * The returned array will contain objects of the default type or |
|
268 | - * objects that inherit from the default. |
|
269 | - * |
|
270 | - * @param DataFetcherInterface $dataFetcher |
|
271 | - * @return array |
|
272 | - * @throws PropelException Any exceptions caught during processing will be |
|
273 | - * rethrown wrapped into a PropelException. |
|
274 | - */ |
|
275 | - public static function populateObjects(DataFetcherInterface $dataFetcher) |
|
276 | - { |
|
277 | - $results = array(); |
|
278 | - |
|
279 | - // set the class once to avoid overhead in the loop |
|
280 | - $cls = static::getOMClass(false); |
|
281 | - // populate the object(s) |
|
282 | - while ($row = $dataFetcher->fetch()) { |
|
283 | - $key = InstanceTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); |
|
284 | - if (null !== ($obj = InstanceTableMap::getInstanceFromPool($key))) { |
|
285 | - // We no longer rehydrate the object, since this can cause data loss. |
|
286 | - // See http://www.propelorm.org/ticket/509 |
|
287 | - // $obj->hydrate($row, 0, true); // rehydrate |
|
288 | - $results[] = $obj; |
|
289 | - } else { |
|
290 | - /** @var Instance $obj */ |
|
291 | - $obj = new $cls(); |
|
292 | - $obj->hydrate($row); |
|
293 | - $results[] = $obj; |
|
294 | - InstanceTableMap::addInstanceToPool($obj, $key); |
|
295 | - } // if key exists |
|
296 | - } |
|
297 | - |
|
298 | - return $results; |
|
299 | - } |
|
300 | - /** |
|
301 | - * Add all the columns needed to create a new object. |
|
302 | - * |
|
303 | - * Note: any columns that were marked with lazyLoad="true" in the |
|
304 | - * XML schema will not be added to the select list and only loaded |
|
305 | - * on demand. |
|
306 | - * |
|
307 | - * @param Criteria $criteria object containing the columns to add. |
|
308 | - * @param string $alias optional table alias |
|
309 | - * @throws PropelException Any exceptions caught during processing will be |
|
310 | - * rethrown wrapped into a PropelException. |
|
311 | - */ |
|
312 | - public static function addSelectColumns(Criteria $criteria, $alias = null) |
|
313 | - { |
|
314 | - if (null === $alias) { |
|
315 | - $criteria->addSelectColumn(InstanceTableMap::COL_NAME); |
|
316 | - } else { |
|
317 | - $criteria->addSelectColumn($alias . '.name'); |
|
318 | - } |
|
319 | - } |
|
320 | - |
|
321 | - /** |
|
322 | - * Returns the TableMap related to this object. |
|
323 | - * This method is not needed for general use but a specific application could have a need. |
|
324 | - * @return TableMap |
|
325 | - * @throws PropelException Any exceptions caught during processing will be |
|
326 | - * rethrown wrapped into a PropelException. |
|
327 | - */ |
|
328 | - public static function getTableMap() |
|
329 | - { |
|
330 | - return Propel::getServiceContainer()->getDatabaseMap(InstanceTableMap::DATABASE_NAME)->getTable(InstanceTableMap::TABLE_NAME); |
|
331 | - } |
|
332 | - |
|
333 | - /** |
|
334 | - * Add a TableMap instance to the database for this tableMap class. |
|
335 | - */ |
|
336 | - public static function buildTableMap() |
|
337 | - { |
|
338 | - $dbMap = Propel::getServiceContainer()->getDatabaseMap(InstanceTableMap::DATABASE_NAME); |
|
339 | - if (!$dbMap->hasTable(InstanceTableMap::TABLE_NAME)) { |
|
340 | - $dbMap->addTableObject(new InstanceTableMap()); |
|
341 | - } |
|
342 | - } |
|
343 | - |
|
344 | - /** |
|
345 | - * Performs a DELETE on the database, given a Instance or Criteria object OR a primary key value. |
|
346 | - * |
|
347 | - * @param mixed $values Criteria or Instance object or primary key or array of primary keys |
|
348 | - * which is used to create the DELETE statement |
|
349 | - * @param ConnectionInterface $con the connection to use |
|
350 | - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows |
|
351 | - * if supported by native driver or if emulated using Propel. |
|
352 | - * @throws PropelException Any exceptions caught during processing will be |
|
353 | - * rethrown wrapped into a PropelException. |
|
354 | - */ |
|
355 | - public static function doDelete($values, ConnectionInterface $con = null) |
|
356 | - { |
|
357 | - if (null === $con) { |
|
358 | - $con = Propel::getServiceContainer()->getWriteConnection(InstanceTableMap::DATABASE_NAME); |
|
359 | - } |
|
360 | - |
|
361 | - if ($values instanceof Criteria) { |
|
362 | - // rename for clarity |
|
363 | - $criteria = $values; |
|
364 | - } elseif ($values instanceof \Jalle19\StatusManager\Database\Instance) { // it's a model object |
|
365 | - // create criteria based on pk values |
|
366 | - $criteria = $values->buildPkeyCriteria(); |
|
367 | - } else { // it's a primary key, or an array of pks |
|
368 | - $criteria = new Criteria(InstanceTableMap::DATABASE_NAME); |
|
369 | - $criteria->add(InstanceTableMap::COL_NAME, (array) $values, Criteria::IN); |
|
370 | - } |
|
371 | - |
|
372 | - $query = InstanceQuery::create()->mergeWith($criteria); |
|
373 | - |
|
374 | - if ($values instanceof Criteria) { |
|
375 | - InstanceTableMap::clearInstancePool(); |
|
376 | - } elseif (!is_object($values)) { // it's a primary key, or an array of pks |
|
377 | - foreach ((array) $values as $singleval) { |
|
378 | - InstanceTableMap::removeInstanceFromPool($singleval); |
|
379 | - } |
|
380 | - } |
|
381 | - |
|
382 | - return $query->delete($con); |
|
383 | - } |
|
384 | - |
|
385 | - /** |
|
386 | - * Deletes all rows from the instance table. |
|
387 | - * |
|
388 | - * @param ConnectionInterface $con the connection to use |
|
389 | - * @return int The number of affected rows (if supported by underlying database driver). |
|
390 | - */ |
|
391 | - public static function doDeleteAll(ConnectionInterface $con = null) |
|
392 | - { |
|
393 | - return InstanceQuery::create()->doDeleteAll($con); |
|
394 | - } |
|
395 | - |
|
396 | - /** |
|
397 | - * Performs an INSERT on the database, given a Instance or Criteria object. |
|
398 | - * |
|
399 | - * @param mixed $criteria Criteria or Instance object containing data that is used to create the INSERT statement. |
|
400 | - * @param ConnectionInterface $con the ConnectionInterface connection to use |
|
401 | - * @return mixed The new primary key. |
|
402 | - * @throws PropelException Any exceptions caught during processing will be |
|
403 | - * rethrown wrapped into a PropelException. |
|
404 | - */ |
|
405 | - public static function doInsert($criteria, ConnectionInterface $con = null) |
|
406 | - { |
|
407 | - if (null === $con) { |
|
408 | - $con = Propel::getServiceContainer()->getWriteConnection(InstanceTableMap::DATABASE_NAME); |
|
409 | - } |
|
410 | - |
|
411 | - if ($criteria instanceof Criteria) { |
|
412 | - $criteria = clone $criteria; // rename for clarity |
|
413 | - } else { |
|
414 | - $criteria = $criteria->buildCriteria(); // build Criteria from Instance object |
|
415 | - } |
|
416 | - |
|
417 | - |
|
418 | - // Set the correct dbName |
|
419 | - $query = InstanceQuery::create()->mergeWith($criteria); |
|
420 | - |
|
421 | - // use transaction because $criteria could contain info |
|
422 | - // for more than one table (I guess, conceivably) |
|
423 | - return $con->transaction(function () use ($con, $query) { |
|
424 | - return $query->doInsert($con); |
|
425 | - }); |
|
426 | - } |
|
241 | + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
|
242 | + * |
|
243 | + * @throws PropelException Any exceptions caught during processing will be |
|
244 | + * rethrown wrapped into a PropelException. |
|
245 | + * @return array (Instance object, last column rank) |
|
246 | + */ |
|
247 | + public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
248 | + { |
|
249 | + $key = InstanceTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); |
|
250 | + if (null !== ($obj = InstanceTableMap::getInstanceFromPool($key))) { |
|
251 | + // We no longer rehydrate the object, since this can cause data loss. |
|
252 | + // See http://www.propelorm.org/ticket/509 |
|
253 | + // $obj->hydrate($row, $offset, true); // rehydrate |
|
254 | + $col = $offset + InstanceTableMap::NUM_HYDRATE_COLUMNS; |
|
255 | + } else { |
|
256 | + $cls = InstanceTableMap::OM_CLASS; |
|
257 | + /** @var Instance $obj */ |
|
258 | + $obj = new $cls(); |
|
259 | + $col = $obj->hydrate($row, $offset, false, $indexType); |
|
260 | + InstanceTableMap::addInstanceToPool($obj, $key); |
|
261 | + } |
|
262 | + |
|
263 | + return array($obj, $col); |
|
264 | + } |
|
265 | + |
|
266 | + /** |
|
267 | + * The returned array will contain objects of the default type or |
|
268 | + * objects that inherit from the default. |
|
269 | + * |
|
270 | + * @param DataFetcherInterface $dataFetcher |
|
271 | + * @return array |
|
272 | + * @throws PropelException Any exceptions caught during processing will be |
|
273 | + * rethrown wrapped into a PropelException. |
|
274 | + */ |
|
275 | + public static function populateObjects(DataFetcherInterface $dataFetcher) |
|
276 | + { |
|
277 | + $results = array(); |
|
278 | + |
|
279 | + // set the class once to avoid overhead in the loop |
|
280 | + $cls = static::getOMClass(false); |
|
281 | + // populate the object(s) |
|
282 | + while ($row = $dataFetcher->fetch()) { |
|
283 | + $key = InstanceTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); |
|
284 | + if (null !== ($obj = InstanceTableMap::getInstanceFromPool($key))) { |
|
285 | + // We no longer rehydrate the object, since this can cause data loss. |
|
286 | + // See http://www.propelorm.org/ticket/509 |
|
287 | + // $obj->hydrate($row, 0, true); // rehydrate |
|
288 | + $results[] = $obj; |
|
289 | + } else { |
|
290 | + /** @var Instance $obj */ |
|
291 | + $obj = new $cls(); |
|
292 | + $obj->hydrate($row); |
|
293 | + $results[] = $obj; |
|
294 | + InstanceTableMap::addInstanceToPool($obj, $key); |
|
295 | + } // if key exists |
|
296 | + } |
|
297 | + |
|
298 | + return $results; |
|
299 | + } |
|
300 | + /** |
|
301 | + * Add all the columns needed to create a new object. |
|
302 | + * |
|
303 | + * Note: any columns that were marked with lazyLoad="true" in the |
|
304 | + * XML schema will not be added to the select list and only loaded |
|
305 | + * on demand. |
|
306 | + * |
|
307 | + * @param Criteria $criteria object containing the columns to add. |
|
308 | + * @param string $alias optional table alias |
|
309 | + * @throws PropelException Any exceptions caught during processing will be |
|
310 | + * rethrown wrapped into a PropelException. |
|
311 | + */ |
|
312 | + public static function addSelectColumns(Criteria $criteria, $alias = null) |
|
313 | + { |
|
314 | + if (null === $alias) { |
|
315 | + $criteria->addSelectColumn(InstanceTableMap::COL_NAME); |
|
316 | + } else { |
|
317 | + $criteria->addSelectColumn($alias . '.name'); |
|
318 | + } |
|
319 | + } |
|
320 | + |
|
321 | + /** |
|
322 | + * Returns the TableMap related to this object. |
|
323 | + * This method is not needed for general use but a specific application could have a need. |
|
324 | + * @return TableMap |
|
325 | + * @throws PropelException Any exceptions caught during processing will be |
|
326 | + * rethrown wrapped into a PropelException. |
|
327 | + */ |
|
328 | + public static function getTableMap() |
|
329 | + { |
|
330 | + return Propel::getServiceContainer()->getDatabaseMap(InstanceTableMap::DATABASE_NAME)->getTable(InstanceTableMap::TABLE_NAME); |
|
331 | + } |
|
332 | + |
|
333 | + /** |
|
334 | + * Add a TableMap instance to the database for this tableMap class. |
|
335 | + */ |
|
336 | + public static function buildTableMap() |
|
337 | + { |
|
338 | + $dbMap = Propel::getServiceContainer()->getDatabaseMap(InstanceTableMap::DATABASE_NAME); |
|
339 | + if (!$dbMap->hasTable(InstanceTableMap::TABLE_NAME)) { |
|
340 | + $dbMap->addTableObject(new InstanceTableMap()); |
|
341 | + } |
|
342 | + } |
|
343 | + |
|
344 | + /** |
|
345 | + * Performs a DELETE on the database, given a Instance or Criteria object OR a primary key value. |
|
346 | + * |
|
347 | + * @param mixed $values Criteria or Instance object or primary key or array of primary keys |
|
348 | + * which is used to create the DELETE statement |
|
349 | + * @param ConnectionInterface $con the connection to use |
|
350 | + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows |
|
351 | + * if supported by native driver or if emulated using Propel. |
|
352 | + * @throws PropelException Any exceptions caught during processing will be |
|
353 | + * rethrown wrapped into a PropelException. |
|
354 | + */ |
|
355 | + public static function doDelete($values, ConnectionInterface $con = null) |
|
356 | + { |
|
357 | + if (null === $con) { |
|
358 | + $con = Propel::getServiceContainer()->getWriteConnection(InstanceTableMap::DATABASE_NAME); |
|
359 | + } |
|
360 | + |
|
361 | + if ($values instanceof Criteria) { |
|
362 | + // rename for clarity |
|
363 | + $criteria = $values; |
|
364 | + } elseif ($values instanceof \Jalle19\StatusManager\Database\Instance) { // it's a model object |
|
365 | + // create criteria based on pk values |
|
366 | + $criteria = $values->buildPkeyCriteria(); |
|
367 | + } else { // it's a primary key, or an array of pks |
|
368 | + $criteria = new Criteria(InstanceTableMap::DATABASE_NAME); |
|
369 | + $criteria->add(InstanceTableMap::COL_NAME, (array) $values, Criteria::IN); |
|
370 | + } |
|
371 | + |
|
372 | + $query = InstanceQuery::create()->mergeWith($criteria); |
|
373 | + |
|
374 | + if ($values instanceof Criteria) { |
|
375 | + InstanceTableMap::clearInstancePool(); |
|
376 | + } elseif (!is_object($values)) { // it's a primary key, or an array of pks |
|
377 | + foreach ((array) $values as $singleval) { |
|
378 | + InstanceTableMap::removeInstanceFromPool($singleval); |
|
379 | + } |
|
380 | + } |
|
381 | + |
|
382 | + return $query->delete($con); |
|
383 | + } |
|
384 | + |
|
385 | + /** |
|
386 | + * Deletes all rows from the instance table. |
|
387 | + * |
|
388 | + * @param ConnectionInterface $con the connection to use |
|
389 | + * @return int The number of affected rows (if supported by underlying database driver). |
|
390 | + */ |
|
391 | + public static function doDeleteAll(ConnectionInterface $con = null) |
|
392 | + { |
|
393 | + return InstanceQuery::create()->doDeleteAll($con); |
|
394 | + } |
|
395 | + |
|
396 | + /** |
|
397 | + * Performs an INSERT on the database, given a Instance or Criteria object. |
|
398 | + * |
|
399 | + * @param mixed $criteria Criteria or Instance object containing data that is used to create the INSERT statement. |
|
400 | + * @param ConnectionInterface $con the ConnectionInterface connection to use |
|
401 | + * @return mixed The new primary key. |
|
402 | + * @throws PropelException Any exceptions caught during processing will be |
|
403 | + * rethrown wrapped into a PropelException. |
|
404 | + */ |
|
405 | + public static function doInsert($criteria, ConnectionInterface $con = null) |
|
406 | + { |
|
407 | + if (null === $con) { |
|
408 | + $con = Propel::getServiceContainer()->getWriteConnection(InstanceTableMap::DATABASE_NAME); |
|
409 | + } |
|
410 | + |
|
411 | + if ($criteria instanceof Criteria) { |
|
412 | + $criteria = clone $criteria; // rename for clarity |
|
413 | + } else { |
|
414 | + $criteria = $criteria->buildCriteria(); // build Criteria from Instance object |
|
415 | + } |
|
416 | + |
|
417 | + |
|
418 | + // Set the correct dbName |
|
419 | + $query = InstanceQuery::create()->mergeWith($criteria); |
|
420 | + |
|
421 | + // use transaction because $criteria could contain info |
|
422 | + // for more than one table (I guess, conceivably) |
|
423 | + return $con->transaction(function () use ($con, $query) { |
|
424 | + return $query->doInsert($con); |
|
425 | + }); |
|
426 | + } |
|
427 | 427 | |
428 | 428 | } // InstanceTableMap |
429 | 429 | // This is the static code needed to register the TableMap for this table with the main Propel class. |
@@ -87,12 +87,12 @@ discard block |
||
87 | 87 | * first dimension keys are the type constants |
88 | 88 | * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' |
89 | 89 | */ |
90 | - protected static $fieldNames = array ( |
|
91 | - self::TYPE_PHPNAME => array('Name', ), |
|
92 | - self::TYPE_CAMELNAME => array('name', ), |
|
93 | - self::TYPE_COLNAME => array(InstanceTableMap::COL_NAME, ), |
|
94 | - self::TYPE_FIELDNAME => array('name', ), |
|
95 | - self::TYPE_NUM => array(0, ) |
|
90 | + protected static $fieldNames = array( |
|
91 | + self::TYPE_PHPNAME => array('Name',), |
|
92 | + self::TYPE_CAMELNAME => array('name',), |
|
93 | + self::TYPE_COLNAME => array(InstanceTableMap::COL_NAME,), |
|
94 | + self::TYPE_FIELDNAME => array('name',), |
|
95 | + self::TYPE_NUM => array(0,) |
|
96 | 96 | ); |
97 | 97 | |
98 | 98 | /** |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | * first dimension keys are the type constants |
102 | 102 | * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 |
103 | 103 | */ |
104 | - protected static $fieldKeys = array ( |
|
105 | - self::TYPE_PHPNAME => array('Name' => 0, ), |
|
106 | - self::TYPE_CAMELNAME => array('name' => 0, ), |
|
107 | - self::TYPE_COLNAME => array(InstanceTableMap::COL_NAME => 0, ), |
|
108 | - self::TYPE_FIELDNAME => array('name' => 0, ), |
|
109 | - self::TYPE_NUM => array(0, ) |
|
104 | + protected static $fieldKeys = array( |
|
105 | + self::TYPE_PHPNAME => array('Name' => 0,), |
|
106 | + self::TYPE_CAMELNAME => array('name' => 0,), |
|
107 | + self::TYPE_COLNAME => array(InstanceTableMap::COL_NAME => 0,), |
|
108 | + self::TYPE_FIELDNAME => array('name' => 0,), |
|
109 | + self::TYPE_NUM => array(0,) |
|
110 | 110 | ); |
111 | 111 | |
112 | 112 | /** |
@@ -134,37 +134,37 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function buildRelations() |
136 | 136 | { |
137 | - $this->addRelation('User', '\\Jalle19\\StatusManager\\Database\\User', RelationMap::ONE_TO_MANY, array ( |
|
137 | + $this->addRelation('User', '\\Jalle19\\StatusManager\\Database\\User', RelationMap::ONE_TO_MANY, array( |
|
138 | 138 | 0 => |
139 | - array ( |
|
139 | + array( |
|
140 | 140 | 0 => ':instance_name', |
141 | 141 | 1 => ':name', |
142 | 142 | ), |
143 | 143 | ), null, null, 'Users', false); |
144 | - $this->addRelation('Connection', '\\Jalle19\\StatusManager\\Database\\Connection', RelationMap::ONE_TO_MANY, array ( |
|
144 | + $this->addRelation('Connection', '\\Jalle19\\StatusManager\\Database\\Connection', RelationMap::ONE_TO_MANY, array( |
|
145 | 145 | 0 => |
146 | - array ( |
|
146 | + array( |
|
147 | 147 | 0 => ':instance_name', |
148 | 148 | 1 => ':name', |
149 | 149 | ), |
150 | 150 | ), null, null, 'Connections', false); |
151 | - $this->addRelation('Input', '\\Jalle19\\StatusManager\\Database\\Input', RelationMap::ONE_TO_MANY, array ( |
|
151 | + $this->addRelation('Input', '\\Jalle19\\StatusManager\\Database\\Input', RelationMap::ONE_TO_MANY, array( |
|
152 | 152 | 0 => |
153 | - array ( |
|
153 | + array( |
|
154 | 154 | 0 => ':instance_name', |
155 | 155 | 1 => ':name', |
156 | 156 | ), |
157 | 157 | ), null, null, 'Inputs', false); |
158 | - $this->addRelation('Channel', '\\Jalle19\\StatusManager\\Database\\Channel', RelationMap::ONE_TO_MANY, array ( |
|
158 | + $this->addRelation('Channel', '\\Jalle19\\StatusManager\\Database\\Channel', RelationMap::ONE_TO_MANY, array( |
|
159 | 159 | 0 => |
160 | - array ( |
|
160 | + array( |
|
161 | 161 | 0 => ':instance_name', |
162 | 162 | 1 => ':name', |
163 | 163 | ), |
164 | 164 | ), null, null, 'Channels', false); |
165 | - $this->addRelation('Subscription', '\\Jalle19\\StatusManager\\Database\\Subscription', RelationMap::ONE_TO_MANY, array ( |
|
165 | + $this->addRelation('Subscription', '\\Jalle19\\StatusManager\\Database\\Subscription', RelationMap::ONE_TO_MANY, array( |
|
166 | 166 | 0 => |
167 | - array ( |
|
167 | + array( |
|
168 | 168 | 0 => ':instance_name', |
169 | 169 | 1 => ':name', |
170 | 170 | ), |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | |
421 | 421 | // use transaction because $criteria could contain info |
422 | 422 | // for more than one table (I guess, conceivably) |
423 | - return $con->transaction(function () use ($con, $query) { |
|
423 | + return $con->transaction(function() use ($con, $query) { |
|
424 | 424 | return $query->doInsert($con); |
425 | 425 | }); |
426 | 426 | } |
@@ -28,471 +28,471 @@ |
||
28 | 28 | */ |
29 | 29 | class SubscriptionTableMap extends TableMap |
30 | 30 | { |
31 | - use InstancePoolTrait; |
|
32 | - use TableMapTrait; |
|
33 | - |
|
34 | - /** |
|
35 | - * The (dot-path) name of this class |
|
36 | - */ |
|
37 | - const CLASS_NAME = 'Jalle19.StatusManager.Database.Map.SubscriptionTableMap'; |
|
38 | - |
|
39 | - /** |
|
40 | - * The default database name for this class |
|
41 | - */ |
|
42 | - const DATABASE_NAME = 'tvheadend_status_manager'; |
|
43 | - |
|
44 | - /** |
|
45 | - * The table name for this class |
|
46 | - */ |
|
47 | - const TABLE_NAME = 'subscription'; |
|
48 | - |
|
49 | - /** |
|
50 | - * The related Propel class for this table |
|
51 | - */ |
|
52 | - const OM_CLASS = '\\Jalle19\\StatusManager\\Database\\Subscription'; |
|
53 | - |
|
54 | - /** |
|
55 | - * A class that can be returned by this tableMap |
|
56 | - */ |
|
57 | - const CLASS_DEFAULT = 'Jalle19.StatusManager.Database.Subscription'; |
|
58 | - |
|
59 | - /** |
|
60 | - * The total number of columns |
|
61 | - */ |
|
62 | - const NUM_COLUMNS = 10; |
|
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 = 10; |
|
73 | - |
|
74 | - /** |
|
75 | - * the column name for the id field |
|
76 | - */ |
|
77 | - const COL_ID = 'subscription.id'; |
|
78 | - |
|
79 | - /** |
|
80 | - * the column name for the instance_name field |
|
81 | - */ |
|
82 | - const COL_INSTANCE_NAME = 'subscription.instance_name'; |
|
83 | - |
|
84 | - /** |
|
85 | - * the column name for the input_uuid field |
|
86 | - */ |
|
87 | - const COL_INPUT_UUID = 'subscription.input_uuid'; |
|
88 | - |
|
89 | - /** |
|
90 | - * the column name for the user_id field |
|
91 | - */ |
|
92 | - const COL_USER_ID = 'subscription.user_id'; |
|
93 | - |
|
94 | - /** |
|
95 | - * the column name for the channel_id field |
|
96 | - */ |
|
97 | - const COL_CHANNEL_ID = 'subscription.channel_id'; |
|
98 | - |
|
99 | - /** |
|
100 | - * the column name for the subscription_id field |
|
101 | - */ |
|
102 | - const COL_SUBSCRIPTION_ID = 'subscription.subscription_id'; |
|
103 | - |
|
104 | - /** |
|
105 | - * the column name for the started field |
|
106 | - */ |
|
107 | - const COL_STARTED = 'subscription.started'; |
|
108 | - |
|
109 | - /** |
|
110 | - * the column name for the stopped field |
|
111 | - */ |
|
112 | - const COL_STOPPED = 'subscription.stopped'; |
|
113 | - |
|
114 | - /** |
|
115 | - * the column name for the title field |
|
116 | - */ |
|
117 | - const COL_TITLE = 'subscription.title'; |
|
118 | - |
|
119 | - /** |
|
120 | - * the column name for the service field |
|
121 | - */ |
|
122 | - const COL_SERVICE = 'subscription.service'; |
|
123 | - |
|
124 | - /** |
|
125 | - * The default string format for model objects of the related table |
|
126 | - */ |
|
127 | - const DEFAULT_STRING_FORMAT = 'YAML'; |
|
128 | - |
|
129 | - /** |
|
130 | - * holds an array of fieldnames |
|
131 | - * |
|
132 | - * first dimension keys are the type constants |
|
133 | - * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' |
|
134 | - */ |
|
135 | - protected static $fieldNames = array ( |
|
136 | - self::TYPE_PHPNAME => array('Id', 'InstanceName', 'InputUuid', 'UserId', 'ChannelId', 'SubscriptionId', 'Started', 'Stopped', 'Title', 'Service', ), |
|
137 | - self::TYPE_CAMELNAME => array('id', 'instanceName', 'inputUuid', 'userId', 'channelId', 'subscriptionId', 'started', 'stopped', 'title', 'service', ), |
|
138 | - self::TYPE_COLNAME => array(SubscriptionTableMap::COL_ID, SubscriptionTableMap::COL_INSTANCE_NAME, SubscriptionTableMap::COL_INPUT_UUID, SubscriptionTableMap::COL_USER_ID, SubscriptionTableMap::COL_CHANNEL_ID, SubscriptionTableMap::COL_SUBSCRIPTION_ID, SubscriptionTableMap::COL_STARTED, SubscriptionTableMap::COL_STOPPED, SubscriptionTableMap::COL_TITLE, SubscriptionTableMap::COL_SERVICE, ), |
|
139 | - self::TYPE_FIELDNAME => array('id', 'instance_name', 'input_uuid', 'user_id', 'channel_id', 'subscription_id', 'started', 'stopped', 'title', 'service', ), |
|
140 | - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ) |
|
141 | - ); |
|
142 | - |
|
143 | - /** |
|
144 | - * holds an array of keys for quick access to the fieldnames array |
|
145 | - * |
|
146 | - * first dimension keys are the type constants |
|
147 | - * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 |
|
148 | - */ |
|
149 | - protected static $fieldKeys = array ( |
|
150 | - self::TYPE_PHPNAME => array('Id' => 0, 'InstanceName' => 1, 'InputUuid' => 2, 'UserId' => 3, 'ChannelId' => 4, 'SubscriptionId' => 5, 'Started' => 6, 'Stopped' => 7, 'Title' => 8, 'Service' => 9, ), |
|
151 | - self::TYPE_CAMELNAME => array('id' => 0, 'instanceName' => 1, 'inputUuid' => 2, 'userId' => 3, 'channelId' => 4, 'subscriptionId' => 5, 'started' => 6, 'stopped' => 7, 'title' => 8, 'service' => 9, ), |
|
152 | - self::TYPE_COLNAME => array(SubscriptionTableMap::COL_ID => 0, SubscriptionTableMap::COL_INSTANCE_NAME => 1, SubscriptionTableMap::COL_INPUT_UUID => 2, SubscriptionTableMap::COL_USER_ID => 3, SubscriptionTableMap::COL_CHANNEL_ID => 4, SubscriptionTableMap::COL_SUBSCRIPTION_ID => 5, SubscriptionTableMap::COL_STARTED => 6, SubscriptionTableMap::COL_STOPPED => 7, SubscriptionTableMap::COL_TITLE => 8, SubscriptionTableMap::COL_SERVICE => 9, ), |
|
153 | - self::TYPE_FIELDNAME => array('id' => 0, 'instance_name' => 1, 'input_uuid' => 2, 'user_id' => 3, 'channel_id' => 4, 'subscription_id' => 5, 'started' => 6, 'stopped' => 7, 'title' => 8, 'service' => 9, ), |
|
154 | - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ) |
|
155 | - ); |
|
156 | - |
|
157 | - /** |
|
158 | - * Initialize the table attributes and columns |
|
159 | - * Relations are not initialized by this method since they are lazy loaded |
|
160 | - * |
|
161 | - * @return void |
|
162 | - * @throws PropelException |
|
163 | - */ |
|
164 | - public function initialize() |
|
165 | - { |
|
166 | - // attributes |
|
167 | - $this->setName('subscription'); |
|
168 | - $this->setPhpName('Subscription'); |
|
169 | - $this->setIdentifierQuoting(false); |
|
170 | - $this->setClassName('\\Jalle19\\StatusManager\\Database\\Subscription'); |
|
171 | - $this->setPackage('Jalle19.StatusManager.Database'); |
|
172 | - $this->setUseIdGenerator(true); |
|
173 | - // columns |
|
174 | - $this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null); |
|
175 | - $this->addForeignKey('instance_name', 'InstanceName', 'VARCHAR', 'instance', 'name', true, 255, null); |
|
176 | - $this->addForeignKey('input_uuid', 'InputUuid', 'VARCHAR', 'input', 'uuid', false, 255, null); |
|
177 | - $this->addForeignKey('user_id', 'UserId', 'INTEGER', 'user', 'id', false, null, null); |
|
178 | - $this->addForeignKey('channel_id', 'ChannelId', 'INTEGER', 'channel', 'id', true, null, null); |
|
179 | - $this->addColumn('subscription_id', 'SubscriptionId', 'INTEGER', true, null, null); |
|
180 | - $this->addColumn('started', 'Started', 'TIMESTAMP', true, null, null); |
|
181 | - $this->addColumn('stopped', 'Stopped', 'TIMESTAMP', false, null, null); |
|
182 | - $this->addColumn('title', 'Title', 'VARCHAR', true, 255, null); |
|
183 | - $this->addColumn('service', 'Service', 'VARCHAR', true, 255, null); |
|
184 | - } // initialize() |
|
185 | - |
|
186 | - /** |
|
187 | - * Build the RelationMap objects for this table relationships |
|
188 | - */ |
|
189 | - public function buildRelations() |
|
190 | - { |
|
191 | - $this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array ( |
|
31 | + use InstancePoolTrait; |
|
32 | + use TableMapTrait; |
|
33 | + |
|
34 | + /** |
|
35 | + * The (dot-path) name of this class |
|
36 | + */ |
|
37 | + const CLASS_NAME = 'Jalle19.StatusManager.Database.Map.SubscriptionTableMap'; |
|
38 | + |
|
39 | + /** |
|
40 | + * The default database name for this class |
|
41 | + */ |
|
42 | + const DATABASE_NAME = 'tvheadend_status_manager'; |
|
43 | + |
|
44 | + /** |
|
45 | + * The table name for this class |
|
46 | + */ |
|
47 | + const TABLE_NAME = 'subscription'; |
|
48 | + |
|
49 | + /** |
|
50 | + * The related Propel class for this table |
|
51 | + */ |
|
52 | + const OM_CLASS = '\\Jalle19\\StatusManager\\Database\\Subscription'; |
|
53 | + |
|
54 | + /** |
|
55 | + * A class that can be returned by this tableMap |
|
56 | + */ |
|
57 | + const CLASS_DEFAULT = 'Jalle19.StatusManager.Database.Subscription'; |
|
58 | + |
|
59 | + /** |
|
60 | + * The total number of columns |
|
61 | + */ |
|
62 | + const NUM_COLUMNS = 10; |
|
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 = 10; |
|
73 | + |
|
74 | + /** |
|
75 | + * the column name for the id field |
|
76 | + */ |
|
77 | + const COL_ID = 'subscription.id'; |
|
78 | + |
|
79 | + /** |
|
80 | + * the column name for the instance_name field |
|
81 | + */ |
|
82 | + const COL_INSTANCE_NAME = 'subscription.instance_name'; |
|
83 | + |
|
84 | + /** |
|
85 | + * the column name for the input_uuid field |
|
86 | + */ |
|
87 | + const COL_INPUT_UUID = 'subscription.input_uuid'; |
|
88 | + |
|
89 | + /** |
|
90 | + * the column name for the user_id field |
|
91 | + */ |
|
92 | + const COL_USER_ID = 'subscription.user_id'; |
|
93 | + |
|
94 | + /** |
|
95 | + * the column name for the channel_id field |
|
96 | + */ |
|
97 | + const COL_CHANNEL_ID = 'subscription.channel_id'; |
|
98 | + |
|
99 | + /** |
|
100 | + * the column name for the subscription_id field |
|
101 | + */ |
|
102 | + const COL_SUBSCRIPTION_ID = 'subscription.subscription_id'; |
|
103 | + |
|
104 | + /** |
|
105 | + * the column name for the started field |
|
106 | + */ |
|
107 | + const COL_STARTED = 'subscription.started'; |
|
108 | + |
|
109 | + /** |
|
110 | + * the column name for the stopped field |
|
111 | + */ |
|
112 | + const COL_STOPPED = 'subscription.stopped'; |
|
113 | + |
|
114 | + /** |
|
115 | + * the column name for the title field |
|
116 | + */ |
|
117 | + const COL_TITLE = 'subscription.title'; |
|
118 | + |
|
119 | + /** |
|
120 | + * the column name for the service field |
|
121 | + */ |
|
122 | + const COL_SERVICE = 'subscription.service'; |
|
123 | + |
|
124 | + /** |
|
125 | + * The default string format for model objects of the related table |
|
126 | + */ |
|
127 | + const DEFAULT_STRING_FORMAT = 'YAML'; |
|
128 | + |
|
129 | + /** |
|
130 | + * holds an array of fieldnames |
|
131 | + * |
|
132 | + * first dimension keys are the type constants |
|
133 | + * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' |
|
134 | + */ |
|
135 | + protected static $fieldNames = array ( |
|
136 | + self::TYPE_PHPNAME => array('Id', 'InstanceName', 'InputUuid', 'UserId', 'ChannelId', 'SubscriptionId', 'Started', 'Stopped', 'Title', 'Service', ), |
|
137 | + self::TYPE_CAMELNAME => array('id', 'instanceName', 'inputUuid', 'userId', 'channelId', 'subscriptionId', 'started', 'stopped', 'title', 'service', ), |
|
138 | + self::TYPE_COLNAME => array(SubscriptionTableMap::COL_ID, SubscriptionTableMap::COL_INSTANCE_NAME, SubscriptionTableMap::COL_INPUT_UUID, SubscriptionTableMap::COL_USER_ID, SubscriptionTableMap::COL_CHANNEL_ID, SubscriptionTableMap::COL_SUBSCRIPTION_ID, SubscriptionTableMap::COL_STARTED, SubscriptionTableMap::COL_STOPPED, SubscriptionTableMap::COL_TITLE, SubscriptionTableMap::COL_SERVICE, ), |
|
139 | + self::TYPE_FIELDNAME => array('id', 'instance_name', 'input_uuid', 'user_id', 'channel_id', 'subscription_id', 'started', 'stopped', 'title', 'service', ), |
|
140 | + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ) |
|
141 | + ); |
|
142 | + |
|
143 | + /** |
|
144 | + * holds an array of keys for quick access to the fieldnames array |
|
145 | + * |
|
146 | + * first dimension keys are the type constants |
|
147 | + * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 |
|
148 | + */ |
|
149 | + protected static $fieldKeys = array ( |
|
150 | + self::TYPE_PHPNAME => array('Id' => 0, 'InstanceName' => 1, 'InputUuid' => 2, 'UserId' => 3, 'ChannelId' => 4, 'SubscriptionId' => 5, 'Started' => 6, 'Stopped' => 7, 'Title' => 8, 'Service' => 9, ), |
|
151 | + self::TYPE_CAMELNAME => array('id' => 0, 'instanceName' => 1, 'inputUuid' => 2, 'userId' => 3, 'channelId' => 4, 'subscriptionId' => 5, 'started' => 6, 'stopped' => 7, 'title' => 8, 'service' => 9, ), |
|
152 | + self::TYPE_COLNAME => array(SubscriptionTableMap::COL_ID => 0, SubscriptionTableMap::COL_INSTANCE_NAME => 1, SubscriptionTableMap::COL_INPUT_UUID => 2, SubscriptionTableMap::COL_USER_ID => 3, SubscriptionTableMap::COL_CHANNEL_ID => 4, SubscriptionTableMap::COL_SUBSCRIPTION_ID => 5, SubscriptionTableMap::COL_STARTED => 6, SubscriptionTableMap::COL_STOPPED => 7, SubscriptionTableMap::COL_TITLE => 8, SubscriptionTableMap::COL_SERVICE => 9, ), |
|
153 | + self::TYPE_FIELDNAME => array('id' => 0, 'instance_name' => 1, 'input_uuid' => 2, 'user_id' => 3, 'channel_id' => 4, 'subscription_id' => 5, 'started' => 6, 'stopped' => 7, 'title' => 8, 'service' => 9, ), |
|
154 | + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ) |
|
155 | + ); |
|
156 | + |
|
157 | + /** |
|
158 | + * Initialize the table attributes and columns |
|
159 | + * Relations are not initialized by this method since they are lazy loaded |
|
160 | + * |
|
161 | + * @return void |
|
162 | + * @throws PropelException |
|
163 | + */ |
|
164 | + public function initialize() |
|
165 | + { |
|
166 | + // attributes |
|
167 | + $this->setName('subscription'); |
|
168 | + $this->setPhpName('Subscription'); |
|
169 | + $this->setIdentifierQuoting(false); |
|
170 | + $this->setClassName('\\Jalle19\\StatusManager\\Database\\Subscription'); |
|
171 | + $this->setPackage('Jalle19.StatusManager.Database'); |
|
172 | + $this->setUseIdGenerator(true); |
|
173 | + // columns |
|
174 | + $this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null); |
|
175 | + $this->addForeignKey('instance_name', 'InstanceName', 'VARCHAR', 'instance', 'name', true, 255, null); |
|
176 | + $this->addForeignKey('input_uuid', 'InputUuid', 'VARCHAR', 'input', 'uuid', false, 255, null); |
|
177 | + $this->addForeignKey('user_id', 'UserId', 'INTEGER', 'user', 'id', false, null, null); |
|
178 | + $this->addForeignKey('channel_id', 'ChannelId', 'INTEGER', 'channel', 'id', true, null, null); |
|
179 | + $this->addColumn('subscription_id', 'SubscriptionId', 'INTEGER', true, null, null); |
|
180 | + $this->addColumn('started', 'Started', 'TIMESTAMP', true, null, null); |
|
181 | + $this->addColumn('stopped', 'Stopped', 'TIMESTAMP', false, null, null); |
|
182 | + $this->addColumn('title', 'Title', 'VARCHAR', true, 255, null); |
|
183 | + $this->addColumn('service', 'Service', 'VARCHAR', true, 255, null); |
|
184 | + } // initialize() |
|
185 | + |
|
186 | + /** |
|
187 | + * Build the RelationMap objects for this table relationships |
|
188 | + */ |
|
189 | + public function buildRelations() |
|
190 | + { |
|
191 | + $this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array ( |
|
192 | 192 | 0 => |
193 | 193 | array ( |
194 | - 0 => ':instance_name', |
|
195 | - 1 => ':name', |
|
194 | + 0 => ':instance_name', |
|
195 | + 1 => ':name', |
|
196 | 196 | ), |
197 | 197 | ), null, null, null, false); |
198 | - $this->addRelation('Input', '\\Jalle19\\StatusManager\\Database\\Input', RelationMap::MANY_TO_ONE, array ( |
|
198 | + $this->addRelation('Input', '\\Jalle19\\StatusManager\\Database\\Input', RelationMap::MANY_TO_ONE, array ( |
|
199 | 199 | 0 => |
200 | 200 | array ( |
201 | - 0 => ':input_uuid', |
|
202 | - 1 => ':uuid', |
|
201 | + 0 => ':input_uuid', |
|
202 | + 1 => ':uuid', |
|
203 | 203 | ), |
204 | 204 | ), null, null, null, false); |
205 | - $this->addRelation('User', '\\Jalle19\\StatusManager\\Database\\User', RelationMap::MANY_TO_ONE, array ( |
|
205 | + $this->addRelation('User', '\\Jalle19\\StatusManager\\Database\\User', RelationMap::MANY_TO_ONE, array ( |
|
206 | 206 | 0 => |
207 | 207 | array ( |
208 | - 0 => ':user_id', |
|
209 | - 1 => ':id', |
|
208 | + 0 => ':user_id', |
|
209 | + 1 => ':id', |
|
210 | 210 | ), |
211 | 211 | ), null, null, null, false); |
212 | - $this->addRelation('Channel', '\\Jalle19\\StatusManager\\Database\\Channel', RelationMap::MANY_TO_ONE, array ( |
|
212 | + $this->addRelation('Channel', '\\Jalle19\\StatusManager\\Database\\Channel', RelationMap::MANY_TO_ONE, array ( |
|
213 | 213 | 0 => |
214 | 214 | array ( |
215 | - 0 => ':channel_id', |
|
216 | - 1 => ':id', |
|
215 | + 0 => ':channel_id', |
|
216 | + 1 => ':id', |
|
217 | 217 | ), |
218 | 218 | ), null, null, null, false); |
219 | - } // buildRelations() |
|
220 | - |
|
221 | - /** |
|
222 | - * 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. |
|
223 | - * |
|
224 | - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with |
|
225 | - * a multi-column primary key, a serialize()d version of the primary key will be returned. |
|
226 | - * |
|
227 | - * @param array $row resultset row. |
|
228 | - * @param int $offset The 0-based offset for reading from the resultset row. |
|
229 | - * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
|
230 | - * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM |
|
231 | - * |
|
232 | - * @return string The primary key hash of the row |
|
233 | - */ |
|
234 | - public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
235 | - { |
|
236 | - // If the PK cannot be derived from the row, return NULL. |
|
237 | - if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { |
|
238 | - return null; |
|
239 | - } |
|
240 | - |
|
241 | - return null === $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] || is_scalar($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]) || is_callable([$row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], '__toString']) ? (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] : $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; |
|
242 | - } |
|
243 | - |
|
244 | - /** |
|
245 | - * Retrieves the primary key from the DB resultset row |
|
246 | - * For tables with a single-column primary key, that simple pkey value will be returned. For tables with |
|
247 | - * a multi-column primary key, an array of the primary key columns will be returned. |
|
248 | - * |
|
249 | - * @param array $row resultset row. |
|
250 | - * @param int $offset The 0-based offset for reading from the resultset row. |
|
251 | - * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
|
252 | - * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM |
|
253 | - * |
|
254 | - * @return mixed The primary key of the row |
|
255 | - */ |
|
256 | - public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
257 | - { |
|
258 | - return (int) $row[ |
|
259 | - $indexType == TableMap::TYPE_NUM |
|
260 | - ? 0 + $offset |
|
261 | - : self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType) |
|
262 | - ]; |
|
263 | - } |
|
264 | - |
|
265 | - /** |
|
266 | - * The class that the tableMap will make instances of. |
|
267 | - * |
|
268 | - * If $withPrefix is true, the returned path |
|
269 | - * uses a dot-path notation which is translated into a path |
|
270 | - * relative to a location on the PHP include_path. |
|
271 | - * (e.g. path.to.MyClass -> 'path/to/MyClass.php') |
|
272 | - * |
|
273 | - * @param boolean $withPrefix Whether or not to return the path with the class name |
|
274 | - * @return string path.to.ClassName |
|
275 | - */ |
|
276 | - public static function getOMClass($withPrefix = true) |
|
277 | - { |
|
278 | - return $withPrefix ? SubscriptionTableMap::CLASS_DEFAULT : SubscriptionTableMap::OM_CLASS; |
|
279 | - } |
|
280 | - |
|
281 | - /** |
|
282 | - * Populates an object of the default type or an object that inherit from the default. |
|
283 | - * |
|
284 | - * @param array $row row returned by DataFetcher->fetch(). |
|
285 | - * @param int $offset The 0-based offset for reading from the resultset row. |
|
286 | - * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). |
|
219 | + } // buildRelations() |
|
220 | + |
|
221 | + /** |
|
222 | + * 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. |
|
223 | + * |
|
224 | + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with |
|
225 | + * a multi-column primary key, a serialize()d version of the primary key will be returned. |
|
226 | + * |
|
227 | + * @param array $row resultset row. |
|
228 | + * @param int $offset The 0-based offset for reading from the resultset row. |
|
229 | + * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
|
230 | + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM |
|
231 | + * |
|
232 | + * @return string The primary key hash of the row |
|
233 | + */ |
|
234 | + public static function getPrimaryKeyHashFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
235 | + { |
|
236 | + // If the PK cannot be derived from the row, return NULL. |
|
237 | + if ($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] === null) { |
|
238 | + return null; |
|
239 | + } |
|
240 | + |
|
241 | + return null === $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] || is_scalar($row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]) || is_callable([$row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)], '__toString']) ? (string) $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)] : $row[TableMap::TYPE_NUM == $indexType ? 0 + $offset : static::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType)]; |
|
242 | + } |
|
243 | + |
|
244 | + /** |
|
245 | + * Retrieves the primary key from the DB resultset row |
|
246 | + * For tables with a single-column primary key, that simple pkey value will be returned. For tables with |
|
247 | + * a multi-column primary key, an array of the primary key columns will be returned. |
|
248 | + * |
|
249 | + * @param array $row resultset row. |
|
250 | + * @param int $offset The 0-based offset for reading from the resultset row. |
|
251 | + * @param string $indexType One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
|
252 | + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM |
|
253 | + * |
|
254 | + * @return mixed The primary key of the row |
|
255 | + */ |
|
256 | + public static function getPrimaryKeyFromRow($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
257 | + { |
|
258 | + return (int) $row[ |
|
259 | + $indexType == TableMap::TYPE_NUM |
|
260 | + ? 0 + $offset |
|
261 | + : self::translateFieldName('Id', TableMap::TYPE_PHPNAME, $indexType) |
|
262 | + ]; |
|
263 | + } |
|
264 | + |
|
265 | + /** |
|
266 | + * The class that the tableMap will make instances of. |
|
267 | + * |
|
268 | + * If $withPrefix is true, the returned path |
|
269 | + * uses a dot-path notation which is translated into a path |
|
270 | + * relative to a location on the PHP include_path. |
|
271 | + * (e.g. path.to.MyClass -> 'path/to/MyClass.php') |
|
272 | + * |
|
273 | + * @param boolean $withPrefix Whether or not to return the path with the class name |
|
274 | + * @return string path.to.ClassName |
|
275 | + */ |
|
276 | + public static function getOMClass($withPrefix = true) |
|
277 | + { |
|
278 | + return $withPrefix ? SubscriptionTableMap::CLASS_DEFAULT : SubscriptionTableMap::OM_CLASS; |
|
279 | + } |
|
280 | + |
|
281 | + /** |
|
282 | + * Populates an object of the default type or an object that inherit from the default. |
|
283 | + * |
|
284 | + * @param array $row row returned by DataFetcher->fetch(). |
|
285 | + * @param int $offset The 0-based offset for reading from the resultset row. |
|
286 | + * @param string $indexType The index type of $row. Mostly DataFetcher->getIndexType(). |
|
287 | 287 | One of the class type constants TableMap::TYPE_PHPNAME, TableMap::TYPE_CAMELNAME |
288 | - * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
|
289 | - * |
|
290 | - * @throws PropelException Any exceptions caught during processing will be |
|
291 | - * rethrown wrapped into a PropelException. |
|
292 | - * @return array (Subscription object, last column rank) |
|
293 | - */ |
|
294 | - public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
295 | - { |
|
296 | - $key = SubscriptionTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); |
|
297 | - if (null !== ($obj = SubscriptionTableMap::getInstanceFromPool($key))) { |
|
298 | - // We no longer rehydrate the object, since this can cause data loss. |
|
299 | - // See http://www.propelorm.org/ticket/509 |
|
300 | - // $obj->hydrate($row, $offset, true); // rehydrate |
|
301 | - $col = $offset + SubscriptionTableMap::NUM_HYDRATE_COLUMNS; |
|
302 | - } else { |
|
303 | - $cls = SubscriptionTableMap::OM_CLASS; |
|
304 | - /** @var Subscription $obj */ |
|
305 | - $obj = new $cls(); |
|
306 | - $col = $obj->hydrate($row, $offset, false, $indexType); |
|
307 | - SubscriptionTableMap::addInstanceToPool($obj, $key); |
|
308 | - } |
|
309 | - |
|
310 | - return array($obj, $col); |
|
311 | - } |
|
312 | - |
|
313 | - /** |
|
314 | - * The returned array will contain objects of the default type or |
|
315 | - * objects that inherit from the default. |
|
316 | - * |
|
317 | - * @param DataFetcherInterface $dataFetcher |
|
318 | - * @return array |
|
319 | - * @throws PropelException Any exceptions caught during processing will be |
|
320 | - * rethrown wrapped into a PropelException. |
|
321 | - */ |
|
322 | - public static function populateObjects(DataFetcherInterface $dataFetcher) |
|
323 | - { |
|
324 | - $results = array(); |
|
325 | - |
|
326 | - // set the class once to avoid overhead in the loop |
|
327 | - $cls = static::getOMClass(false); |
|
328 | - // populate the object(s) |
|
329 | - while ($row = $dataFetcher->fetch()) { |
|
330 | - $key = SubscriptionTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); |
|
331 | - if (null !== ($obj = SubscriptionTableMap::getInstanceFromPool($key))) { |
|
332 | - // We no longer rehydrate the object, since this can cause data loss. |
|
333 | - // See http://www.propelorm.org/ticket/509 |
|
334 | - // $obj->hydrate($row, 0, true); // rehydrate |
|
335 | - $results[] = $obj; |
|
336 | - } else { |
|
337 | - /** @var Subscription $obj */ |
|
338 | - $obj = new $cls(); |
|
339 | - $obj->hydrate($row); |
|
340 | - $results[] = $obj; |
|
341 | - SubscriptionTableMap::addInstanceToPool($obj, $key); |
|
342 | - } // if key exists |
|
343 | - } |
|
344 | - |
|
345 | - return $results; |
|
346 | - } |
|
347 | - /** |
|
348 | - * Add all the columns needed to create a new object. |
|
349 | - * |
|
350 | - * Note: any columns that were marked with lazyLoad="true" in the |
|
351 | - * XML schema will not be added to the select list and only loaded |
|
352 | - * on demand. |
|
353 | - * |
|
354 | - * @param Criteria $criteria object containing the columns to add. |
|
355 | - * @param string $alias optional table alias |
|
356 | - * @throws PropelException Any exceptions caught during processing will be |
|
357 | - * rethrown wrapped into a PropelException. |
|
358 | - */ |
|
359 | - public static function addSelectColumns(Criteria $criteria, $alias = null) |
|
360 | - { |
|
361 | - if (null === $alias) { |
|
362 | - $criteria->addSelectColumn(SubscriptionTableMap::COL_ID); |
|
363 | - $criteria->addSelectColumn(SubscriptionTableMap::COL_INSTANCE_NAME); |
|
364 | - $criteria->addSelectColumn(SubscriptionTableMap::COL_INPUT_UUID); |
|
365 | - $criteria->addSelectColumn(SubscriptionTableMap::COL_USER_ID); |
|
366 | - $criteria->addSelectColumn(SubscriptionTableMap::COL_CHANNEL_ID); |
|
367 | - $criteria->addSelectColumn(SubscriptionTableMap::COL_SUBSCRIPTION_ID); |
|
368 | - $criteria->addSelectColumn(SubscriptionTableMap::COL_STARTED); |
|
369 | - $criteria->addSelectColumn(SubscriptionTableMap::COL_STOPPED); |
|
370 | - $criteria->addSelectColumn(SubscriptionTableMap::COL_TITLE); |
|
371 | - $criteria->addSelectColumn(SubscriptionTableMap::COL_SERVICE); |
|
372 | - } else { |
|
373 | - $criteria->addSelectColumn($alias . '.id'); |
|
374 | - $criteria->addSelectColumn($alias . '.instance_name'); |
|
375 | - $criteria->addSelectColumn($alias . '.input_uuid'); |
|
376 | - $criteria->addSelectColumn($alias . '.user_id'); |
|
377 | - $criteria->addSelectColumn($alias . '.channel_id'); |
|
378 | - $criteria->addSelectColumn($alias . '.subscription_id'); |
|
379 | - $criteria->addSelectColumn($alias . '.started'); |
|
380 | - $criteria->addSelectColumn($alias . '.stopped'); |
|
381 | - $criteria->addSelectColumn($alias . '.title'); |
|
382 | - $criteria->addSelectColumn($alias . '.service'); |
|
383 | - } |
|
384 | - } |
|
385 | - |
|
386 | - /** |
|
387 | - * Returns the TableMap related to this object. |
|
388 | - * This method is not needed for general use but a specific application could have a need. |
|
389 | - * @return TableMap |
|
390 | - * @throws PropelException Any exceptions caught during processing will be |
|
391 | - * rethrown wrapped into a PropelException. |
|
392 | - */ |
|
393 | - public static function getTableMap() |
|
394 | - { |
|
395 | - return Propel::getServiceContainer()->getDatabaseMap(SubscriptionTableMap::DATABASE_NAME)->getTable(SubscriptionTableMap::TABLE_NAME); |
|
396 | - } |
|
397 | - |
|
398 | - /** |
|
399 | - * Add a TableMap instance to the database for this tableMap class. |
|
400 | - */ |
|
401 | - public static function buildTableMap() |
|
402 | - { |
|
403 | - $dbMap = Propel::getServiceContainer()->getDatabaseMap(SubscriptionTableMap::DATABASE_NAME); |
|
404 | - if (!$dbMap->hasTable(SubscriptionTableMap::TABLE_NAME)) { |
|
405 | - $dbMap->addTableObject(new SubscriptionTableMap()); |
|
406 | - } |
|
407 | - } |
|
408 | - |
|
409 | - /** |
|
410 | - * Performs a DELETE on the database, given a Subscription or Criteria object OR a primary key value. |
|
411 | - * |
|
412 | - * @param mixed $values Criteria or Subscription object or primary key or array of primary keys |
|
413 | - * which is used to create the DELETE statement |
|
414 | - * @param ConnectionInterface $con the connection to use |
|
415 | - * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows |
|
416 | - * if supported by native driver or if emulated using Propel. |
|
417 | - * @throws PropelException Any exceptions caught during processing will be |
|
418 | - * rethrown wrapped into a PropelException. |
|
419 | - */ |
|
420 | - public static function doDelete($values, ConnectionInterface $con = null) |
|
421 | - { |
|
422 | - if (null === $con) { |
|
423 | - $con = Propel::getServiceContainer()->getWriteConnection(SubscriptionTableMap::DATABASE_NAME); |
|
424 | - } |
|
425 | - |
|
426 | - if ($values instanceof Criteria) { |
|
427 | - // rename for clarity |
|
428 | - $criteria = $values; |
|
429 | - } elseif ($values instanceof \Jalle19\StatusManager\Database\Subscription) { // it's a model object |
|
430 | - // create criteria based on pk values |
|
431 | - $criteria = $values->buildPkeyCriteria(); |
|
432 | - } else { // it's a primary key, or an array of pks |
|
433 | - $criteria = new Criteria(SubscriptionTableMap::DATABASE_NAME); |
|
434 | - $criteria->add(SubscriptionTableMap::COL_ID, (array) $values, Criteria::IN); |
|
435 | - } |
|
436 | - |
|
437 | - $query = SubscriptionQuery::create()->mergeWith($criteria); |
|
438 | - |
|
439 | - if ($values instanceof Criteria) { |
|
440 | - SubscriptionTableMap::clearInstancePool(); |
|
441 | - } elseif (!is_object($values)) { // it's a primary key, or an array of pks |
|
442 | - foreach ((array) $values as $singleval) { |
|
443 | - SubscriptionTableMap::removeInstanceFromPool($singleval); |
|
444 | - } |
|
445 | - } |
|
446 | - |
|
447 | - return $query->delete($con); |
|
448 | - } |
|
449 | - |
|
450 | - /** |
|
451 | - * Deletes all rows from the subscription table. |
|
452 | - * |
|
453 | - * @param ConnectionInterface $con the connection to use |
|
454 | - * @return int The number of affected rows (if supported by underlying database driver). |
|
455 | - */ |
|
456 | - public static function doDeleteAll(ConnectionInterface $con = null) |
|
457 | - { |
|
458 | - return SubscriptionQuery::create()->doDeleteAll($con); |
|
459 | - } |
|
460 | - |
|
461 | - /** |
|
462 | - * Performs an INSERT on the database, given a Subscription or Criteria object. |
|
463 | - * |
|
464 | - * @param mixed $criteria Criteria or Subscription object containing data that is used to create the INSERT statement. |
|
465 | - * @param ConnectionInterface $con the ConnectionInterface connection to use |
|
466 | - * @return mixed The new primary key. |
|
467 | - * @throws PropelException Any exceptions caught during processing will be |
|
468 | - * rethrown wrapped into a PropelException. |
|
469 | - */ |
|
470 | - public static function doInsert($criteria, ConnectionInterface $con = null) |
|
471 | - { |
|
472 | - if (null === $con) { |
|
473 | - $con = Propel::getServiceContainer()->getWriteConnection(SubscriptionTableMap::DATABASE_NAME); |
|
474 | - } |
|
475 | - |
|
476 | - if ($criteria instanceof Criteria) { |
|
477 | - $criteria = clone $criteria; // rename for clarity |
|
478 | - } else { |
|
479 | - $criteria = $criteria->buildCriteria(); // build Criteria from Subscription object |
|
480 | - } |
|
481 | - |
|
482 | - if ($criteria->containsKey(SubscriptionTableMap::COL_ID) && $criteria->keyContainsValue(SubscriptionTableMap::COL_ID) ) { |
|
483 | - throw new PropelException('Cannot insert a value for auto-increment primary key ('.SubscriptionTableMap::COL_ID.')'); |
|
484 | - } |
|
485 | - |
|
486 | - |
|
487 | - // Set the correct dbName |
|
488 | - $query = SubscriptionQuery::create()->mergeWith($criteria); |
|
489 | - |
|
490 | - // use transaction because $criteria could contain info |
|
491 | - // for more than one table (I guess, conceivably) |
|
492 | - return $con->transaction(function () use ($con, $query) { |
|
493 | - return $query->doInsert($con); |
|
494 | - }); |
|
495 | - } |
|
288 | + * TableMap::TYPE_COLNAME, TableMap::TYPE_FIELDNAME, TableMap::TYPE_NUM. |
|
289 | + * |
|
290 | + * @throws PropelException Any exceptions caught during processing will be |
|
291 | + * rethrown wrapped into a PropelException. |
|
292 | + * @return array (Subscription object, last column rank) |
|
293 | + */ |
|
294 | + public static function populateObject($row, $offset = 0, $indexType = TableMap::TYPE_NUM) |
|
295 | + { |
|
296 | + $key = SubscriptionTableMap::getPrimaryKeyHashFromRow($row, $offset, $indexType); |
|
297 | + if (null !== ($obj = SubscriptionTableMap::getInstanceFromPool($key))) { |
|
298 | + // We no longer rehydrate the object, since this can cause data loss. |
|
299 | + // See http://www.propelorm.org/ticket/509 |
|
300 | + // $obj->hydrate($row, $offset, true); // rehydrate |
|
301 | + $col = $offset + SubscriptionTableMap::NUM_HYDRATE_COLUMNS; |
|
302 | + } else { |
|
303 | + $cls = SubscriptionTableMap::OM_CLASS; |
|
304 | + /** @var Subscription $obj */ |
|
305 | + $obj = new $cls(); |
|
306 | + $col = $obj->hydrate($row, $offset, false, $indexType); |
|
307 | + SubscriptionTableMap::addInstanceToPool($obj, $key); |
|
308 | + } |
|
309 | + |
|
310 | + return array($obj, $col); |
|
311 | + } |
|
312 | + |
|
313 | + /** |
|
314 | + * The returned array will contain objects of the default type or |
|
315 | + * objects that inherit from the default. |
|
316 | + * |
|
317 | + * @param DataFetcherInterface $dataFetcher |
|
318 | + * @return array |
|
319 | + * @throws PropelException Any exceptions caught during processing will be |
|
320 | + * rethrown wrapped into a PropelException. |
|
321 | + */ |
|
322 | + public static function populateObjects(DataFetcherInterface $dataFetcher) |
|
323 | + { |
|
324 | + $results = array(); |
|
325 | + |
|
326 | + // set the class once to avoid overhead in the loop |
|
327 | + $cls = static::getOMClass(false); |
|
328 | + // populate the object(s) |
|
329 | + while ($row = $dataFetcher->fetch()) { |
|
330 | + $key = SubscriptionTableMap::getPrimaryKeyHashFromRow($row, 0, $dataFetcher->getIndexType()); |
|
331 | + if (null !== ($obj = SubscriptionTableMap::getInstanceFromPool($key))) { |
|
332 | + // We no longer rehydrate the object, since this can cause data loss. |
|
333 | + // See http://www.propelorm.org/ticket/509 |
|
334 | + // $obj->hydrate($row, 0, true); // rehydrate |
|
335 | + $results[] = $obj; |
|
336 | + } else { |
|
337 | + /** @var Subscription $obj */ |
|
338 | + $obj = new $cls(); |
|
339 | + $obj->hydrate($row); |
|
340 | + $results[] = $obj; |
|
341 | + SubscriptionTableMap::addInstanceToPool($obj, $key); |
|
342 | + } // if key exists |
|
343 | + } |
|
344 | + |
|
345 | + return $results; |
|
346 | + } |
|
347 | + /** |
|
348 | + * Add all the columns needed to create a new object. |
|
349 | + * |
|
350 | + * Note: any columns that were marked with lazyLoad="true" in the |
|
351 | + * XML schema will not be added to the select list and only loaded |
|
352 | + * on demand. |
|
353 | + * |
|
354 | + * @param Criteria $criteria object containing the columns to add. |
|
355 | + * @param string $alias optional table alias |
|
356 | + * @throws PropelException Any exceptions caught during processing will be |
|
357 | + * rethrown wrapped into a PropelException. |
|
358 | + */ |
|
359 | + public static function addSelectColumns(Criteria $criteria, $alias = null) |
|
360 | + { |
|
361 | + if (null === $alias) { |
|
362 | + $criteria->addSelectColumn(SubscriptionTableMap::COL_ID); |
|
363 | + $criteria->addSelectColumn(SubscriptionTableMap::COL_INSTANCE_NAME); |
|
364 | + $criteria->addSelectColumn(SubscriptionTableMap::COL_INPUT_UUID); |
|
365 | + $criteria->addSelectColumn(SubscriptionTableMap::COL_USER_ID); |
|
366 | + $criteria->addSelectColumn(SubscriptionTableMap::COL_CHANNEL_ID); |
|
367 | + $criteria->addSelectColumn(SubscriptionTableMap::COL_SUBSCRIPTION_ID); |
|
368 | + $criteria->addSelectColumn(SubscriptionTableMap::COL_STARTED); |
|
369 | + $criteria->addSelectColumn(SubscriptionTableMap::COL_STOPPED); |
|
370 | + $criteria->addSelectColumn(SubscriptionTableMap::COL_TITLE); |
|
371 | + $criteria->addSelectColumn(SubscriptionTableMap::COL_SERVICE); |
|
372 | + } else { |
|
373 | + $criteria->addSelectColumn($alias . '.id'); |
|
374 | + $criteria->addSelectColumn($alias . '.instance_name'); |
|
375 | + $criteria->addSelectColumn($alias . '.input_uuid'); |
|
376 | + $criteria->addSelectColumn($alias . '.user_id'); |
|
377 | + $criteria->addSelectColumn($alias . '.channel_id'); |
|
378 | + $criteria->addSelectColumn($alias . '.subscription_id'); |
|
379 | + $criteria->addSelectColumn($alias . '.started'); |
|
380 | + $criteria->addSelectColumn($alias . '.stopped'); |
|
381 | + $criteria->addSelectColumn($alias . '.title'); |
|
382 | + $criteria->addSelectColumn($alias . '.service'); |
|
383 | + } |
|
384 | + } |
|
385 | + |
|
386 | + /** |
|
387 | + * Returns the TableMap related to this object. |
|
388 | + * This method is not needed for general use but a specific application could have a need. |
|
389 | + * @return TableMap |
|
390 | + * @throws PropelException Any exceptions caught during processing will be |
|
391 | + * rethrown wrapped into a PropelException. |
|
392 | + */ |
|
393 | + public static function getTableMap() |
|
394 | + { |
|
395 | + return Propel::getServiceContainer()->getDatabaseMap(SubscriptionTableMap::DATABASE_NAME)->getTable(SubscriptionTableMap::TABLE_NAME); |
|
396 | + } |
|
397 | + |
|
398 | + /** |
|
399 | + * Add a TableMap instance to the database for this tableMap class. |
|
400 | + */ |
|
401 | + public static function buildTableMap() |
|
402 | + { |
|
403 | + $dbMap = Propel::getServiceContainer()->getDatabaseMap(SubscriptionTableMap::DATABASE_NAME); |
|
404 | + if (!$dbMap->hasTable(SubscriptionTableMap::TABLE_NAME)) { |
|
405 | + $dbMap->addTableObject(new SubscriptionTableMap()); |
|
406 | + } |
|
407 | + } |
|
408 | + |
|
409 | + /** |
|
410 | + * Performs a DELETE on the database, given a Subscription or Criteria object OR a primary key value. |
|
411 | + * |
|
412 | + * @param mixed $values Criteria or Subscription object or primary key or array of primary keys |
|
413 | + * which is used to create the DELETE statement |
|
414 | + * @param ConnectionInterface $con the connection to use |
|
415 | + * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows |
|
416 | + * if supported by native driver or if emulated using Propel. |
|
417 | + * @throws PropelException Any exceptions caught during processing will be |
|
418 | + * rethrown wrapped into a PropelException. |
|
419 | + */ |
|
420 | + public static function doDelete($values, ConnectionInterface $con = null) |
|
421 | + { |
|
422 | + if (null === $con) { |
|
423 | + $con = Propel::getServiceContainer()->getWriteConnection(SubscriptionTableMap::DATABASE_NAME); |
|
424 | + } |
|
425 | + |
|
426 | + if ($values instanceof Criteria) { |
|
427 | + // rename for clarity |
|
428 | + $criteria = $values; |
|
429 | + } elseif ($values instanceof \Jalle19\StatusManager\Database\Subscription) { // it's a model object |
|
430 | + // create criteria based on pk values |
|
431 | + $criteria = $values->buildPkeyCriteria(); |
|
432 | + } else { // it's a primary key, or an array of pks |
|
433 | + $criteria = new Criteria(SubscriptionTableMap::DATABASE_NAME); |
|
434 | + $criteria->add(SubscriptionTableMap::COL_ID, (array) $values, Criteria::IN); |
|
435 | + } |
|
436 | + |
|
437 | + $query = SubscriptionQuery::create()->mergeWith($criteria); |
|
438 | + |
|
439 | + if ($values instanceof Criteria) { |
|
440 | + SubscriptionTableMap::clearInstancePool(); |
|
441 | + } elseif (!is_object($values)) { // it's a primary key, or an array of pks |
|
442 | + foreach ((array) $values as $singleval) { |
|
443 | + SubscriptionTableMap::removeInstanceFromPool($singleval); |
|
444 | + } |
|
445 | + } |
|
446 | + |
|
447 | + return $query->delete($con); |
|
448 | + } |
|
449 | + |
|
450 | + /** |
|
451 | + * Deletes all rows from the subscription table. |
|
452 | + * |
|
453 | + * @param ConnectionInterface $con the connection to use |
|
454 | + * @return int The number of affected rows (if supported by underlying database driver). |
|
455 | + */ |
|
456 | + public static function doDeleteAll(ConnectionInterface $con = null) |
|
457 | + { |
|
458 | + return SubscriptionQuery::create()->doDeleteAll($con); |
|
459 | + } |
|
460 | + |
|
461 | + /** |
|
462 | + * Performs an INSERT on the database, given a Subscription or Criteria object. |
|
463 | + * |
|
464 | + * @param mixed $criteria Criteria or Subscription object containing data that is used to create the INSERT statement. |
|
465 | + * @param ConnectionInterface $con the ConnectionInterface connection to use |
|
466 | + * @return mixed The new primary key. |
|
467 | + * @throws PropelException Any exceptions caught during processing will be |
|
468 | + * rethrown wrapped into a PropelException. |
|
469 | + */ |
|
470 | + public static function doInsert($criteria, ConnectionInterface $con = null) |
|
471 | + { |
|
472 | + if (null === $con) { |
|
473 | + $con = Propel::getServiceContainer()->getWriteConnection(SubscriptionTableMap::DATABASE_NAME); |
|
474 | + } |
|
475 | + |
|
476 | + if ($criteria instanceof Criteria) { |
|
477 | + $criteria = clone $criteria; // rename for clarity |
|
478 | + } else { |
|
479 | + $criteria = $criteria->buildCriteria(); // build Criteria from Subscription object |
|
480 | + } |
|
481 | + |
|
482 | + if ($criteria->containsKey(SubscriptionTableMap::COL_ID) && $criteria->keyContainsValue(SubscriptionTableMap::COL_ID) ) { |
|
483 | + throw new PropelException('Cannot insert a value for auto-increment primary key ('.SubscriptionTableMap::COL_ID.')'); |
|
484 | + } |
|
485 | + |
|
486 | + |
|
487 | + // Set the correct dbName |
|
488 | + $query = SubscriptionQuery::create()->mergeWith($criteria); |
|
489 | + |
|
490 | + // use transaction because $criteria could contain info |
|
491 | + // for more than one table (I guess, conceivably) |
|
492 | + return $con->transaction(function () use ($con, $query) { |
|
493 | + return $query->doInsert($con); |
|
494 | + }); |
|
495 | + } |
|
496 | 496 | |
497 | 497 | } // SubscriptionTableMap |
498 | 498 | // This is the static code needed to register the TableMap for this table with the main Propel class. |
@@ -132,12 +132,12 @@ discard block |
||
132 | 132 | * first dimension keys are the type constants |
133 | 133 | * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' |
134 | 134 | */ |
135 | - protected static $fieldNames = array ( |
|
136 | - self::TYPE_PHPNAME => array('Id', 'InstanceName', 'InputUuid', 'UserId', 'ChannelId', 'SubscriptionId', 'Started', 'Stopped', 'Title', 'Service', ), |
|
137 | - self::TYPE_CAMELNAME => array('id', 'instanceName', 'inputUuid', 'userId', 'channelId', 'subscriptionId', 'started', 'stopped', 'title', 'service', ), |
|
138 | - self::TYPE_COLNAME => array(SubscriptionTableMap::COL_ID, SubscriptionTableMap::COL_INSTANCE_NAME, SubscriptionTableMap::COL_INPUT_UUID, SubscriptionTableMap::COL_USER_ID, SubscriptionTableMap::COL_CHANNEL_ID, SubscriptionTableMap::COL_SUBSCRIPTION_ID, SubscriptionTableMap::COL_STARTED, SubscriptionTableMap::COL_STOPPED, SubscriptionTableMap::COL_TITLE, SubscriptionTableMap::COL_SERVICE, ), |
|
139 | - self::TYPE_FIELDNAME => array('id', 'instance_name', 'input_uuid', 'user_id', 'channel_id', 'subscription_id', 'started', 'stopped', 'title', 'service', ), |
|
140 | - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ) |
|
135 | + protected static $fieldNames = array( |
|
136 | + self::TYPE_PHPNAME => array('Id', 'InstanceName', 'InputUuid', 'UserId', 'ChannelId', 'SubscriptionId', 'Started', 'Stopped', 'Title', 'Service',), |
|
137 | + self::TYPE_CAMELNAME => array('id', 'instanceName', 'inputUuid', 'userId', 'channelId', 'subscriptionId', 'started', 'stopped', 'title', 'service',), |
|
138 | + self::TYPE_COLNAME => array(SubscriptionTableMap::COL_ID, SubscriptionTableMap::COL_INSTANCE_NAME, SubscriptionTableMap::COL_INPUT_UUID, SubscriptionTableMap::COL_USER_ID, SubscriptionTableMap::COL_CHANNEL_ID, SubscriptionTableMap::COL_SUBSCRIPTION_ID, SubscriptionTableMap::COL_STARTED, SubscriptionTableMap::COL_STOPPED, SubscriptionTableMap::COL_TITLE, SubscriptionTableMap::COL_SERVICE,), |
|
139 | + self::TYPE_FIELDNAME => array('id', 'instance_name', 'input_uuid', 'user_id', 'channel_id', 'subscription_id', 'started', 'stopped', 'title', 'service',), |
|
140 | + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9,) |
|
141 | 141 | ); |
142 | 142 | |
143 | 143 | /** |
@@ -146,12 +146,12 @@ discard block |
||
146 | 146 | * first dimension keys are the type constants |
147 | 147 | * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 |
148 | 148 | */ |
149 | - protected static $fieldKeys = array ( |
|
150 | - self::TYPE_PHPNAME => array('Id' => 0, 'InstanceName' => 1, 'InputUuid' => 2, 'UserId' => 3, 'ChannelId' => 4, 'SubscriptionId' => 5, 'Started' => 6, 'Stopped' => 7, 'Title' => 8, 'Service' => 9, ), |
|
151 | - self::TYPE_CAMELNAME => array('id' => 0, 'instanceName' => 1, 'inputUuid' => 2, 'userId' => 3, 'channelId' => 4, 'subscriptionId' => 5, 'started' => 6, 'stopped' => 7, 'title' => 8, 'service' => 9, ), |
|
152 | - self::TYPE_COLNAME => array(SubscriptionTableMap::COL_ID => 0, SubscriptionTableMap::COL_INSTANCE_NAME => 1, SubscriptionTableMap::COL_INPUT_UUID => 2, SubscriptionTableMap::COL_USER_ID => 3, SubscriptionTableMap::COL_CHANNEL_ID => 4, SubscriptionTableMap::COL_SUBSCRIPTION_ID => 5, SubscriptionTableMap::COL_STARTED => 6, SubscriptionTableMap::COL_STOPPED => 7, SubscriptionTableMap::COL_TITLE => 8, SubscriptionTableMap::COL_SERVICE => 9, ), |
|
153 | - self::TYPE_FIELDNAME => array('id' => 0, 'instance_name' => 1, 'input_uuid' => 2, 'user_id' => 3, 'channel_id' => 4, 'subscription_id' => 5, 'started' => 6, 'stopped' => 7, 'title' => 8, 'service' => 9, ), |
|
154 | - self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ) |
|
149 | + protected static $fieldKeys = array( |
|
150 | + self::TYPE_PHPNAME => array('Id' => 0, 'InstanceName' => 1, 'InputUuid' => 2, 'UserId' => 3, 'ChannelId' => 4, 'SubscriptionId' => 5, 'Started' => 6, 'Stopped' => 7, 'Title' => 8, 'Service' => 9,), |
|
151 | + self::TYPE_CAMELNAME => array('id' => 0, 'instanceName' => 1, 'inputUuid' => 2, 'userId' => 3, 'channelId' => 4, 'subscriptionId' => 5, 'started' => 6, 'stopped' => 7, 'title' => 8, 'service' => 9,), |
|
152 | + self::TYPE_COLNAME => array(SubscriptionTableMap::COL_ID => 0, SubscriptionTableMap::COL_INSTANCE_NAME => 1, SubscriptionTableMap::COL_INPUT_UUID => 2, SubscriptionTableMap::COL_USER_ID => 3, SubscriptionTableMap::COL_CHANNEL_ID => 4, SubscriptionTableMap::COL_SUBSCRIPTION_ID => 5, SubscriptionTableMap::COL_STARTED => 6, SubscriptionTableMap::COL_STOPPED => 7, SubscriptionTableMap::COL_TITLE => 8, SubscriptionTableMap::COL_SERVICE => 9,), |
|
153 | + self::TYPE_FIELDNAME => array('id' => 0, 'instance_name' => 1, 'input_uuid' => 2, 'user_id' => 3, 'channel_id' => 4, 'subscription_id' => 5, 'started' => 6, 'stopped' => 7, 'title' => 8, 'service' => 9,), |
|
154 | + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9,) |
|
155 | 155 | ); |
156 | 156 | |
157 | 157 | /** |
@@ -188,30 +188,30 @@ discard block |
||
188 | 188 | */ |
189 | 189 | public function buildRelations() |
190 | 190 | { |
191 | - $this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array ( |
|
191 | + $this->addRelation('Instance', '\\Jalle19\\StatusManager\\Database\\Instance', RelationMap::MANY_TO_ONE, array( |
|
192 | 192 | 0 => |
193 | - array ( |
|
193 | + array( |
|
194 | 194 | 0 => ':instance_name', |
195 | 195 | 1 => ':name', |
196 | 196 | ), |
197 | 197 | ), null, null, null, false); |
198 | - $this->addRelation('Input', '\\Jalle19\\StatusManager\\Database\\Input', RelationMap::MANY_TO_ONE, array ( |
|
198 | + $this->addRelation('Input', '\\Jalle19\\StatusManager\\Database\\Input', RelationMap::MANY_TO_ONE, array( |
|
199 | 199 | 0 => |
200 | - array ( |
|
200 | + array( |
|
201 | 201 | 0 => ':input_uuid', |
202 | 202 | 1 => ':uuid', |
203 | 203 | ), |
204 | 204 | ), null, null, null, false); |
205 | - $this->addRelation('User', '\\Jalle19\\StatusManager\\Database\\User', RelationMap::MANY_TO_ONE, array ( |
|
205 | + $this->addRelation('User', '\\Jalle19\\StatusManager\\Database\\User', RelationMap::MANY_TO_ONE, array( |
|
206 | 206 | 0 => |
207 | - array ( |
|
207 | + array( |
|
208 | 208 | 0 => ':user_id', |
209 | 209 | 1 => ':id', |
210 | 210 | ), |
211 | 211 | ), null, null, null, false); |
212 | - $this->addRelation('Channel', '\\Jalle19\\StatusManager\\Database\\Channel', RelationMap::MANY_TO_ONE, array ( |
|
212 | + $this->addRelation('Channel', '\\Jalle19\\StatusManager\\Database\\Channel', RelationMap::MANY_TO_ONE, array( |
|
213 | 213 | 0 => |
214 | - array ( |
|
214 | + array( |
|
215 | 215 | 0 => ':channel_id', |
216 | 216 | 1 => ':id', |
217 | 217 | ), |
@@ -479,8 +479,8 @@ discard block |
||
479 | 479 | $criteria = $criteria->buildCriteria(); // build Criteria from Subscription object |
480 | 480 | } |
481 | 481 | |
482 | - if ($criteria->containsKey(SubscriptionTableMap::COL_ID) && $criteria->keyContainsValue(SubscriptionTableMap::COL_ID) ) { |
|
483 | - throw new PropelException('Cannot insert a value for auto-increment primary key ('.SubscriptionTableMap::COL_ID.')'); |
|
482 | + if ($criteria->containsKey(SubscriptionTableMap::COL_ID) && $criteria->keyContainsValue(SubscriptionTableMap::COL_ID)) { |
|
483 | + throw new PropelException('Cannot insert a value for auto-increment primary key (' . SubscriptionTableMap::COL_ID . ')'); |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | |
490 | 490 | // use transaction because $criteria could contain info |
491 | 491 | // for more than one table (I guess, conceivably) |
492 | - return $con->transaction(function () use ($con, $query) { |
|
492 | + return $con->transaction(function() use ($con, $query) { |
|
493 | 493 | return $query->doInsert($con); |
494 | 494 | }); |
495 | 495 | } |
@@ -151,7 +151,7 @@ |
||
151 | 151 | $this->_persistenceManager->onConnectionSeen($instanceName, $connection); |
152 | 152 | |
153 | 153 | // Persist inputs |
154 | - foreach($instanceStatus->getInputs() as $input) |
|
154 | + foreach ($instanceStatus->getInputs() as $input) |
|
155 | 155 | $this->_persistenceManager->onInputSeen($instanceName, $input); |
156 | 156 | |
157 | 157 | // Persist running subscriptions |
@@ -70,8 +70,9 @@ discard block |
||
70 | 70 | $this->_instances = new \SplObjectStorage(); |
71 | 71 | |
72 | 72 | // Attach a state to each instance |
73 | - foreach ($this->_configuration->getInstances() as $instance) |
|
74 | - $this->_instances->attach($instance, new InstanceState()); |
|
73 | + foreach ($this->_configuration->getInstances() as $instance) { |
|
74 | + $this->_instances->attach($instance, new InstanceState()); |
|
75 | + } |
|
75 | 76 | |
76 | 77 | // Start the persistence manager |
77 | 78 | $this->_persistenceManager = new PersistenceManager($logger); |
@@ -147,20 +148,24 @@ discard block |
||
147 | 148 | ]); |
148 | 149 | |
149 | 150 | // Persist connections |
150 | - foreach ($instanceStatus->getConnections() as $connection) |
|
151 | - $this->_persistenceManager->onConnectionSeen($instanceName, $connection); |
|
151 | + foreach ($instanceStatus->getConnections() as $connection) { |
|
152 | + $this->_persistenceManager->onConnectionSeen($instanceName, $connection); |
|
153 | + } |
|
152 | 154 | |
153 | 155 | // Persist inputs |
154 | - foreach($instanceStatus->getInputs() as $input) |
|
155 | - $this->_persistenceManager->onInputSeen($instanceName, $input); |
|
156 | + foreach($instanceStatus->getInputs() as $input) { |
|
157 | + $this->_persistenceManager->onInputSeen($instanceName, $input); |
|
158 | + } |
|
156 | 159 | |
157 | 160 | // Persist running subscriptions |
158 | - foreach ($instanceStatus->getSubscriptions() as $subscription) |
|
159 | - $this->_persistenceManager->onSubscriptionSeen($instanceName, $subscription); |
|
161 | + foreach ($instanceStatus->getSubscriptions() as $subscription) { |
|
162 | + $this->_persistenceManager->onSubscriptionSeen($instanceName, $subscription); |
|
163 | + } |
|
160 | 164 | |
161 | 165 | // Handle subscription state changes |
162 | - foreach ($instanceStatus->getSubscriptionStateChanges() as $subscriptionStateChange) |
|
163 | - $this->_persistenceManager->onSubscriptionStateChange($instanceName, $subscriptionStateChange); |
|
166 | + foreach ($instanceStatus->getSubscriptionStateChanges() as $subscriptionStateChange) { |
|
167 | + $this->_persistenceManager->onSubscriptionStateChange($instanceName, $subscriptionStateChange); |
|
168 | + } |
|
164 | 169 | } |
165 | 170 | |
166 | 171 | // Broadcast the status messages to all connected clients |
@@ -208,8 +213,7 @@ discard block |
||
208 | 213 | |
209 | 214 | $instanceState->setReachability(InstanceState::REACHABLE); |
210 | 215 | } |
211 | - } |
|
212 | - catch (\Exception $e) |
|
216 | + } catch (\Exception $e) |
|
213 | 217 | { |
214 | 218 | // Mark the instance as unreachable |
215 | 219 | $message = 'Instance {instanceName} not reachable, will wait for {cycles} cycles before retrying. |
@@ -223,8 +227,7 @@ discard block |
||
223 | 227 | |
224 | 228 | $instanceState->setReachability(InstanceState::UNREACHABLE); |
225 | 229 | } |
226 | - } |
|
227 | - else |
|
230 | + } else |
|
228 | 231 | { |
229 | 232 | // Wait for some cycles and then mark unreachable instances as maybe reachable |
230 | 233 | if ($instanceState->getRetryCount() === self::UNREACHABLE_CYCLES_UNTIL_RETRY - 1) |
@@ -235,9 +238,9 @@ discard block |
||
235 | 238 | $this->_logger->info('Retrying instance {instanceName} during next cycle', [ |
236 | 239 | 'instanceName' => $instanceName, |
237 | 240 | ]); |
241 | + } else { |
|
242 | + $instanceState->incrementRetryCount(); |
|
238 | 243 | } |
239 | - else |
|
240 | - $instanceState->incrementRetryCount(); |
|
241 | 244 | } |
242 | 245 | } |
243 | 246 |