Commit Graph

21 Commits

Author SHA1 Message Date
Peter Rehm 7aac273701 Added the renamed options of the collection type to the upgrade information 2015-11-26 09:44:24 +01:00
Christian Flothmann 062d707820 [Yaml] sync changelog and upgrade files 2015-11-24 22:06:14 +01:00
WouterJ e3aa5226e4 [2.8][Form] Deprecate alias tag option 2015-10-01 17:36:27 +02:00
Javier Eguiluz 83b2d7c53b Remove profiler storages 2015-09-30 11:11:05 +02:00
Fabien Potencier d60428c9ca feature #15738 Implement service-based Resource (cache) validation (mpdude)
This PR was squashed before being merged into the 2.8 branch (closes #15738).

Discussion
----------

Implement service-based Resource (cache) validation

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | #7230, #15692, #7782
| License       | MIT
| Doc PR        | symfony/symfony-docs#5136

### Overview

Currently, any metadata passed to `ConfigCache` (namely implementations of `ResourceInterface`) is serialized to disk. When the `ConfigCache` is validated, the metadata is unserialized and queried through `ResourceInterface::isFresh()` to determine whether the cache is fresh. That way, `ResourceInterface` implementations cannot interact with services, for example a database connection.

This PR introduces the new concept of `ResourceCheckers`. Services implementing `ResourceCheckerInterface` can be tagged as `config_cache.resource_checker` with an optional priority.

Clients that wish to use `ConfigCache` can then obtain an instance from the `config_cache_factory` service (which implements `ConfigCacheFactoryInterface`). The factory will take care of injecting resource checkers into the `ConfigCache` instance so that they can be used for cache validation.

Checking cache metadata is easy for `ResourceCheckers`:
* First, the `ResourceCheckerInterface::supports()` implementation is passed the metadata object in question. If the checker cannot handle the type of resource passed, `supports()` should return `false`.
* Otherwise, the `ResourceCheckerInterface::isFresh()` method will be called and given the resource as well as the timestamp at which the cache was initialized. If that method returns `false`, the cache is considered stale. If it returns `true`, the resource is considered unchanged and will *not* be passed to any additional checkers.

### BC and migration path

This PR does not (intend to) break BC but it comes with deprecations. The main reason is that `ResourceInterface` contains an `isFresh()` method that does not make sense in the general case of resources.

Thus, `ResourceInterface::isFresh()` is marked as deprecated and should be removed in Symfony 3.0. Resource implementations that can (or wish to) be validated in that simple manner can implement the `SelfCheckingResourceInterface` sub-interface that still contains (and will keep) the `isFresh()` method. The change should be as simple as changing the `extends` list.

Apart from that, `ResourceInterface` will be kept as the base interface for resource implementations. It is used in several `@api` interfaces and thus cannot easily be substituted.

For the Symfony 2.x series, a `BCResourceInterfaceChecker` will be kept that performs validation through `ResourceInterface::isFresh()` but will trigger a deprecation warning. The remedy is to either implement a custom ResourceChecker with a priority higher than -1000; or to switch to the aforementioned `SelfCheckingResourceInterface` which is used at a priority of -990 (without deprecation warning).

The `ConfigCache` and `ConfigCacheFactory` classes can be used as previously but do not feature checker-based cache validation.

### Outlook and closing remarks:

This PR supersedes #7230, #15692 and works at least in parts towards the goal of #7176.

The `ResourceCheckerInterface`, `...ConfigCache` and `...ConfigCacheFactory` no longer need to be aware of the `debug` flag. The different validation rules applied previously are now just a matter of `ResourceChecker` configuration (i. e. "no checkers" in `prod`).

It might be possible to remove the `debug` flag from Symfony's `Router` and/or `Translator` classes in the future as well because it was only passed on to the `ConfigCache` there.

Commits
-------

20d3722 Implement service-based Resource (cache) validation
2015-09-25 08:33:07 +02:00
Matthias Pigulla 20d3722120 Implement service-based Resource (cache) validation 2015-09-25 08:31:17 +02:00
Ryan Weaver 948ccec1ea Updating AbstractVoter so that the method receives the TokenInterface 2015-09-24 08:33:58 +02:00
Christophe Coevoet 8826d39e0f Validate the extended type for lazy-loaded type extensions 2015-09-15 12:07:24 +02:00
Fabien Potencier 0383559f95 feature #15709 [WebProfilerBundle] deprecated import/export commands (fabpot)
This PR was merged into the 2.8 branch.

Discussion
----------

[WebProfilerBundle] deprecated import/export commands

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | part of #11742
| License       | MIT
| Doc PR        | n/a

Commits
-------

943fec9 [HtppKernel] deprecated Profiler::import/export
17e00b9 [WebProfilerBundle] deprecated import/export commands
2015-09-09 23:21:50 +02:00
Christian Flothmann e1818bd5d9 move feature description to changelog file 2015-09-08 08:37:45 +02:00
Fabien Potencier 17e00b9b8e [WebProfilerBundle] deprecated import/export commands 2015-09-07 15:21:37 +02:00
Javier Eguiluz 68f0818a6c Allow to define Enum nodes with 1 single element 2015-08-03 10:27:53 +02:00
Fabien Potencier 8d049c51d3 fixed typos 2015-08-01 08:45:26 +02:00
Fabien Potencier 5b38d74128 feature #15079 [Form] Deprecated FormTypeInterface::getName() and passing of type instances (webmozart)
This PR was merged into the 2.8 branch.

Discussion
----------

[Form] Deprecated FormTypeInterface::getName() and passing of type instances

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | #5321, #15008
| License       | MIT
| Doc PR        | TODO

#### Type Names

This PR deprecates the definition of the `getName()` method of form types. See #15008 for a more detailed description.

Before:

```php
class MyType extends AbstractType
{
    public function getName()
    {
        return 'mytype';
    }

    // ...
}
```

After:

```php
class MyType extends AbstractType
{
    // ...
}
```

You should always reference other types by their fully-qualified class names. Thanks to PHP 5.5, that's easy:

Before:

```php
$form = $this->createFormBuilder()
    ->add('name', 'text')
    ->add('age', 'integer')
    ->getForm();
```

After:

```php
$form = $this->createFormBuilder()
    ->add('name', TextType::class)
    ->add('age', IntegerType::class)
    ->getForm();
```

#### Type Instances

Furthermore, passing of type instances is deprecated.

Before:

```php
$form = $this->createForm(new AuthorType());
```

After:

```php
$form = $this->createForm(AuthorType::class);
```

#### DIC Aliases

When registering a type in the DIC, you should omit the "alias" attribute now.

Before:

```xml
<service id="my.type" class="Vendor\Type\MyType">
    <tag name="form.type" alias="mytype" />
    <argument type="service" id="some.service.id" />
</service>
```

After:

```xml
<service id="my.type" class="Vendor\Type\MyType">
    <tag name="form.type" />
    <argument type="service" id="some.service.id" />
</service>
```

Types without dependencies don't need to be registered in the DIC as they can be instantiated right away.

#### Template Block Prefixes

By default, the class name of the type in underscore notation minus "Type" suffix is used as Twig template block prefix (e.g. `UserProfileType` => `user_profile_*`). If you want to customize that, overwrite the new `getBlockPrefix()` method in your type:

```php
class UserProfileType extends AbstractType
{
    public function getBlockPrefix()
    {
        return 'profile';
    }

    // ...
}
```

Commits
-------

3d9e5de [Form] Deprecated FormTypeInterface::getName() and passing of type instances
2015-08-01 08:44:19 +02:00
Fabien Potencier ce5363aee0 feature #15372 [FrameworkBundle] Change the default value of cookie_httponly (jderusse)
This PR was merged into the 2.8 branch.

Discussion
----------

[FrameworkBundle] Change the default value of cookie_httponly

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | yes
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #15303
| License       | MIT
| Doc PR        | symfony/symfony-docs#5561

Commits
-------

a7bef1e Change the default value of cookie_httponly to fix #15303
2015-08-01 08:15:28 +02:00
Javier Eguiluz 9df0f8b4b8 Added some upgrade notes about the new toolbar design 2015-07-31 12:12:25 +02:00
Jérémy Derussé a7bef1eb2d Change the default value of cookie_httponly to fix #15303 2015-07-28 13:20:34 +02:00
Bernhard Schussek 3d9e5de2b9 [Form] Deprecated FormTypeInterface::getName() and passing of type instances 2015-07-02 10:02:46 +02:00
Diego Saint Esteben 6c4a676d09 Add "shared" flag and deprecate scopes concept 2015-06-24 12:32:32 -03:00
Bernhard Schussek 6c554c6c1a [Form] Deprecated "cascade_validation" 2015-06-17 20:03:11 +02:00
Abdellatif Ait boudad 2869a32cf1 [Translator] deprecate getMessages in favor of getCatalogue. 2015-05-06 09:17:03 +00:00