@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | 'customer.property.type.id' => array( |
25 | 25 | 'code' => 'customer.property.type.id', |
26 | 26 | 'internalcode' => 'ezpprty."id"', |
27 | - 'internaldeps' => array( 'LEFT JOIN "ezp_user_property_type" AS ezpprty ON ( ezppr."typeid" = ezpprty."id" )' ), |
|
27 | + 'internaldeps' => array('LEFT JOIN "ezp_user_property_type" AS ezpprty ON ( ezppr."typeid" = ezpprty."id" )'), |
|
28 | 28 | 'label' => 'Property type ID', |
29 | 29 | 'type' => 'integer', |
30 | 30 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
@@ -105,14 +105,14 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @param array $siteids List of IDs for sites whose entries should be deleted |
107 | 107 | */ |
108 | - public function cleanup( array $siteids ) |
|
108 | + public function cleanup(array $siteids) |
|
109 | 109 | { |
110 | 110 | $path = 'mshop/customer/manager/property/type/submanagers'; |
111 | - foreach( $this->getContext()->getConfig()->get( $path, [] ) as $domain ) { |
|
112 | - $this->getObject()->getSubManager( $domain )->cleanup( $siteids ); |
|
111 | + foreach ($this->getContext()->getConfig()->get($path, []) as $domain) { |
|
112 | + $this->getObject()->getSubManager($domain)->cleanup($siteids); |
|
113 | 113 | } |
114 | 114 | |
115 | - $this->cleanupBase( $siteids, 'mshop/customer/manager/property/type/ezpublish/delete' ); |
|
115 | + $this->cleanupBase($siteids, 'mshop/customer/manager/property/type/ezpublish/delete'); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | |
@@ -122,11 +122,11 @@ discard block |
||
122 | 122 | * @param boolean $withsub Return also attributes of sub-managers if true |
123 | 123 | * @return array Returns a list of attribtes implementing \Aimeos\MW\Criteria\Attribute\Iface |
124 | 124 | */ |
125 | - public function getSearchAttributes( $withsub = true ) |
|
125 | + public function getSearchAttributes($withsub = true) |
|
126 | 126 | { |
127 | 127 | $path = 'mshop/customer/manager/property/type/submanagers'; |
128 | 128 | |
129 | - return $this->getSearchAttributesBase( $this->searchConfig, $path, [], $withsub ); |
|
129 | + return $this->getSearchAttributesBase($this->searchConfig, $path, [], $withsub); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
@@ -137,9 +137,9 @@ discard block |
||
137 | 137 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
138 | 138 | * @return \Aimeos\MShop\Common\Manager\Iface Manager for different extensions, e.g types, lists etc. |
139 | 139 | */ |
140 | - public function getSubManager( $manager, $name = null ) |
|
140 | + public function getSubManager($manager, $name = null) |
|
141 | 141 | { |
142 | - return $this->getSubManagerBase( 'customer', 'property/type/' . $manager, ( $name === null ? 'Ezpublish' : $name ) ); |
|
142 | + return $this->getSubManagerBase('customer', 'property/type/'.$manager, ($name === null ? 'Ezpublish' : $name)); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | 'customer.lists.id'=> array( |
26 | 26 | 'code'=>'customer.lists.id', |
27 | 27 | 'internalcode'=>'ezuli."id"', |
28 | - 'internaldeps' => array( 'LEFT JOIN "ezuser_list" AS ezuli ON ( ezu."id" = ezuli."parentid" )' ), |
|
28 | + 'internaldeps' => array('LEFT JOIN "ezuser_list" AS ezuli ON ( ezu."id" = ezuli."parentid" )'), |
|
29 | 29 | 'label'=>'Customer list ID', |
30 | 30 | 'type'=> 'integer', |
31 | 31 | 'internaltype'=> \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
@@ -133,14 +133,14 @@ discard block |
||
133 | 133 | * |
134 | 134 | * @param array $siteids List of IDs for sites whose entries should be deleted |
135 | 135 | */ |
136 | - public function cleanup( array $siteids ) |
|
136 | + public function cleanup(array $siteids) |
|
137 | 137 | { |
138 | 138 | $path = 'mshop/customer/manager/lists/submanagers'; |
139 | - foreach( $this->getContext()->getConfig()->get( $path, array( 'type' ) ) as $domain ) { |
|
140 | - $this->getObject()->getSubManager( $domain )->cleanup( $siteids ); |
|
139 | + foreach ($this->getContext()->getConfig()->get($path, array('type')) as $domain) { |
|
140 | + $this->getObject()->getSubManager($domain)->cleanup($siteids); |
|
141 | 141 | } |
142 | 142 | |
143 | - $this->cleanupBase( $siteids, $this->getConfigPath() . 'delete' ); |
|
143 | + $this->cleanupBase($siteids, $this->getConfigPath().'delete'); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | |
@@ -150,11 +150,11 @@ discard block |
||
150 | 150 | * @param boolean $withsub Return also attributes of sub-managers if true |
151 | 151 | * @return array Returns a list of attribtes implementing \Aimeos\MW\Criteria\Attribute\Iface |
152 | 152 | */ |
153 | - public function getSearchAttributes( $withsub = true ) |
|
153 | + public function getSearchAttributes($withsub = true) |
|
154 | 154 | { |
155 | 155 | $path = 'mshop/customer/manager/lists/submanagers'; |
156 | 156 | |
157 | - return $this->getSearchAttributesBase( $this->getSearchConfig(), $path, ['type'], $withsub ); |
|
157 | + return $this->getSearchAttributesBase($this->getSearchConfig(), $path, ['type'], $withsub); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
166 | 166 | * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
167 | 167 | */ |
168 | - public function getSubManager( $manager, $name = null ) |
|
168 | + public function getSubManager($manager, $name = null) |
|
169 | 169 | { |
170 | - return $this->getSubManagerBase( 'customer', 'lists/' . $manager, ( $name === null ? 'Ezpublish' : $name ) ); |
|
170 | + return $this->getSubManagerBase('customer', 'lists/'.$manager, ($name === null ? 'Ezpublish' : $name)); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | |
@@ -177,15 +177,15 @@ discard block |
||
177 | 177 | * @param \Aimeos\MShop\Common\Item\Lists\Iface $item List item object which should be saved |
178 | 178 | * @param boolean $fetch True if the new ID should be returned in the item |
179 | 179 | */ |
180 | - public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true ) |
|
180 | + public function saveItem(\Aimeos\MShop\Common\Item\Iface $item, $fetch = true) |
|
181 | 181 | { |
182 | - self::checkClass( '\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $item ); |
|
182 | + self::checkClass('\\Aimeos\\MShop\\Common\\Item\\Lists\\Iface', $item); |
|
183 | 183 | |
184 | - if( $item->getDomain() === 'customer/group' ) { |
|
185 | - throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Adding groups to customers is not supported, please use the eZ Publish backend' ) ); |
|
184 | + if ($item->getDomain() === 'customer/group') { |
|
185 | + throw new \Aimeos\MShop\Customer\Exception(sprintf('Adding groups to customers is not supported, please use the eZ Publish backend')); |
|
186 | 186 | } |
187 | 187 | |
188 | - parent::saveItem( $item, $fetch ); |
|
188 | + parent::saveItem($item, $fetch); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 |
@@ -8,176 +8,176 @@ |
||
8 | 8 | |
9 | 9 | return array( |
10 | 10 | 'table' => array( |
11 | - 'ezuser' => function ( \Doctrine\DBAL\Schema\Schema $schema ) { |
|
11 | + 'ezuser' => function(\Doctrine\DBAL\Schema\Schema $schema) { |
|
12 | 12 | |
13 | - $table = $schema->createTable( 'ezuser' ); |
|
13 | + $table = $schema->createTable('ezuser'); |
|
14 | 14 | |
15 | - $table->addColumn( 'contentobject_id', 'integer', [] ); |
|
16 | - $table->addColumn( 'email', 'string', array( 'length' => 150 ) ); |
|
17 | - $table->addColumn( 'login', 'string', array( 'length' => 150 ) ); |
|
18 | - $table->addColumn( 'login_normalized', 'string', array( 'length' => 150 ) ); |
|
19 | - $table->addColumn( 'password_hash', 'string', array( 'length' => 50 ) ); |
|
20 | - $table->addColumn( 'password_hash_type', 'integer', array( 'default' => 1 ) ); |
|
15 | + $table->addColumn('contentobject_id', 'integer', []); |
|
16 | + $table->addColumn('email', 'string', array('length' => 150)); |
|
17 | + $table->addColumn('login', 'string', array('length' => 150)); |
|
18 | + $table->addColumn('login_normalized', 'string', array('length' => 150)); |
|
19 | + $table->addColumn('password_hash', 'string', array('length' => 50)); |
|
20 | + $table->addColumn('password_hash_type', 'integer', array('default' => 1)); |
|
21 | 21 | |
22 | - $table->setPrimaryKey( array( 'contentobject_id' ) ); |
|
23 | - $table->addUniqueIndex( array( 'login_normalized' ), 'ezuser_login' ); |
|
22 | + $table->setPrimaryKey(array('contentobject_id')); |
|
23 | + $table->addUniqueIndex(array('login_normalized'), 'ezuser_login'); |
|
24 | 24 | |
25 | 25 | return $schema; |
26 | 26 | }, |
27 | 27 | |
28 | - 'ezuser_address' => function ( \Doctrine\DBAL\Schema\Schema $schema ) { |
|
29 | - |
|
30 | - $table = $schema->createTable( 'ezuser_address' ); |
|
31 | - |
|
32 | - $table->addColumn( 'id', 'integer', array( 'autoincrement' => true ) ); |
|
33 | - $table->addColumn( 'siteid', 'integer', [] ); |
|
34 | - $table->addColumn( 'parentid', 'integer', [] ); |
|
35 | - $table->addColumn( 'company', 'string', array( 'length' => 100 ) ); |
|
36 | - $table->addColumn( 'vatid', 'string', array( 'length' => 32 ) ); |
|
37 | - $table->addColumn( 'salutation', 'string', array( 'length' => 8 ) ); |
|
38 | - $table->addColumn( 'title', 'string', array( 'length' => 64 ) ); |
|
39 | - $table->addColumn( 'firstname', 'string', array( 'length' => 64 ) ); |
|
40 | - $table->addColumn( 'lastname', 'string', array( 'length' => 64 ) ); |
|
41 | - $table->addColumn( 'address1', 'string', array( 'length' => 255 ) ); |
|
42 | - $table->addColumn( 'address2', 'string', array( 'length' => 255 ) ); |
|
43 | - $table->addColumn( 'address3', 'string', array( 'length' => 255 ) ); |
|
44 | - $table->addColumn( 'postal', 'string', array( 'length' => 16 ) ); |
|
45 | - $table->addColumn( 'city', 'string', array( 'length' => 255 ) ); |
|
46 | - $table->addColumn( 'state', 'string', array( 'length' => 255 ) ); |
|
47 | - $table->addColumn( 'langid', 'string', array( 'length' => 5, 'notnull' => false ) ); |
|
48 | - $table->addColumn( 'countryid', 'string', array( 'length' => 2, 'notnull' => false, 'fixed' => true ) ); |
|
49 | - $table->addColumn( 'telephone', 'string', array( 'length' => 32 ) ); |
|
50 | - $table->addColumn( 'email', 'string', array( 'length' => 255 ) ); |
|
51 | - $table->addColumn( 'telefax', 'string', array( 'length' => 255 ) ); |
|
52 | - $table->addColumn( 'website', 'string', array( 'length' => 255 ) ); |
|
53 | - $table->addColumn( 'pos', 'smallint', [] ); |
|
54 | - $table->addColumn( 'mtime', 'datetime', [] ); |
|
55 | - $table->addColumn( 'ctime', 'datetime', [] ); |
|
56 | - $table->addColumn( 'editor', 'string', array('length' => 255 ) ); |
|
57 | - |
|
58 | - $table->setPrimaryKey( array( 'id' ), 'pk_ezpad_id' ); |
|
59 | - $table->addIndex( array( 'lastname', 'firstname' ), 'idx_ezpad_ln_fn' ); |
|
60 | - $table->addIndex( array( 'address1', 'address2' ), 'idx_ezpad_ad1_ad2' ); |
|
61 | - $table->addIndex( array( 'postal', 'city' ), 'idx_ezpad_post_ci' ); |
|
62 | - $table->addIndex( array( 'parentid' ), 'idx_ezpad_pid' ); |
|
63 | - $table->addIndex( array( 'city' ), 'idx_ezpad_city' ); |
|
64 | - |
|
65 | - $table->addForeignKeyConstraint( 'ezuser', array( 'parentid' ), array( 'contentobject_id' ), |
|
66 | - array( 'onUpdate' => 'CASCADE', 'onDelete' => 'CASCADE' ), 'fk_ezpad_pid' ); |
|
28 | + 'ezuser_address' => function(\Doctrine\DBAL\Schema\Schema $schema) { |
|
29 | + |
|
30 | + $table = $schema->createTable('ezuser_address'); |
|
31 | + |
|
32 | + $table->addColumn('id', 'integer', array('autoincrement' => true)); |
|
33 | + $table->addColumn('siteid', 'integer', []); |
|
34 | + $table->addColumn('parentid', 'integer', []); |
|
35 | + $table->addColumn('company', 'string', array('length' => 100)); |
|
36 | + $table->addColumn('vatid', 'string', array('length' => 32)); |
|
37 | + $table->addColumn('salutation', 'string', array('length' => 8)); |
|
38 | + $table->addColumn('title', 'string', array('length' => 64)); |
|
39 | + $table->addColumn('firstname', 'string', array('length' => 64)); |
|
40 | + $table->addColumn('lastname', 'string', array('length' => 64)); |
|
41 | + $table->addColumn('address1', 'string', array('length' => 255)); |
|
42 | + $table->addColumn('address2', 'string', array('length' => 255)); |
|
43 | + $table->addColumn('address3', 'string', array('length' => 255)); |
|
44 | + $table->addColumn('postal', 'string', array('length' => 16)); |
|
45 | + $table->addColumn('city', 'string', array('length' => 255)); |
|
46 | + $table->addColumn('state', 'string', array('length' => 255)); |
|
47 | + $table->addColumn('langid', 'string', array('length' => 5, 'notnull' => false)); |
|
48 | + $table->addColumn('countryid', 'string', array('length' => 2, 'notnull' => false, 'fixed' => true)); |
|
49 | + $table->addColumn('telephone', 'string', array('length' => 32)); |
|
50 | + $table->addColumn('email', 'string', array('length' => 255)); |
|
51 | + $table->addColumn('telefax', 'string', array('length' => 255)); |
|
52 | + $table->addColumn('website', 'string', array('length' => 255)); |
|
53 | + $table->addColumn('pos', 'smallint', []); |
|
54 | + $table->addColumn('mtime', 'datetime', []); |
|
55 | + $table->addColumn('ctime', 'datetime', []); |
|
56 | + $table->addColumn('editor', 'string', array('length' => 255)); |
|
57 | + |
|
58 | + $table->setPrimaryKey(array('id'), 'pk_ezpad_id'); |
|
59 | + $table->addIndex(array('lastname', 'firstname'), 'idx_ezpad_ln_fn'); |
|
60 | + $table->addIndex(array('address1', 'address2'), 'idx_ezpad_ad1_ad2'); |
|
61 | + $table->addIndex(array('postal', 'city'), 'idx_ezpad_post_ci'); |
|
62 | + $table->addIndex(array('parentid'), 'idx_ezpad_pid'); |
|
63 | + $table->addIndex(array('city'), 'idx_ezpad_city'); |
|
64 | + |
|
65 | + $table->addForeignKeyConstraint('ezuser', array('parentid'), array('contentobject_id'), |
|
66 | + array('onUpdate' => 'CASCADE', 'onDelete' => 'CASCADE'), 'fk_ezpad_pid'); |
|
67 | 67 | |
68 | 68 | return $schema; |
69 | 69 | }, |
70 | 70 | |
71 | - 'ezuser_list_type' => function ( \Doctrine\DBAL\Schema\Schema $schema ) { |
|
71 | + 'ezuser_list_type' => function(\Doctrine\DBAL\Schema\Schema $schema) { |
|
72 | 72 | |
73 | - $table = $schema->createTable( 'ezuser_list_type' ); |
|
73 | + $table = $schema->createTable('ezuser_list_type'); |
|
74 | 74 | |
75 | - $table->addColumn( 'id', 'integer', array( 'autoincrement' => true ) ); |
|
76 | - $table->addColumn( 'siteid', 'integer', [] ); |
|
77 | - $table->addColumn( 'domain', 'string', array( 'length' => 32 ) ); |
|
78 | - $table->addColumn( 'code', 'string', array( 'length' => 32 ) ); |
|
79 | - $table->addColumn( 'label', 'string', array( 'length' => 255 ) ); |
|
80 | - $table->addColumn( 'pos', 'integer', ['default' => 0] ); |
|
81 | - $table->addColumn( 'status', 'smallint', [] ); |
|
82 | - $table->addColumn( 'mtime', 'datetime', [] ); |
|
83 | - $table->addColumn( 'ctime', 'datetime', [] ); |
|
84 | - $table->addColumn( 'editor', 'string', array( 'length' => 255 ) ); |
|
75 | + $table->addColumn('id', 'integer', array('autoincrement' => true)); |
|
76 | + $table->addColumn('siteid', 'integer', []); |
|
77 | + $table->addColumn('domain', 'string', array('length' => 32)); |
|
78 | + $table->addColumn('code', 'string', array('length' => 32)); |
|
79 | + $table->addColumn('label', 'string', array('length' => 255)); |
|
80 | + $table->addColumn('pos', 'integer', ['default' => 0]); |
|
81 | + $table->addColumn('status', 'smallint', []); |
|
82 | + $table->addColumn('mtime', 'datetime', []); |
|
83 | + $table->addColumn('ctime', 'datetime', []); |
|
84 | + $table->addColumn('editor', 'string', array('length' => 255)); |
|
85 | 85 | |
86 | - $table->setPrimaryKey( array( 'id' ), 'pk_ezplity_id' ); |
|
87 | - $table->addUniqueIndex( array( 'siteid', 'domain', 'code' ), 'unq_ezplity_sid_dom_code' ); |
|
88 | - $table->addIndex( array( 'siteid', 'status' ), 'idx_ezplity_sid_status' ); |
|
89 | - $table->addIndex( array( 'siteid', 'label' ), 'idx_ezplity_sid_label' ); |
|
90 | - $table->addIndex( array( 'siteid', 'code' ), 'idx_ezplity_sid_code' ); |
|
86 | + $table->setPrimaryKey(array('id'), 'pk_ezplity_id'); |
|
87 | + $table->addUniqueIndex(array('siteid', 'domain', 'code'), 'unq_ezplity_sid_dom_code'); |
|
88 | + $table->addIndex(array('siteid', 'status'), 'idx_ezplity_sid_status'); |
|
89 | + $table->addIndex(array('siteid', 'label'), 'idx_ezplity_sid_label'); |
|
90 | + $table->addIndex(array('siteid', 'code'), 'idx_ezplity_sid_code'); |
|
91 | 91 | |
92 | 92 | return $schema; |
93 | 93 | }, |
94 | 94 | |
95 | - 'ezuser_list' => function ( \Doctrine\DBAL\Schema\Schema $schema ) { |
|
96 | - |
|
97 | - $table = $schema->createTable( 'ezuser_list' ); |
|
98 | - |
|
99 | - $table->addColumn( 'id', 'integer', array( 'autoincrement' => true ) ); |
|
100 | - $table->addColumn( 'parentid', 'integer', [] ); |
|
101 | - $table->addColumn( 'siteid', 'integer', [] ); |
|
102 | - $table->addColumn( 'typeid', 'integer', [] ); |
|
103 | - $table->addColumn( 'domain', 'string', array( 'length' => 32 ) ); |
|
104 | - $table->addColumn( 'refid', 'string', array( 'length' => 32 ) ); |
|
105 | - $table->addColumn( 'start', 'datetime', array( 'notnull' => false ) ); |
|
106 | - $table->addColumn( 'end', 'datetime', array( 'notnull' => false ) ); |
|
107 | - $table->addColumn( 'config', 'text', array( 'length' => 0xffff ) ); |
|
108 | - $table->addColumn( 'pos', 'integer', [] ); |
|
109 | - $table->addColumn( 'status', 'smallint', [] ); |
|
110 | - $table->addColumn( 'mtime', 'datetime', [] ); |
|
111 | - $table->addColumn( 'ctime', 'datetime', [] ); |
|
112 | - $table->addColumn( 'editor', 'string', array( 'length' => 255 ) ); |
|
113 | - |
|
114 | - $table->setPrimaryKey( array( 'id' ), 'pk_ezpli_id' ); |
|
115 | - $table->addUniqueIndex( array( 'siteid', 'domain', 'refid', 'typeid', 'parentid' ), 'unq_ezpli_sid_dm_rid_tid_pid' ); |
|
116 | - $table->addIndex( array( 'siteid', 'status', 'start', 'end' ), 'idx_ezpli_sid_stat_start_end' ); |
|
117 | - $table->addIndex( array( 'parentid', 'siteid', 'domain', 'refid', 'typeid' ), 'idx_ezpli_pid_sid_dom_rid_tid' ); |
|
118 | - $table->addIndex( array( 'parentid', 'siteid', 'start' ), 'idx_ezpli_pid_sid_start' ); |
|
119 | - $table->addIndex( array( 'parentid', 'siteid', 'end' ), 'idx_ezpli_pid_sid_end' ); |
|
120 | - $table->addIndex( array( 'parentid', 'siteid', 'pos' ), 'idx_ezpli_pid_sid_pos' ); |
|
121 | - |
|
122 | - $table->addForeignKeyConstraint( 'ezuser', array( 'parentid' ), array( 'contentobject_id' ), |
|
123 | - array( 'onUpdate' => 'CASCADE', 'onDelete' => 'CASCADE' ), 'fk_ezpli_pid' ); |
|
124 | - |
|
125 | - $table->addForeignKeyConstraint( 'ezuser_list_type', array( 'typeid' ), array( 'id' ), |
|
126 | - array( 'onUpdate' => 'CASCADE', 'onDelete' => 'CASCADE' ), 'fk_ezpli_typeid' ); |
|
95 | + 'ezuser_list' => function(\Doctrine\DBAL\Schema\Schema $schema) { |
|
96 | + |
|
97 | + $table = $schema->createTable('ezuser_list'); |
|
98 | + |
|
99 | + $table->addColumn('id', 'integer', array('autoincrement' => true)); |
|
100 | + $table->addColumn('parentid', 'integer', []); |
|
101 | + $table->addColumn('siteid', 'integer', []); |
|
102 | + $table->addColumn('typeid', 'integer', []); |
|
103 | + $table->addColumn('domain', 'string', array('length' => 32)); |
|
104 | + $table->addColumn('refid', 'string', array('length' => 32)); |
|
105 | + $table->addColumn('start', 'datetime', array('notnull' => false)); |
|
106 | + $table->addColumn('end', 'datetime', array('notnull' => false)); |
|
107 | + $table->addColumn('config', 'text', array('length' => 0xffff)); |
|
108 | + $table->addColumn('pos', 'integer', []); |
|
109 | + $table->addColumn('status', 'smallint', []); |
|
110 | + $table->addColumn('mtime', 'datetime', []); |
|
111 | + $table->addColumn('ctime', 'datetime', []); |
|
112 | + $table->addColumn('editor', 'string', array('length' => 255)); |
|
113 | + |
|
114 | + $table->setPrimaryKey(array('id'), 'pk_ezpli_id'); |
|
115 | + $table->addUniqueIndex(array('siteid', 'domain', 'refid', 'typeid', 'parentid'), 'unq_ezpli_sid_dm_rid_tid_pid'); |
|
116 | + $table->addIndex(array('siteid', 'status', 'start', 'end'), 'idx_ezpli_sid_stat_start_end'); |
|
117 | + $table->addIndex(array('parentid', 'siteid', 'domain', 'refid', 'typeid'), 'idx_ezpli_pid_sid_dom_rid_tid'); |
|
118 | + $table->addIndex(array('parentid', 'siteid', 'start'), 'idx_ezpli_pid_sid_start'); |
|
119 | + $table->addIndex(array('parentid', 'siteid', 'end'), 'idx_ezpli_pid_sid_end'); |
|
120 | + $table->addIndex(array('parentid', 'siteid', 'pos'), 'idx_ezpli_pid_sid_pos'); |
|
121 | + |
|
122 | + $table->addForeignKeyConstraint('ezuser', array('parentid'), array('contentobject_id'), |
|
123 | + array('onUpdate' => 'CASCADE', 'onDelete' => 'CASCADE'), 'fk_ezpli_pid'); |
|
124 | + |
|
125 | + $table->addForeignKeyConstraint('ezuser_list_type', array('typeid'), array('id'), |
|
126 | + array('onUpdate' => 'CASCADE', 'onDelete' => 'CASCADE'), 'fk_ezpli_typeid'); |
|
127 | 127 | |
128 | 128 | return $schema; |
129 | 129 | }, |
130 | 130 | |
131 | - 'ezuser_property_type' => function ( \Doctrine\DBAL\Schema\Schema $schema ) { |
|
131 | + 'ezuser_property_type' => function(\Doctrine\DBAL\Schema\Schema $schema) { |
|
132 | 132 | |
133 | - $table = $schema->createTable( 'ezuser_property_type' ); |
|
133 | + $table = $schema->createTable('ezuser_property_type'); |
|
134 | 134 | |
135 | - $table->addColumn( 'id', 'integer', array( 'autoincrement' => true ) ); |
|
136 | - $table->addColumn( 'siteid', 'integer', [] ); |
|
137 | - $table->addColumn( 'domain', 'string', array( 'length' => 32 ) ); |
|
138 | - $table->addColumn( 'code', 'string', array( 'length' => 32 ) ); |
|
139 | - $table->addColumn( 'label', 'string', array( 'length' => 255 ) ); |
|
140 | - $table->addColumn( 'pos', 'integer', ['default' => 0] ); |
|
141 | - $table->addColumn( 'status', 'smallint', [] ); |
|
142 | - $table->addColumn( 'mtime', 'datetime', [] ); |
|
143 | - $table->addColumn( 'ctime', 'datetime', [] ); |
|
144 | - $table->addColumn( 'editor', 'string', array( 'length' => 255 ) ); |
|
135 | + $table->addColumn('id', 'integer', array('autoincrement' => true)); |
|
136 | + $table->addColumn('siteid', 'integer', []); |
|
137 | + $table->addColumn('domain', 'string', array('length' => 32)); |
|
138 | + $table->addColumn('code', 'string', array('length' => 32)); |
|
139 | + $table->addColumn('label', 'string', array('length' => 255)); |
|
140 | + $table->addColumn('pos', 'integer', ['default' => 0]); |
|
141 | + $table->addColumn('status', 'smallint', []); |
|
142 | + $table->addColumn('mtime', 'datetime', []); |
|
143 | + $table->addColumn('ctime', 'datetime', []); |
|
144 | + $table->addColumn('editor', 'string', array('length' => 255)); |
|
145 | 145 | |
146 | - $table->setPrimaryKey( array( 'id' ), 'pk_ezpprty_id' ); |
|
147 | - $table->addUniqueIndex( array( 'siteid', 'domain', 'code' ), 'unq_ezpprty_sid_dom_code' ); |
|
148 | - $table->addIndex( array( 'siteid', 'status', 'pos' ), 'idx_ezpprty_sid_status_pos' ); |
|
149 | - $table->addIndex( array( 'siteid', 'label' ), 'idx_ezpprty_sid_label' ); |
|
150 | - $table->addIndex( array( 'siteid', 'code' ), 'idx_ezpprty_sid_code' ); |
|
146 | + $table->setPrimaryKey(array('id'), 'pk_ezpprty_id'); |
|
147 | + $table->addUniqueIndex(array('siteid', 'domain', 'code'), 'unq_ezpprty_sid_dom_code'); |
|
148 | + $table->addIndex(array('siteid', 'status', 'pos'), 'idx_ezpprty_sid_status_pos'); |
|
149 | + $table->addIndex(array('siteid', 'label'), 'idx_ezpprty_sid_label'); |
|
150 | + $table->addIndex(array('siteid', 'code'), 'idx_ezpprty_sid_code'); |
|
151 | 151 | |
152 | 152 | return $schema; |
153 | 153 | }, |
154 | 154 | |
155 | - 'ezuser_property' => function ( \Doctrine\DBAL\Schema\Schema $schema ) { |
|
155 | + 'ezuser_property' => function(\Doctrine\DBAL\Schema\Schema $schema) { |
|
156 | 156 | |
157 | - $table = $schema->createTable( 'ezuser_property' ); |
|
157 | + $table = $schema->createTable('ezuser_property'); |
|
158 | 158 | |
159 | - $table->addColumn( 'id', 'integer', array( 'autoincrement' => true ) ); |
|
160 | - $table->addColumn( 'siteid', 'integer', [] ); |
|
161 | - $table->addColumn( 'parentid', 'integer', [] ); |
|
162 | - $table->addColumn( 'typeid', 'integer', [] ); |
|
163 | - $table->addColumn( 'langid', 'string', array( 'length' => 5, 'notnull' => false ) ); |
|
164 | - $table->addColumn( 'value', 'string', array( 'length' => 255 ) ); |
|
165 | - $table->addColumn( 'mtime', 'datetime', [] ); |
|
166 | - $table->addColumn( 'ctime', 'datetime', [] ); |
|
167 | - $table->addColumn( 'editor', 'string', array( 'length' => 255 ) ); |
|
159 | + $table->addColumn('id', 'integer', array('autoincrement' => true)); |
|
160 | + $table->addColumn('siteid', 'integer', []); |
|
161 | + $table->addColumn('parentid', 'integer', []); |
|
162 | + $table->addColumn('typeid', 'integer', []); |
|
163 | + $table->addColumn('langid', 'string', array('length' => 5, 'notnull' => false)); |
|
164 | + $table->addColumn('value', 'string', array('length' => 255)); |
|
165 | + $table->addColumn('mtime', 'datetime', []); |
|
166 | + $table->addColumn('ctime', 'datetime', []); |
|
167 | + $table->addColumn('editor', 'string', array('length' => 255)); |
|
168 | 168 | |
169 | - $table->setPrimaryKey( array( 'id' ), 'pk_ezppr_id' ); |
|
170 | - $table->addUniqueIndex( array( 'parentid', 'siteid', 'typeid', 'langid', 'value' ), 'unq_ezppr_sid_tid_lid_value' ); |
|
171 | - $table->addIndex( array( 'siteid', 'langid' ), 'idx_ezppr_sid_langid' ); |
|
172 | - $table->addIndex( array( 'siteid', 'value' ), 'idx_ezppr_sid_value' ); |
|
173 | - $table->addIndex( array( 'typeid' ), 'fk_ezppr_typeid' ); |
|
174 | - $table->addIndex( array( 'parentid' ), 'fk_ezppr_pid' ); |
|
169 | + $table->setPrimaryKey(array('id'), 'pk_ezppr_id'); |
|
170 | + $table->addUniqueIndex(array('parentid', 'siteid', 'typeid', 'langid', 'value'), 'unq_ezppr_sid_tid_lid_value'); |
|
171 | + $table->addIndex(array('siteid', 'langid'), 'idx_ezppr_sid_langid'); |
|
172 | + $table->addIndex(array('siteid', 'value'), 'idx_ezppr_sid_value'); |
|
173 | + $table->addIndex(array('typeid'), 'fk_ezppr_typeid'); |
|
174 | + $table->addIndex(array('parentid'), 'fk_ezppr_pid'); |
|
175 | 175 | |
176 | - $table->addForeignKeyConstraint( 'ezuser', array( 'parentid' ), array( 'contentobject_id' ), |
|
177 | - array( 'onUpdate' => 'CASCADE', 'onDelete' => 'CASCADE' ), 'fk_ezppr_pid' ); |
|
176 | + $table->addForeignKeyConstraint('ezuser', array('parentid'), array('contentobject_id'), |
|
177 | + array('onUpdate' => 'CASCADE', 'onDelete' => 'CASCADE'), 'fk_ezppr_pid'); |
|
178 | 178 | |
179 | - $table->addForeignKeyConstraint( 'ezuser_property_type', array( 'typeid' ), array( 'id' ), |
|
180 | - array( 'onUpdate' => 'CASCADE', 'onDelete' => 'CASCADE' ), 'fk_ezppr_typeid' ); |
|
179 | + $table->addForeignKeyConstraint('ezuser_property_type', array('typeid'), array('id'), |
|
180 | + array('onUpdate' => 'CASCADE', 'onDelete' => 'CASCADE'), 'fk_ezppr_typeid'); |
|
181 | 181 | |
182 | 182 | return $schema; |
183 | 183 | }, |
@@ -226,11 +226,11 @@ discard block |
||
226 | 226 | * |
227 | 227 | * @param array $siteids List of IDs for sites whose entries should be deleted |
228 | 228 | */ |
229 | - public function cleanup( array $siteids ) |
|
229 | + public function cleanup(array $siteids) |
|
230 | 230 | { |
231 | 231 | $path = 'mshop/customer/manager/submanagers'; |
232 | - foreach( $this->getContext()->getConfig()->get( $path, ['address', 'group', 'lists', 'property'] ) as $domain ) { |
|
233 | - $this->getObject()->getSubManager( $domain )->cleanup( $siteids ); |
|
232 | + foreach ($this->getContext()->getConfig()->get($path, ['address', 'group', 'lists', 'property']) as $domain) { |
|
233 | + $this->getObject()->getSubManager($domain)->cleanup($siteids); |
|
234 | 234 | } |
235 | 235 | } |
236 | 236 | |
@@ -240,12 +240,12 @@ discard block |
||
240 | 240 | * |
241 | 241 | * @param array $ids List of IDs |
242 | 242 | */ |
243 | - public function deleteItems( array $ids ) |
|
243 | + public function deleteItems(array $ids) |
|
244 | 244 | { |
245 | 245 | $service = $this->getContext()->getEzUserService(); |
246 | 246 | |
247 | - foreach( $ids as $id ) { |
|
248 | - $service->deleteUser( $service->loadUser( $id ) ); |
|
247 | + foreach ($ids as $id) { |
|
248 | + $service->deleteUser($service->loadUser($id)); |
|
249 | 249 | } |
250 | 250 | } |
251 | 251 | |
@@ -256,11 +256,11 @@ discard block |
||
256 | 256 | * @param boolean $withsub Return also attributes of sub-managers if true |
257 | 257 | * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
258 | 258 | */ |
259 | - public function getSearchAttributes( $withsub = true ) |
|
259 | + public function getSearchAttributes($withsub = true) |
|
260 | 260 | { |
261 | 261 | $path = 'mshop/customer/manager/submanagers'; |
262 | 262 | |
263 | - return $this->getSearchAttributesBase( $this->searchConfig, $path, ['address', 'group', 'lists', 'property'], $withsub ); |
|
263 | + return $this->getSearchAttributesBase($this->searchConfig, $path, ['address', 'group', 'lists', 'property'], $withsub); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | |
@@ -271,9 +271,9 @@ discard block |
||
271 | 271 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
272 | 272 | * @return mixed Manager for different extensions, e.g stock, tags, locations, etc. |
273 | 273 | */ |
274 | - public function getSubManager( $manager, $name = null ) |
|
274 | + public function getSubManager($manager, $name = null) |
|
275 | 275 | { |
276 | - return $this->getSubManagerBase( 'customer', $manager, ( $name === null ? 'Ezpublish' : $name ) ); |
|
276 | + return $this->getSubManagerBase('customer', $manager, ($name === null ? 'Ezpublish' : $name)); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | |
@@ -284,96 +284,96 @@ discard block |
||
284 | 284 | * @param boolean $fetch True if the new ID should be returned in the item |
285 | 285 | * @return \Aimeos\MShop\Common\Item\Iface $item Updated item including the generated ID |
286 | 286 | */ |
287 | - public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true ) |
|
287 | + public function saveItem(\Aimeos\MShop\Common\Item\Iface $item, $fetch = true) |
|
288 | 288 | { |
289 | - self::checkClass( '\\Aimeos\\MShop\\Customer\\Item\\Iface', $item ); |
|
289 | + self::checkClass('\\Aimeos\\MShop\\Customer\\Item\\Iface', $item); |
|
290 | 290 | |
291 | - if( !$item->isModified() ) |
|
291 | + if (!$item->isModified()) |
|
292 | 292 | { |
293 | - $item = $this->savePropertyItems( $item, 'customer' ); |
|
294 | - $item = $this->saveAddressItems( $item, 'customer' ); |
|
295 | - return $this->saveListItems( $item, 'customer' ); |
|
293 | + $item = $this->savePropertyItems($item, 'customer'); |
|
294 | + $item = $this->saveAddressItems($item, 'customer'); |
|
295 | + return $this->saveListItems($item, 'customer'); |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | $context = $this->getContext(); |
299 | 299 | |
300 | 300 | $class = '\Aimeos\MShop\Context\Item\Ezpublish'; |
301 | - if( !is_a( $context, $class ) ) { |
|
302 | - throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Object is not of required type "%1$s"', $class ) ); |
|
301 | + if (!is_a($context, $class)) { |
|
302 | + throw new \Aimeos\MShop\Customer\Exception(sprintf('Object is not of required type "%1$s"', $class)); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | $service = $context->getEzUserService(); |
306 | 306 | $email = $item->getPaymentAddress()->getEmail(); |
307 | 307 | |
308 | - if( $item->getId() !== null ) |
|
308 | + if ($item->getId() !== null) |
|
309 | 309 | { |
310 | 310 | $struct = $service->newUserUpdateStruct(); |
311 | 311 | $struct->password = $item->getPassword(); |
312 | 312 | $struct->enabled = $item->getStatus(); |
313 | 313 | $struct->email = $email; |
314 | 314 | |
315 | - $user = $service->loadUser( $item->getId() ); |
|
316 | - $service->updateUser( $user, $struct ); |
|
315 | + $user = $service->loadUser($item->getId()); |
|
316 | + $service->updateUser($user, $struct); |
|
317 | 317 | } |
318 | 318 | else |
319 | 319 | { |
320 | - $struct = $service->newUserCreateStruct( $item->getCode(), $email, $item->getPassword(), 'eng-GB' ); |
|
320 | + $struct = $service->newUserCreateStruct($item->getCode(), $email, $item->getPassword(), 'eng-GB'); |
|
321 | 321 | $struct->enabled = $item->getStatus(); |
322 | 322 | |
323 | - $user = $service->createUser( $struct, [] ); |
|
324 | - $item->setId( $user->getUserId() ); |
|
323 | + $user = $service->createUser($struct, []); |
|
324 | + $item->setId($user->getUserId()); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | $dbm = $context->getDatabaseManager(); |
328 | 328 | $dbname = $this->getResourceName(); |
329 | - $conn = $dbm->acquire( $dbname ); |
|
329 | + $conn = $dbm->acquire($dbname); |
|
330 | 330 | |
331 | 331 | try |
332 | 332 | { |
333 | - $date = date( 'Y-m-d H:i:s' ); |
|
334 | - $ctime = ( $item->getTimeCreated() ? $item->getTimeCreated() : $date ); |
|
333 | + $date = date('Y-m-d H:i:s'); |
|
334 | + $ctime = ($item->getTimeCreated() ? $item->getTimeCreated() : $date); |
|
335 | 335 | $billingAddress = $item->getPaymentAddress(); |
336 | 336 | |
337 | 337 | $path = 'mshop/customer/manager/ezpublish/update'; |
338 | - $stmt = $this->getCachedStatement( $conn, $path ); |
|
339 | - |
|
340 | - $stmt->bind( 1, $billingAddress->getCompany() ); |
|
341 | - $stmt->bind( 2, $billingAddress->getVatID() ); |
|
342 | - $stmt->bind( 3, $billingAddress->getSalutation() ); |
|
343 | - $stmt->bind( 4, $billingAddress->getTitle() ); |
|
344 | - $stmt->bind( 5, $billingAddress->getFirstname() ); |
|
345 | - $stmt->bind( 6, $billingAddress->getLastname() ); |
|
346 | - $stmt->bind( 7, $billingAddress->getAddress1() ); |
|
347 | - $stmt->bind( 8, $billingAddress->getAddress2() ); |
|
348 | - $stmt->bind( 9, $billingAddress->getAddress3() ); |
|
349 | - $stmt->bind( 10, $billingAddress->getPostal() ); |
|
350 | - $stmt->bind( 11, $billingAddress->getCity() ); |
|
351 | - $stmt->bind( 12, $billingAddress->getState() ); |
|
352 | - $stmt->bind( 13, $billingAddress->getCountryId() ); |
|
353 | - $stmt->bind( 14, $billingAddress->getLanguageId() ); |
|
354 | - $stmt->bind( 15, $billingAddress->getTelephone() ); |
|
355 | - $stmt->bind( 16, $billingAddress->getTelefax() ); |
|
356 | - $stmt->bind( 17, $billingAddress->getWebsite() ); |
|
357 | - $stmt->bind( 18, $item->getBirthday() ); |
|
358 | - $stmt->bind( 19, $item->getDateVerified() ); |
|
359 | - $stmt->bind( 20, $date ); // Modification time |
|
360 | - $stmt->bind( 21, $context->getEditor() ); |
|
361 | - $stmt->bind( 22, $ctime ); // Creation time |
|
362 | - $stmt->bind( 23, $item->getId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
338 | + $stmt = $this->getCachedStatement($conn, $path); |
|
339 | + |
|
340 | + $stmt->bind(1, $billingAddress->getCompany()); |
|
341 | + $stmt->bind(2, $billingAddress->getVatID()); |
|
342 | + $stmt->bind(3, $billingAddress->getSalutation()); |
|
343 | + $stmt->bind(4, $billingAddress->getTitle()); |
|
344 | + $stmt->bind(5, $billingAddress->getFirstname()); |
|
345 | + $stmt->bind(6, $billingAddress->getLastname()); |
|
346 | + $stmt->bind(7, $billingAddress->getAddress1()); |
|
347 | + $stmt->bind(8, $billingAddress->getAddress2()); |
|
348 | + $stmt->bind(9, $billingAddress->getAddress3()); |
|
349 | + $stmt->bind(10, $billingAddress->getPostal()); |
|
350 | + $stmt->bind(11, $billingAddress->getCity()); |
|
351 | + $stmt->bind(12, $billingAddress->getState()); |
|
352 | + $stmt->bind(13, $billingAddress->getCountryId()); |
|
353 | + $stmt->bind(14, $billingAddress->getLanguageId()); |
|
354 | + $stmt->bind(15, $billingAddress->getTelephone()); |
|
355 | + $stmt->bind(16, $billingAddress->getTelefax()); |
|
356 | + $stmt->bind(17, $billingAddress->getWebsite()); |
|
357 | + $stmt->bind(18, $item->getBirthday()); |
|
358 | + $stmt->bind(19, $item->getDateVerified()); |
|
359 | + $stmt->bind(20, $date); // Modification time |
|
360 | + $stmt->bind(21, $context->getEditor()); |
|
361 | + $stmt->bind(22, $ctime); // Creation time |
|
362 | + $stmt->bind(23, $item->getId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
363 | 363 | |
364 | 364 | $stmt->execute()->finish(); |
365 | 365 | |
366 | - $dbm->release( $conn, $dbname ); |
|
366 | + $dbm->release($conn, $dbname); |
|
367 | 367 | } |
368 | - catch( \Exception $e ) |
|
368 | + catch (\Exception $e) |
|
369 | 369 | { |
370 | - $dbm->release( $conn, $dbname ); |
|
370 | + $dbm->release($conn, $dbname); |
|
371 | 371 | throw $e; |
372 | 372 | } |
373 | 373 | |
374 | - $item = $this->savePropertyItems( $item, 'customer' ); |
|
375 | - $item = $this->saveAddressItems( $item, 'customer' ); |
|
376 | - return $this->saveListItems( $item, 'customer' ); |
|
374 | + $item = $this->savePropertyItems($item, 'customer'); |
|
375 | + $item = $this->saveAddressItems($item, 'customer'); |
|
376 | + return $this->saveListItems($item, 'customer'); |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | |
@@ -385,11 +385,11 @@ discard block |
||
385 | 385 | * @return array List of items implementing \Aimeos\MShop\Customer\Item\Iface |
386 | 386 | * @throws \Aimeos\MShop\Customer\Exception If creating items failed |
387 | 387 | */ |
388 | - public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null ) |
|
388 | + public function searchItems(\Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null) |
|
389 | 389 | { |
390 | 390 | $dbm = $this->getContext()->getDatabaseManager(); |
391 | 391 | $dbname = $this->getResourceName(); |
392 | - $conn = $dbm->acquire( $dbname ); |
|
392 | + $conn = $dbm->acquire($dbname); |
|
393 | 393 | $map = []; |
394 | 394 | |
395 | 395 | try |
@@ -397,34 +397,34 @@ discard block |
||
397 | 397 | $level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL; |
398 | 398 | $cfgPathSearch = 'mshop/customer/manager/ezpublish/search'; |
399 | 399 | $cfgPathCount = 'mshop/customer/manager/ezpublish/count'; |
400 | - $required = array( 'customer' ); |
|
400 | + $required = array('customer'); |
|
401 | 401 | |
402 | - $results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level ); |
|
402 | + $results = $this->searchItemsBase($conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level); |
|
403 | 403 | |
404 | - while( ( $row = $results->fetch() ) !== false ) |
|
404 | + while (($row = $results->fetch()) !== false) |
|
405 | 405 | { |
406 | - $map[ $row['customer.id'] ] = $row; |
|
407 | - $map[ $row['customer.id'] ]['groups'] = []; |
|
406 | + $map[$row['customer.id']] = $row; |
|
407 | + $map[$row['customer.id']]['groups'] = []; |
|
408 | 408 | } |
409 | 409 | |
410 | 410 | |
411 | 411 | $path = 'mshop/customer/manager/ezpublish/groups'; |
412 | - $stmt = $conn->create( $this->getGroupSql( array_keys( $map ), $path ) ); |
|
412 | + $stmt = $conn->create($this->getGroupSql(array_keys($map), $path)); |
|
413 | 413 | $results = $stmt->execute(); |
414 | 414 | |
415 | - while( ( $row = $results->fetch() ) !== false ) { |
|
416 | - $map[ $row['contentobject_id'] ]['groups'][] = $row['role_id']; |
|
415 | + while (($row = $results->fetch()) !== false) { |
|
416 | + $map[$row['contentobject_id']]['groups'][] = $row['role_id']; |
|
417 | 417 | } |
418 | 418 | |
419 | - $dbm->release( $conn, $dbname ); |
|
419 | + $dbm->release($conn, $dbname); |
|
420 | 420 | } |
421 | - catch( \Exception $e ) |
|
421 | + catch (\Exception $e) |
|
422 | 422 | { |
423 | - $dbm->release( $conn, $dbname ); |
|
423 | + $dbm->release($conn, $dbname); |
|
424 | 424 | throw $e; |
425 | 425 | } |
426 | 426 | |
427 | - return $this->buildItems( $map, $ref, 'customer' ); |
|
427 | + return $this->buildItems($map, $ref, 'customer'); |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | |
@@ -437,10 +437,10 @@ discard block |
||
437 | 437 | * @param array $addresses List of address items of the customer item |
438 | 438 | * @return \Aimeos\MShop\Customer\Item\Iface New customer item |
439 | 439 | */ |
440 | - protected function createItemBase( array $values = [], array $listItems = [], array $refItems = [], |
|
441 | - array $addresses = [], array $propItems = [] ) |
|
440 | + protected function createItemBase(array $values = [], array $listItems = [], array $refItems = [], |
|
441 | + array $addresses = [], array $propItems = []) |
|
442 | 442 | { |
443 | - $address = new \Aimeos\MShop\Common\Item\Address\Simple( 'customer.', $values ); |
|
443 | + $address = new \Aimeos\MShop\Common\Item\Address\Simple('customer.', $values); |
|
444 | 444 | |
445 | 445 | return new \Aimeos\MShop\Customer\Item\Ezpublish( |
446 | 446 | $address, $values, $listItems, $refItems, |
@@ -456,18 +456,18 @@ discard block |
||
456 | 456 | * @param string $cfgpath Configuration path to the SQL statement |
457 | 457 | * @return string SQL statement ready for execution |
458 | 458 | */ |
459 | - protected function getGroupSql( array $ids, $cfgpath ) |
|
459 | + protected function getGroupSql(array $ids, $cfgpath) |
|
460 | 460 | { |
461 | - if( empty( $ids ) ) { return '1=1'; } |
|
461 | + if (empty($ids)) { return '1=1'; } |
|
462 | 462 | |
463 | 463 | $search = $this->getObject()->createSearch(); |
464 | - $search->setConditions( $search->compare( '==', 'id', $ids ) ); |
|
464 | + $search->setConditions($search->compare('==', 'id', $ids)); |
|
465 | 465 | |
466 | - $types = array( 'id' => \Aimeos\MW\DB\Statement\Base::PARAM_INT ); |
|
467 | - $translations = array( 'id' => '"contentobject_id"' ); |
|
466 | + $types = array('id' => \Aimeos\MW\DB\Statement\Base::PARAM_INT); |
|
467 | + $translations = array('id' => '"contentobject_id"'); |
|
468 | 468 | |
469 | - $cond = $search->getConditionSource( $types, $translations ); |
|
469 | + $cond = $search->getConditionSource($types, $translations); |
|
470 | 470 | |
471 | - return str_replace( ':cond', $cond, $this->getSqlConfig( $cfgpath ) ); |
|
471 | + return str_replace(':cond', $cond, $this->getSqlConfig($cfgpath)); |
|
472 | 472 | } |
473 | 473 | } |
@@ -16,57 +16,57 @@ |
||
16 | 16 | |
17 | 17 | protected function setUp() |
18 | 18 | { |
19 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( \TestHelper::getContext(), 'Ezpublish' ); |
|
20 | - $this->object = $manager->getSubManager( 'lists', 'Ezpublish' ); |
|
19 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager(\TestHelper::getContext(), 'Ezpublish'); |
|
20 | + $this->object = $manager->getSubManager('lists', 'Ezpublish'); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
24 | 24 | protected function tearDown() |
25 | 25 | { |
26 | - unset( $this->object ); |
|
26 | + unset($this->object); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | |
30 | 30 | public function testCleanup() |
31 | 31 | { |
32 | - $this->object->cleanup( array( -1 ) ); |
|
32 | + $this->object->cleanup(array( -1 )); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
36 | 36 | public function testGetSearchAttributes() |
37 | 37 | { |
38 | 38 | $attributes = $this->object->getSearchAttributes(); |
39 | - $this->assertGreaterThan( 0, count( $attributes ) ); |
|
39 | + $this->assertGreaterThan(0, count($attributes)); |
|
40 | 40 | |
41 | - foreach( $attributes as $attribute ) { |
|
42 | - $this->assertInstanceOf( \Aimeos\MW\Criteria\Attribute\Iface::class, $attribute ); |
|
41 | + foreach ($attributes as $attribute) { |
|
42 | + $this->assertInstanceOf(\Aimeos\MW\Criteria\Attribute\Iface::class, $attribute); |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | |
46 | 46 | |
47 | 47 | public function testGetSubManager() |
48 | 48 | { |
49 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type') ); |
|
50 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type', 'Standard') ); |
|
49 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type')); |
|
50 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type', 'Standard')); |
|
51 | 51 | |
52 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
53 | - $this->object->getSubManager( 'unknown' ); |
|
52 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
53 | + $this->object->getSubManager('unknown'); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
57 | 57 | public function testSaveItemInvalidItem() |
58 | 58 | { |
59 | - $this->setExpectedException( \Aimeos\MW\Common\Exception::class ); |
|
60 | - $this->object->saveItem( new \Aimeos\MShop\Common\Item\Type\Standard( 'common.lists.type.' ) ); |
|
59 | + $this->setExpectedException(\Aimeos\MW\Common\Exception::class); |
|
60 | + $this->object->saveItem(new \Aimeos\MShop\Common\Item\Type\Standard('common.lists.type.')); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
64 | 64 | public function testSaveItemInvalidDomain() |
65 | 65 | { |
66 | 66 | $item = $this->object->createItem(); |
67 | - $item->setDomain( 'customer/group' ); |
|
67 | + $item->setDomain('customer/group'); |
|
68 | 68 | |
69 | - $this->setExpectedException( \Aimeos\MShop\Customer\Exception::class ); |
|
70 | - $this->object->saveItem( $item ); |
|
69 | + $this->setExpectedException(\Aimeos\MShop\Customer\Exception::class); |
|
70 | + $this->object->saveItem($item); |
|
71 | 71 | } |
72 | 72 | } |
@@ -16,39 +16,39 @@ |
||
16 | 16 | |
17 | 17 | protected function setUp() |
18 | 18 | { |
19 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( \TestHelper::getContext(), 'Ezpublish' ); |
|
19 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager(\TestHelper::getContext(), 'Ezpublish'); |
|
20 | 20 | |
21 | - $listManager = $manager->getSubManager( 'lists', 'Ezpublish' ); |
|
22 | - $this->object = $listManager->getSubManager( 'type', 'Ezpublish' ); |
|
21 | + $listManager = $manager->getSubManager('lists', 'Ezpublish'); |
|
22 | + $this->object = $listManager->getSubManager('type', 'Ezpublish'); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | |
26 | 26 | protected function tearDown() |
27 | 27 | { |
28 | - unset( $this->object ); |
|
28 | + unset($this->object); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | |
32 | 32 | public function testCleanup() |
33 | 33 | { |
34 | - $this->object->cleanup( array( -1 ) ); |
|
34 | + $this->object->cleanup(array( -1 )); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
38 | 38 | public function testGetSearchAttributes() |
39 | 39 | { |
40 | 40 | $attributes = $this->object->getSearchAttributes(); |
41 | - $this->assertGreaterThan( 0, count( $attributes ) ); |
|
41 | + $this->assertGreaterThan(0, count($attributes)); |
|
42 | 42 | |
43 | - foreach( $attributes as $attribute ) { |
|
44 | - $this->assertInstanceOf( \Aimeos\MW\Criteria\Attribute\Iface::class, $attribute ); |
|
43 | + foreach ($attributes as $attribute) { |
|
44 | + $this->assertInstanceOf(\Aimeos\MW\Criteria\Attribute\Iface::class, $attribute); |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
48 | 48 | |
49 | 49 | public function testGetSubManager() |
50 | 50 | { |
51 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
52 | - $this->object->getSubManager( 'unknown' ); |
|
51 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
52 | + $this->object->getSubManager('unknown'); |
|
53 | 53 | } |
54 | 54 | } |
@@ -16,47 +16,47 @@ |
||
16 | 16 | |
17 | 17 | protected function setUp() |
18 | 18 | { |
19 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( \TestHelper::getContext(), 'Ezpublish' ); |
|
20 | - $this->object = $manager->getSubManager( 'property', 'Ezpublish' ); |
|
19 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager(\TestHelper::getContext(), 'Ezpublish'); |
|
20 | + $this->object = $manager->getSubManager('property', 'Ezpublish'); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
24 | 24 | protected function tearDown() |
25 | 25 | { |
26 | - unset( $this->object ); |
|
26 | + unset($this->object); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | |
30 | 30 | public function testCleanup() |
31 | 31 | { |
32 | - $this->object->cleanup( array( -1 ) ); |
|
32 | + $this->object->cleanup(array( -1 )); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
36 | 36 | public function testGetSearchAttributes() |
37 | 37 | { |
38 | 38 | $attributes = $this->object->getSearchAttributes(); |
39 | - $this->assertGreaterThan( 0, count( $attributes ) ); |
|
39 | + $this->assertGreaterThan(0, count($attributes)); |
|
40 | 40 | |
41 | - foreach( $attributes as $attribute ) { |
|
42 | - $this->assertInstanceOf( \Aimeos\MW\Criteria\Attribute\Iface::class, $attribute ); |
|
41 | + foreach ($attributes as $attribute) { |
|
42 | + $this->assertInstanceOf(\Aimeos\MW\Criteria\Attribute\Iface::class, $attribute); |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | |
46 | 46 | |
47 | 47 | public function testGetSubManager() |
48 | 48 | { |
49 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type') ); |
|
50 | - $this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type', 'Standard') ); |
|
49 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type')); |
|
50 | + $this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('type', 'Standard')); |
|
51 | 51 | |
52 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
53 | - $this->object->getSubManager( 'unknown' ); |
|
52 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
53 | + $this->object->getSubManager('unknown'); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
57 | 57 | public function testSaveItemInvalidItem() |
58 | 58 | { |
59 | - $this->setExpectedException( \Aimeos\MW\Common\Exception::class ); |
|
60 | - $this->object->saveItem( new \Aimeos\MShop\Common\Item\Type\Standard( 'common.property.type.' ) ); |
|
59 | + $this->setExpectedException(\Aimeos\MW\Common\Exception::class); |
|
60 | + $this->object->saveItem(new \Aimeos\MShop\Common\Item\Type\Standard('common.property.type.')); |
|
61 | 61 | } |
62 | 62 | } |
@@ -16,39 +16,39 @@ |
||
16 | 16 | |
17 | 17 | protected function setUp() |
18 | 18 | { |
19 | - $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager( \TestHelper::getContext(), 'Ezpublish' ); |
|
19 | + $manager = \Aimeos\MShop\Customer\Manager\Factory::createManager(\TestHelper::getContext(), 'Ezpublish'); |
|
20 | 20 | |
21 | - $listManager = $manager->getSubManager( 'property', 'Ezpublish' ); |
|
22 | - $this->object = $listManager->getSubManager( 'type', 'Ezpublish' ); |
|
21 | + $listManager = $manager->getSubManager('property', 'Ezpublish'); |
|
22 | + $this->object = $listManager->getSubManager('type', 'Ezpublish'); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | |
26 | 26 | protected function tearDown() |
27 | 27 | { |
28 | - unset( $this->object ); |
|
28 | + unset($this->object); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | |
32 | 32 | public function testCleanup() |
33 | 33 | { |
34 | - $this->object->cleanup( array( -1 ) ); |
|
34 | + $this->object->cleanup(array( -1 )); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
38 | 38 | public function testGetSearchAttributes() |
39 | 39 | { |
40 | 40 | $attributes = $this->object->getSearchAttributes(); |
41 | - $this->assertGreaterThan( 0, count( $attributes ) ); |
|
41 | + $this->assertGreaterThan(0, count($attributes)); |
|
42 | 42 | |
43 | - foreach( $attributes as $attribute ) { |
|
44 | - $this->assertInstanceOf( \Aimeos\MW\Criteria\Attribute\Iface::class, $attribute ); |
|
43 | + foreach ($attributes as $attribute) { |
|
44 | + $this->assertInstanceOf(\Aimeos\MW\Criteria\Attribute\Iface::class, $attribute); |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
48 | 48 | |
49 | 49 | public function testGetSubManager() |
50 | 50 | { |
51 | - $this->setExpectedException( '\\Aimeos\\MShop\\Exception' ); |
|
52 | - $this->object->getSubManager( 'unknown' ); |
|
51 | + $this->setExpectedException('\\Aimeos\\MShop\\Exception'); |
|
52 | + $this->object->getSubManager('unknown'); |
|
53 | 53 | } |
54 | 54 | } |
@@ -18,206 +18,206 @@ |
||
18 | 18 | |
19 | 19 | protected function setUp() |
20 | 20 | { |
21 | - if( !interface_exists( 'eZ\Publish\API\Repository\UserService' ) ) { |
|
22 | - $this->markTestSkipped( 'Install ezsystems/ezpublish-api first' ); |
|
21 | + if (!interface_exists('eZ\Publish\API\Repository\UserService')) { |
|
22 | + $this->markTestSkipped('Install ezsystems/ezpublish-api first'); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | $this->context = \TestHelper::getContext(); |
26 | 26 | |
27 | - $this->object = new \Aimeos\MShop\Customer\Manager\Ezpublish( $this->context ); |
|
28 | - $this->address = new \Aimeos\MShop\Common\Item\Address\Standard( 'common.address.' ); |
|
27 | + $this->object = new \Aimeos\MShop\Customer\Manager\Ezpublish($this->context); |
|
28 | + $this->address = new \Aimeos\MShop\Common\Item\Address\Standard('common.address.'); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | |
32 | 32 | protected function tearDown() |
33 | 33 | { |
34 | - unset( $this->object, $this->context, $this->address ); |
|
34 | + unset($this->object, $this->context, $this->address); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
38 | 38 | public function testCleanup() |
39 | 39 | { |
40 | - $this->object->cleanup( array( -1 ) ); |
|
40 | + $this->object->cleanup(array( -1 )); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
44 | 44 | public function testCreateItem() |
45 | 45 | { |
46 | - $this->assertInstanceOf( 'Aimeos\MShop\Customer\Item\Iface', $this->object->createItem() ); |
|
46 | + $this->assertInstanceOf('Aimeos\MShop\Customer\Item\Iface', $this->object->createItem()); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
50 | 50 | public function testDeleteItems() |
51 | 51 | { |
52 | - $mock = $this->getMockBuilder( 'eZ\Publish\API\Repository\UserService' )->getMock(); |
|
53 | - $user = $this->getMockBuilder( 'eZ\Publish\API\Repository\Values\User\User' )->getMock(); |
|
52 | + $mock = $this->getMockBuilder('eZ\Publish\API\Repository\UserService')->getMock(); |
|
53 | + $user = $this->getMockBuilder('eZ\Publish\API\Repository\Values\User\User')->getMock(); |
|
54 | 54 | |
55 | - $mock->expects( $this->once() )->method( 'loadUser' )->will( $this->returnValue( $user ) ); |
|
56 | - $mock->expects( $this->once() )->method( 'deleteUser' ); |
|
55 | + $mock->expects($this->once())->method('loadUser')->will($this->returnValue($user)); |
|
56 | + $mock->expects($this->once())->method('deleteUser'); |
|
57 | 57 | |
58 | - $this->context->setEzUserService( $mock ); |
|
59 | - $this->object->deleteItems( array( -1 ) ); |
|
58 | + $this->context->setEzUserService($mock); |
|
59 | + $this->object->deleteItems(array( -1 )); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | |
63 | 63 | public function testGetSearchAttributes() |
64 | 64 | { |
65 | 65 | $attributes = $this->object->getSearchAttributes(); |
66 | - $this->assertGreaterThan( 0, count( $attributes ) ); |
|
66 | + $this->assertGreaterThan(0, count($attributes)); |
|
67 | 67 | |
68 | - foreach( $attributes as $attribute ) { |
|
69 | - $this->assertInstanceOf( \Aimeos\MW\Criteria\Attribute\Iface::class, $attribute ); |
|
68 | + foreach ($attributes as $attribute) { |
|
69 | + $this->assertInstanceOf(\Aimeos\MW\Criteria\Attribute\Iface::class, $attribute); |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
73 | 73 | |
74 | 74 | public function testGetSubManager() |
75 | 75 | { |
76 | - $this->assertInstanceOf( \Aimeos\MShop\Common\Manager\Iface::class, $this->object->getSubManager( 'address' ) ); |
|
77 | - $this->assertInstanceOf( \Aimeos\MShop\Common\Manager\Iface::class, $this->object->getSubManager( 'address', 'Standard' ) ); |
|
76 | + $this->assertInstanceOf(\Aimeos\MShop\Common\Manager\Iface::class, $this->object->getSubManager('address')); |
|
77 | + $this->assertInstanceOf(\Aimeos\MShop\Common\Manager\Iface::class, $this->object->getSubManager('address', 'Standard')); |
|
78 | 78 | |
79 | - $this->setExpectedException( \Aimeos\MShop\Exception::class ); |
|
80 | - $this->object->getSubManager( 'unknown' ); |
|
79 | + $this->setExpectedException(\Aimeos\MShop\Exception::class); |
|
80 | + $this->object->getSubManager('unknown'); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
84 | 84 | public function testGetSubManagerInvalidName() |
85 | 85 | { |
86 | - $this->setExpectedException( \Aimeos\MShop\Exception::class ); |
|
87 | - $this->object->getSubManager( 'address', 'unknown' ); |
|
86 | + $this->setExpectedException(\Aimeos\MShop\Exception::class); |
|
87 | + $this->object->getSubManager('address', 'unknown'); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | |
91 | 91 | public function testSaveItemInsert() |
92 | 92 | { |
93 | - $service = $this->getMockBuilder( 'eZ\Publish\API\Repository\UserService' )->getMock(); |
|
94 | - $struct = $this->getMockBuilder( 'eZ\Publish\API\Repository\Values\User\UserCreateStruct' )->getMock(); |
|
95 | - $user = $this->getMockBuilder( \eZ\Publish\API\Repository\Values\User\User::class ) |
|
96 | - ->setMethods( array( 'getUserId', 'getVersionInfo', 'getFieldValue', 'getFields', 'getFieldsByLanguage' ) ) |
|
93 | + $service = $this->getMockBuilder('eZ\Publish\API\Repository\UserService')->getMock(); |
|
94 | + $struct = $this->getMockBuilder('eZ\Publish\API\Repository\Values\User\UserCreateStruct')->getMock(); |
|
95 | + $user = $this->getMockBuilder(\eZ\Publish\API\Repository\Values\User\User::class) |
|
96 | + ->setMethods(array('getUserId', 'getVersionInfo', 'getFieldValue', 'getFields', 'getFieldsByLanguage')) |
|
97 | 97 | ->getMock(); |
98 | 98 | |
99 | - $dbm = $this->getMockBuilder( 'Aimeos\MW\DB\Manager\Iface' )->getMock(); |
|
100 | - $conn = $this->getMockBuilder( 'Aimeos\MW\DB\Connection\Iface' )->getMock(); |
|
101 | - $stmt = $this->getMockBuilder( 'Aimeos\MW\DB\Statement\Iface' )->getMock(); |
|
102 | - $result = $this->getMockBuilder( 'Aimeos\MW\DB\Result\Iface' )->getMock(); |
|
99 | + $dbm = $this->getMockBuilder('Aimeos\MW\DB\Manager\Iface')->getMock(); |
|
100 | + $conn = $this->getMockBuilder('Aimeos\MW\DB\Connection\Iface')->getMock(); |
|
101 | + $stmt = $this->getMockBuilder('Aimeos\MW\DB\Statement\Iface')->getMock(); |
|
102 | + $result = $this->getMockBuilder('Aimeos\MW\DB\Result\Iface')->getMock(); |
|
103 | 103 | |
104 | - $service->expects( $this->once() )->method( 'newUserCreateStruct' )->will( $this->returnValue( $struct ) ); |
|
105 | - $service->expects( $this->once() )->method( 'createUser' )->will( $this->returnValue( $user ) ); |
|
106 | - $user->expects( $this->once() )->method( 'getUserId' )->will( $this->returnValue( 1 ) ); |
|
107 | - $dbm->expects( $this->once() )->method( 'acquire' )->will( $this->returnValue( $conn ) ); |
|
108 | - $conn->expects( $this->once() )->method( 'create' )->will( $this->returnValue( $stmt ) ); |
|
109 | - $stmt->expects( $this->once() )->method( 'execute' )->will( $this->returnValue( $result ) ); |
|
104 | + $service->expects($this->once())->method('newUserCreateStruct')->will($this->returnValue($struct)); |
|
105 | + $service->expects($this->once())->method('createUser')->will($this->returnValue($user)); |
|
106 | + $user->expects($this->once())->method('getUserId')->will($this->returnValue(1)); |
|
107 | + $dbm->expects($this->once())->method('acquire')->will($this->returnValue($conn)); |
|
108 | + $conn->expects($this->once())->method('create')->will($this->returnValue($stmt)); |
|
109 | + $stmt->expects($this->once())->method('execute')->will($this->returnValue($result)); |
|
110 | 110 | |
111 | 111 | |
112 | - $this->context->setDatabaseManager( $dbm ); |
|
113 | - $this->context->setEzUserService( $service ); |
|
112 | + $this->context->setDatabaseManager($dbm); |
|
113 | + $this->context->setEzUserService($service); |
|
114 | 114 | |
115 | - $this->object->saveItem( new \Aimeos\MShop\Customer\Item\Standard( $this->address ) ); |
|
115 | + $this->object->saveItem(new \Aimeos\MShop\Customer\Item\Standard($this->address)); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | |
119 | 119 | public function testSaveItemUpdate() |
120 | 120 | { |
121 | - $service = $this->getMockBuilder( 'eZ\Publish\API\Repository\UserService' )->getMock(); |
|
122 | - $user = $this->getMockBuilder( 'eZ\Publish\API\Repository\Values\User\User' )->getMock(); |
|
123 | - $struct = $this->getMockBuilder( 'eZ\Publish\API\Repository\Values\User\UserUpdateStruct' )->getMock(); |
|
124 | - $dbm = $this->getMockBuilder( 'Aimeos\MW\DB\Manager\Iface' )->getMock(); |
|
125 | - $conn = $this->getMockBuilder( 'Aimeos\MW\DB\Connection\Iface' )->getMock(); |
|
126 | - $stmt = $this->getMockBuilder( 'Aimeos\MW\DB\Statement\Iface' )->getMock(); |
|
127 | - $result = $this->getMockBuilder( 'Aimeos\MW\DB\Result\Iface' )->getMock(); |
|
128 | - |
|
129 | - $service->expects( $this->once() )->method( 'updateUser' ); |
|
130 | - $service->expects( $this->once() )->method( 'loadUser' )->will( $this->returnValue( $user ) ); |
|
131 | - $service->expects( $this->once() )->method( 'newUserUpdateStruct' )->will( $this->returnValue( $struct ) ); |
|
132 | - $dbm->expects( $this->once() )->method( 'acquire' )->will( $this->returnValue( $conn ) ); |
|
133 | - $conn->expects( $this->once() )->method( 'create' )->will( $this->returnValue( $stmt ) ); |
|
134 | - $stmt->expects( $this->once() )->method( 'execute' )->will( $this->returnValue( $result ) ); |
|
135 | - $result->expects( $this->once() )->method( 'finish' ); |
|
136 | - $dbm->expects( $this->once() )->method( 'release' ); |
|
137 | - |
|
138 | - |
|
139 | - $item = new \Aimeos\MShop\Customer\Item\Standard( $this->address, array( 'customer.id' => 1 ) ); |
|
140 | - $item->setStatus( 1 ); |
|
141 | - |
|
142 | - $this->context->setDatabaseManager( $dbm ); |
|
143 | - $this->context->setEzUserService( $service ); |
|
144 | - $this->object->saveItem( $item ); |
|
121 | + $service = $this->getMockBuilder('eZ\Publish\API\Repository\UserService')->getMock(); |
|
122 | + $user = $this->getMockBuilder('eZ\Publish\API\Repository\Values\User\User')->getMock(); |
|
123 | + $struct = $this->getMockBuilder('eZ\Publish\API\Repository\Values\User\UserUpdateStruct')->getMock(); |
|
124 | + $dbm = $this->getMockBuilder('Aimeos\MW\DB\Manager\Iface')->getMock(); |
|
125 | + $conn = $this->getMockBuilder('Aimeos\MW\DB\Connection\Iface')->getMock(); |
|
126 | + $stmt = $this->getMockBuilder('Aimeos\MW\DB\Statement\Iface')->getMock(); |
|
127 | + $result = $this->getMockBuilder('Aimeos\MW\DB\Result\Iface')->getMock(); |
|
128 | + |
|
129 | + $service->expects($this->once())->method('updateUser'); |
|
130 | + $service->expects($this->once())->method('loadUser')->will($this->returnValue($user)); |
|
131 | + $service->expects($this->once())->method('newUserUpdateStruct')->will($this->returnValue($struct)); |
|
132 | + $dbm->expects($this->once())->method('acquire')->will($this->returnValue($conn)); |
|
133 | + $conn->expects($this->once())->method('create')->will($this->returnValue($stmt)); |
|
134 | + $stmt->expects($this->once())->method('execute')->will($this->returnValue($result)); |
|
135 | + $result->expects($this->once())->method('finish'); |
|
136 | + $dbm->expects($this->once())->method('release'); |
|
137 | + |
|
138 | + |
|
139 | + $item = new \Aimeos\MShop\Customer\Item\Standard($this->address, array('customer.id' => 1)); |
|
140 | + $item->setStatus(1); |
|
141 | + |
|
142 | + $this->context->setDatabaseManager($dbm); |
|
143 | + $this->context->setEzUserService($service); |
|
144 | + $this->object->saveItem($item); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | |
148 | 148 | public function testSaveItemInvalidItem() |
149 | 149 | { |
150 | - $this->setExpectedException( \Aimeos\MW\Common\Exception::class ); |
|
151 | - $this->object->saveItem( new \Aimeos\MShop\Common\Item\Lists\Standard( 'common.lists.' ) ); |
|
150 | + $this->setExpectedException(\Aimeos\MW\Common\Exception::class); |
|
151 | + $this->object->saveItem(new \Aimeos\MShop\Common\Item\Lists\Standard('common.lists.')); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | |
155 | 155 | public function testSaveItemNotModified() |
156 | 156 | { |
157 | - $item = new \Aimeos\MShop\Customer\Item\Standard( $this->address, array( 'customer.id' => 1 ) ); |
|
158 | - $this->object->saveItem( $item ); |
|
157 | + $item = new \Aimeos\MShop\Customer\Item\Standard($this->address, array('customer.id' => 1)); |
|
158 | + $this->object->saveItem($item); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | |
162 | 162 | public function testSaveItemInvalidContext() |
163 | 163 | { |
164 | 164 | $context = new \Aimeos\MShop\Context\Item\Standard(); |
165 | - $context->setConfig( $this->context->getConfig() ); |
|
165 | + $context->setConfig($this->context->getConfig()); |
|
166 | 166 | |
167 | - $object = new \Aimeos\MShop\Customer\Manager\Ezpublish( $context ); |
|
167 | + $object = new \Aimeos\MShop\Customer\Manager\Ezpublish($context); |
|
168 | 168 | |
169 | - $this->setExpectedException( \Aimeos\MShop\Customer\Exception::class ); |
|
170 | - $object->saveItem( new \Aimeos\MShop\Customer\Item\Standard( $this->address ) ); |
|
169 | + $this->setExpectedException(\Aimeos\MShop\Customer\Exception::class); |
|
170 | + $object->saveItem(new \Aimeos\MShop\Customer\Item\Standard($this->address)); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | |
174 | 174 | public function testSearchItems() |
175 | 175 | { |
176 | - $mock = $this->getMockBuilder( \Aimeos\MShop\Customer\Manager\Ezpublish::class ) |
|
177 | - ->setConstructorArgs( array( $this->context ) ) |
|
178 | - ->setMethods( array( 'searchItemsBase' ) ) |
|
176 | + $mock = $this->getMockBuilder(\Aimeos\MShop\Customer\Manager\Ezpublish::class) |
|
177 | + ->setConstructorArgs(array($this->context)) |
|
178 | + ->setMethods(array('searchItemsBase')) |
|
179 | 179 | ->getMock(); |
180 | 180 | |
181 | - $result1 = $this->getMockBuilder( \Aimeos\MW\DB\Result\Iface::class )->getMock(); |
|
181 | + $result1 = $this->getMockBuilder(\Aimeos\MW\DB\Result\Iface::class)->getMock(); |
|
182 | 182 | |
183 | - $mock->expects( $this->once() )->method( 'searchItemsBase' )->will( $this->returnValue( $result1 ) ); |
|
184 | - $result1->expects( $this->exactly( 2 ) )->method( 'fetch' ) |
|
185 | - ->will( $this->onConsecutiveCalls( array( 'customer.id' => -1 ), false ) ); |
|
183 | + $mock->expects($this->once())->method('searchItemsBase')->will($this->returnValue($result1)); |
|
184 | + $result1->expects($this->exactly(2))->method('fetch') |
|
185 | + ->will($this->onConsecutiveCalls(array('customer.id' => -1), false)); |
|
186 | 186 | |
187 | 187 | |
188 | - $dbm = $this->getMockBuilder( 'Aimeos\MW\DB\Manager\Iface' )->getMock(); |
|
189 | - $conn = $this->getMockBuilder( 'Aimeos\MW\DB\Connection\Iface' )->getMock(); |
|
190 | - $stmt = $this->getMockBuilder( 'Aimeos\MW\DB\Statement\Iface' )->getMock(); |
|
191 | - $result2 = $this->getMockBuilder( \Aimeos\MW\DB\Result\Iface::class )->getMock(); |
|
188 | + $dbm = $this->getMockBuilder('Aimeos\MW\DB\Manager\Iface')->getMock(); |
|
189 | + $conn = $this->getMockBuilder('Aimeos\MW\DB\Connection\Iface')->getMock(); |
|
190 | + $stmt = $this->getMockBuilder('Aimeos\MW\DB\Statement\Iface')->getMock(); |
|
191 | + $result2 = $this->getMockBuilder(\Aimeos\MW\DB\Result\Iface::class)->getMock(); |
|
192 | 192 | |
193 | - $dbm->expects( $this->any() )->method( 'acquire' )->will( $this->returnValue( $conn ) ); |
|
194 | - $conn->expects( $this->once() )->method( 'create' )->will( $this->returnValue( $stmt ) ); |
|
195 | - $stmt->expects( $this->once() )->method( 'execute' )->will( $this->returnValue( $result2 ) ); |
|
196 | - $result2->expects( $this->exactly( 2 ) )->method( 'fetch' ) |
|
197 | - ->will( $this->onConsecutiveCalls( array( 'contentobject_id' => -1, 'role_id' => -2 ), false ) ); |
|
193 | + $dbm->expects($this->any())->method('acquire')->will($this->returnValue($conn)); |
|
194 | + $conn->expects($this->once())->method('create')->will($this->returnValue($stmt)); |
|
195 | + $stmt->expects($this->once())->method('execute')->will($this->returnValue($result2)); |
|
196 | + $result2->expects($this->exactly(2))->method('fetch') |
|
197 | + ->will($this->onConsecutiveCalls(array('contentobject_id' => -1, 'role_id' => -2), false)); |
|
198 | 198 | |
199 | - $dbm->expects( $this->any() )->method( 'release' ); |
|
199 | + $dbm->expects($this->any())->method('release'); |
|
200 | 200 | |
201 | 201 | |
202 | - $this->context->setDatabaseManager( $dbm ); |
|
203 | - $list = $mock->searchItems( $mock->createSearch() ); |
|
202 | + $this->context->setDatabaseManager($dbm); |
|
203 | + $list = $mock->searchItems($mock->createSearch()); |
|
204 | 204 | |
205 | - $this->assertEquals( 1, count( $list ) ); |
|
206 | - $this->assertInstanceOf( \Aimeos\MShop\Customer\Item\Iface::class, $list[-1] ); |
|
205 | + $this->assertEquals(1, count($list)); |
|
206 | + $this->assertInstanceOf(\Aimeos\MShop\Customer\Item\Iface::class, $list[-1]); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | |
210 | 210 | public function testSearchItemsException() |
211 | 211 | { |
212 | - $object = $this->getMockBuilder( \Aimeos\MShop\Customer\Manager\Ezpublish::class ) |
|
213 | - ->setConstructorArgs( array( $this->context ) ) |
|
214 | - ->setMethods( array( 'searchItemsBase' ) ) |
|
212 | + $object = $this->getMockBuilder(\Aimeos\MShop\Customer\Manager\Ezpublish::class) |
|
213 | + ->setConstructorArgs(array($this->context)) |
|
214 | + ->setMethods(array('searchItemsBase')) |
|
215 | 215 | ->getMock(); |
216 | 216 | |
217 | - $object->expects( $this->once() )->method( 'searchItemsBase' ) |
|
218 | - ->will( $this->throwException( new \Aimeos\MShop\Exception() ) ); |
|
217 | + $object->expects($this->once())->method('searchItemsBase') |
|
218 | + ->will($this->throwException(new \Aimeos\MShop\Exception())); |
|
219 | 219 | |
220 | - $this->setExpectedException( \Aimeos\MShop\Exception::class ); |
|
221 | - $object->searchItems( $object->createSearch() ); |
|
220 | + $this->setExpectedException(\Aimeos\MShop\Exception::class); |
|
221 | + $object->searchItems($object->createSearch()); |
|
222 | 222 | } |
223 | 223 | } |