Skip to content

Commit 2133258

Browse files
committed
Merge remote-tracking branch 'remotes/origin/master' into 1.9
2 parents 6e45c54 + 6fb8643 commit 2133258

File tree

87 files changed

+1063
-512
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+1063
-512
lines changed

src/Oro/Bundle/ActivityListBundle/Entity/ActivityList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ public function getSubject()
331331
*/
332332
public function setSubject($subject)
333333
{
334-
$this->subject = $subject;
334+
$this->subject = substr($subject, 0, 255);
335335

336336
return $this;
337337
}

src/Oro/Bundle/ActivityListBundle/Resources/public/css/less/activity-list.less

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,6 @@
173173
}
174174
.accordion-body {
175175
padding: 0;
176-
.control-group{
177-
max-width: none;
178-
}
179176
> .message {
180177
.user-fieldset {
181178
margin-top: 5px;

src/Oro/Bundle/AddressBundle/Form/Type/AddressType.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
use Symfony\Component\Form\FormView;
88
use Symfony\Component\OptionsResolver\OptionsResolver;
99
use Symfony\Component\Form\AbstractType;
10+
use Symfony\Component\Validator\Constraint;
1011

1112
use Oro\Bundle\AddressBundle\Form\EventListener\AddressCountryAndRegionSubscriber;
1213

1314
class AddressType extends AbstractType
1415
{
16+
const ABSTRACT_ADDRESS_GROUP = 'AbstractAddress';
1517
/**
1618
* @var AddressCountryAndRegionSubscriber
1719
*/
@@ -65,6 +67,7 @@ public function configureOptions(OptionsResolver $resolver)
6567
'extra_fields_message' => 'This form should not contain extra fields: "{{ extra_fields }}"',
6668
'single_form' => true,
6769
'region_route' => 'oro_api_country_get_regions',
70+
'validation_groups' => [Constraint::DEFAULT_GROUP, self::ABSTRACT_ADDRESS_GROUP],
6871
)
6972
);
7073
}

src/Oro/Bundle/AddressBundle/Resources/config/validation.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ Oro\Bundle\AddressBundle\Entity\AbstractAddress:
1717
max: 255
1818

1919
country:
20-
- NotBlank: ~
20+
- NotBlank:
21+
groups: [AbstractAddress]
2122

2223
regionText:
2324
- Length:

src/Oro/Bundle/ApiBundle/Command/DebugCommand.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
use Oro\Component\ChainProcessor\ChainApplicableChecker;
1414
use Oro\Component\ChainProcessor\Context;
1515
use Oro\Component\ChainProcessor\ProcessorBagInterface;
16-
use Oro\Bundle\ApiBundle\Request\RequestType;
1716

1817
class DebugCommand extends ContainerAwareCommand
1918
{

src/Oro/Bundle/ApiBundle/Command/DumpConfigCommand.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
use Symfony\Component\Yaml\Yaml;
1010
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
1111

12+
use Oro\Component\ChainProcessor\ProcessorBag;
1213
use Oro\Bundle\ApiBundle\Config\DescriptionsConfigExtra;
1314
use Oro\Bundle\ApiBundle\Config\FiltersConfigExtra;
1415
use Oro\Bundle\ApiBundle\Config\SortersConfigExtra;
1516
use Oro\Bundle\ApiBundle\Provider\ConfigProvider;
1617
use Oro\Bundle\ApiBundle\Provider\RelationConfigProvider;
17-
use Oro\Bundle\ApiBundle\Request\RequestType;
1818
use Oro\Bundle\ApiBundle\Request\Version;
1919
use Oro\Bundle\EntityBundle\Tools\EntityClassNameHelper;
2020

@@ -44,8 +44,7 @@ protected function configure()
4444
'request-type',
4545
null,
4646
InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
47-
'API request type',
48-
[RequestType::REST, RequestType::JSON_API]
47+
'API request type'
4948
)
5049
->addOption(
5150
'section',
@@ -81,6 +80,10 @@ public function execute(InputInterface $input, OutputInterface $output)
8180
$extras[] = new DescriptionsConfigExtra();
8281
}
8382

83+
/** @var ProcessorBag $processorBag */
84+
$processorBag = $this->getContainer()->get('oro_api.processor_bag');
85+
$processorBag->addApplicableChecker(new RequestTypeApplicableChecker());
86+
8487
switch ($input->getOption('section')) {
8588
case 'entities':
8689
$config = $this->getConfig($entityClass, $version, $requestType, $extras);

src/Oro/Bundle/ApiBundle/Command/DumpMetadataCommand.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
use Symfony\Component\Yaml\Yaml;
1010
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
1111

12+
use Oro\Component\ChainProcessor\ProcessorBag;
1213
use Oro\Bundle\ApiBundle\Provider\ConfigProvider;
1314
use Oro\Bundle\ApiBundle\Provider\MetadataProvider;
14-
use Oro\Bundle\ApiBundle\Request\RequestType;
1515
use Oro\Bundle\ApiBundle\Request\Version;
1616
use Oro\Bundle\ApiBundle\Util\ConfigUtil;
1717
use Oro\Bundle\EntityBundle\Tools\EntityClassNameHelper;
@@ -42,8 +42,7 @@ protected function configure()
4242
'request-type',
4343
null,
4444
InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY,
45-
'API request type',
46-
[RequestType::REST, RequestType::JSON_API]
45+
'API request type'
4746
);
4847
}
4948

@@ -61,6 +60,10 @@ public function execute(InputInterface $input, OutputInterface $output)
6160
//$version = $input->getArgument('version');
6261
$version = Version::LATEST;
6362

63+
/** @var ProcessorBag $processorBag */
64+
$processorBag = $this->getContainer()->get('oro_api.processor_bag');
65+
$processorBag->addApplicableChecker(new RequestTypeApplicableChecker());
66+
6467
$metadata = $this->getMetadata($entityClass, $version, $requestType);
6568
$output->write(Yaml::dump($metadata, 100, 4, true, true));
6669
}

src/Oro/Bundle/ApiBundle/Provider/ConfigProvider.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function __construct(ConfigProcessor $processor)
3333
*
3434
* @return array|null
3535
*/
36-
public function getConfig($className, $version, array $requestType, array $extras = [])
36+
public function getConfig($className, $version, array $requestType = [], array $extras = [])
3737
{
3838
if (empty($className)) {
3939
throw new \InvalidArgumentException('$className must not be empty.');
@@ -46,10 +46,14 @@ public function getConfig($className, $version, array $requestType, array $extra
4646

4747
/** @var ConfigContext $context */
4848
$context = $this->processor->createContext();
49-
$context->setVersion($version);
50-
$context->setRequestType($requestType);
51-
$context->setExtras($extras);
5249
$context->setClassName($className);
50+
$context->setVersion($version);
51+
if (!empty($requestType)) {
52+
$context->setRequestType($requestType);
53+
}
54+
if (!empty($extras)) {
55+
$context->setExtras($extras);
56+
}
5357

5458
$this->processor->process($context);
5559

src/Oro/Bundle/ApiBundle/Provider/FieldConfigProvider.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __construct(FieldConfigProcessor $processor)
3434
*
3535
* @return array|null
3636
*/
37-
public function getFieldConfig($className, $fieldName, $version, array $requestType, array $extras = [])
37+
public function getFieldConfig($className, $fieldName, $version, array $requestType = [], array $extras = [])
3838
{
3939
if (empty($className)) {
4040
throw new \InvalidArgumentException('$className must not be empty.');
@@ -50,11 +50,15 @@ public function getFieldConfig($className, $fieldName, $version, array $requestT
5050

5151
/** @var FieldConfigContext $context */
5252
$context = $this->processor->createContext();
53-
$context->setVersion($version);
54-
$context->setRequestType($requestType);
55-
$context->setExtras($extras);
5653
$context->setClassName($className);
5754
$context->setFieldName($fieldName);
55+
$context->setVersion($version);
56+
if (!empty($requestType)) {
57+
$context->setRequestType($requestType);
58+
}
59+
if (!empty($extras)) {
60+
$context->setExtras($extras);
61+
}
5862

5963
$this->processor->process($context);
6064

src/Oro/Bundle/ApiBundle/Provider/MetadataProvider.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,22 @@ public function __construct(MetadataProcessor $processor)
3131
*
3232
* @return EntityMetadata|null
3333
*/
34-
public function getMetadata($className, $version, array $requestType, array $extras = [], $config = null)
34+
public function getMetadata($className, $version, array $requestType = [], array $extras = [], $config = null)
3535
{
3636
if (empty($className)) {
3737
throw new \InvalidArgumentException('$className must not be empty.');
3838
}
3939

4040
/** @var MetadataContext $context */
4141
$context = $this->processor->createContext();
42-
$context->setVersion($version);
43-
$context->setRequestType($requestType);
4442
$context->setClassName($className);
45-
$context->setExtras($extras);
43+
$context->setVersion($version);
44+
if (!empty($requestType)) {
45+
$context->setRequestType($requestType);
46+
}
47+
if (!empty($extras)) {
48+
$context->setExtras($extras);
49+
}
4650
if (!empty($config)) {
4751
$context->setConfig($config);
4852
}

0 commit comments

Comments
 (0)