Commit Graph

1274 Commits

Author SHA1 Message Date
Bernhard Schussek
41b0127963 [Form] Deprecated bind() and isBound() in favor of submit() and isSubmitted() 2013-04-20 18:05:58 +02:00
WouterJ
8da61295a4 Moved FormIntegrationTestCase and FormPerformanceTestCase to the Test namespace 2013-04-19 14:44:07 +02:00
Fabien Potencier
6b27e12ab5 merged branch dbu/doctrine-register-mappings-pass (PR #7599)
This PR was squashed before being merged into the master branch (closes #7599).

Discussion
----------

[Doctrine-Bridge] add a base compiler pass class to register doctrine mappings

| Q             | A
| ------------- | ---
| Bug fix?      |  no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | not on code, but defining best practices
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/pull/2507

Reusable bundles providing model classes should not rely on the automapping provided by the doctrine bundles. What is more, the same model can often be mapped to Doctrine ORM, MongoODM, CouchODM and PHPCR-ODM.

This pull request adds a base class for a compiler pass that the concrete doctrine bundles extend to provide a default compiler pass that makes it trivial for bundles to register their mappings. See https://github.com/doctrine/DoctrineBundle/pull/177

The FOSUserBundle shows how this would look in practice. See https://github.com/FriendsOfSymfony/FOSUserBundle/pull/1081

I will create the documentation pull request as well as pull requests for the mongo, couch and phpcr bundles once we agree how exactly to do this.

Commits
-------

099fd9f [Doctrine-Bridge] add a base compiler pass class to register doctrine mappings
2013-04-18 07:16:59 +02:00
David Buchmann
099fd9f52c [Doctrine-Bridge] add a base compiler pass class to register doctrine mappings 2013-04-18 07:16:59 +02:00
Eugene Leonovich
765d8ffa70 Set default value for "is_bundle" option to true for "auto_mapping" mode 2013-04-18 07:13:02 +02:00
Dariusz Górecki
553e294f77 [Fix CS] Unneeded whitespace around negation operator 2013-04-02 10:46:23 +01:00
Dariusz Górecki
7c47e34928 [CS Fix] Consistent coding-style of concatenation operator usage 2013-04-02 10:39:57 +01:00
Fabien Potencier
e1c741db9c Merge branch '2.2'
* 2.2: (22 commits)
  fixed doc references (closes #7515)
  fixed doc references (closes #7515)
  On OS X, sys_get_tmp_dir() returns /var/private/..., which really is below /private/var.
  Doctrine cannot handle bare random non-utf8 strings
  small changes
  [SecurityBundle] Fixed configuration exemple
  idAsIndex should be true with a smallint or bigint id field.
  [PropertyAccess] Remove trailing periods from doc blocks
  Fix param docs for PropertyAccessor read method
  Fixed long multibyte parameter logging in DbalLogger:startQuery
  Keep the file extension in the temporary copy and test that it exists (closes #7482)
  bumped Symfony version to 2.1.10-DEV
  [Validator][translation][japanese]replaced period to japanese one [Validator][translation][japanese]fixed japanese translation to more practical one [Validator][translation][japanese]fixed message ordering to be consistent with other languages [Validator][translation][japanese]added new validation messages in japanese translation
  updated VERSION for 2.1.9
  update CONTRIBUTORS for 2.1.9
  updated CHANGELOG for 2.1.9
  [Security] fixed wrong interface
  Remove already defined arguments
  Add missing use
  [FrameworkBundle] Reuse definition variable in FormPass
  ...

Conflicts:
	src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php
	src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig
2013-04-01 10:07:30 +02:00
Fabien Potencier
ab1ab7ac18 merge branch '2.1' into 2.2
* 2.1:
  fixed doc references (closes #7515)
  small changes
  [SecurityBundle] Fixed configuration exemple
  idAsIndex should be true with a smallint or bigint id field.
  Fixed long multibyte parameter logging in DbalLogger:startQuery
  Keep the file extension in the temporary copy and test that it exists (closes #7482)
  [Validator][translation][japanese]replaced period to japanese one [Validator][translation][japanese]fixed japanese translation to more practical one [Validator][translation][japanese]fixed message ordering to be consistent with other languages [Validator][translation][japanese]added new validation messages in japanese translation

Conflicts:
	src/Symfony/Component/Validator/Resources/translations/validators.ja.xlf
2013-04-01 10:05:23 +02:00
Simon Terrien
673fd9bc27 idAsIndex should be true with a smallint or bigint id field. 2013-03-29 10:20:11 +01:00
Peter Buri
64a1d3999a Fixed long multibyte parameter logging in DbalLogger:startQuery 2013-03-27 19:41:01 +01:00
Fabien Potencier
b3081e85a0 [Form] removed deprecated methods and classes 2013-03-23 11:48:19 +01:00
Fabien Potencier
38fd9d995c [DoctrineBridge] fixed failing test 2013-03-22 16:41:38 +01:00
dinitrol
4f7c6f4f9f Fixed parameters for substr() function 2013-03-22 16:40:24 +01:00
Fabien Potencier
d699a929e0 Merge branch '2.2'
* 2.2: (70 commits)
  change wrapped exception message to be more usefull
  updated VERSION for 2.0.23
  update CONTRIBUTORS for 2.0.23
  updated CHANGELOG for 2.0.23
  [Form] fixed failing test
  [DomCrawler] added support for query string with slash
  Fixed invalid file path for hiddeninput.exe on Windows.
  fix xsd definition for strict-requirements
  [WebProfilerBundle] Fixed the toolbar styles to apply them in IE8
  [ClassLoader] fixed heredocs handling
  fixed handling of heredocs
  Add a public modifier to an interface method
  removing xdebug extension
  [HttpRequest] fixes Request::getLanguages() bug
  [HttpCache] added a test (cached content should be kept after purging)
  [DoctrineBridge] Fixed non-utf-8 recognition
  [Security] fixed HttpUtils class tests
  replaced new occurences of 'Request::create()' with '::create()'
  changed sub-requests creation to '::create()'
  fixed merge issue
  ...

Conflicts:
	src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php
	src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.html.twig
	src/Symfony/Component/DomCrawler/Link.php
	src/Symfony/Component/Translation/Translator.php
2013-03-20 15:03:03 +01:00
Fabien Potencier
b3ca7988cc Merge branch '2.1' into 2.2
* 2.1:
  Add a public modifier to an interface method
  [HttpRequest] fixes Request::getLanguages() bug
  [HttpCache] added a test (cached content should be kept after purging)
  [DoctrineBridge] Fixed non-utf-8 recognition
  [Security] fixed HttpUtils class tests
2013-03-19 21:41:20 +01:00
Sarah Khalil
67fbbac877 [DoctrineBridge] Fixed non-utf-8 recognition 2013-03-16 16:50:00 +01:00
Fabien Potencier
0d7593c636 Merge branch '2.1' into 2.2
* 2.1:
  sub-requests are now created with the same class as their parent
  [FrameworkBundle] removed BC break
  [FrameworkBundle] changed temp kernel name in cache:clear
  [DoctrineBridge] Avoids blob values to be logged by doctrine
  [Security] use current request attributes to generate redirect url?
  [Validator] fix showing wrong max file size for upload errors
  [TwigBridge] removed double var initialization (refs #7344)
  [2.1][TwigBridge] Fixes Issue #7342 in TwigBridge
  [FrameworkBundle] fixed cahe:clear command's warmup
  [TwigBridge] now enter/leave scope on Twig_Node_Module
  [TwigBridge] fixed fixed scope & trans_default_domain node visitor
  [TwigBridge] fixed non probant tests & added new one
  [BrowserKit] added ability to ignored malformed set-cookie header
  [Translation] removed wriong 'use'
  [Translation] added xliff loader/dumper with resname support
  [TwigBridge] fixes

Conflicts:
	src/Symfony/Bundle/FrameworkBundle/HttpKernel.php
	src/Symfony/Component/Security/Http/HttpUtils.php
	src/Symfony/Component/Translation/Loader/XliffFileLoader.php
	src/Symfony/Component/Translation/Tests/Loader/XliffFileLoaderTest.php
2013-03-15 11:14:31 +01:00
Jean-François Simon
ef534568c6 [DoctrineBridge] Avoids blob values to be logged by doctrine 2013-03-13 18:37:43 +01:00
Fabien Potencier
fb7004baab Merge branch '2.2'
* 2.2:
  Defined stable version point of Doctrine.
  [HttpFoundation] Remove Cache-Control when using https download via IE<9 (fixes #6750)
  Update composer.json
  [Form] Fixed TimeType not to render a "size" attribute in select tags
  [Form] Added test for "label" option to accept the value "0"
  Expanded fault-tolerance for unusual cookie dates
  Fix docblock type
  [Form] Fixed "label" option to accept the value "0"
  Added greek translation
  merged branch jfcixmedia/2.1 (PR #5838)
  added a note about a BC break for the path info of sub-request (closes #7138)
  [DomCrawler] lowered parsed protocol string (fixes #6986)
  [FrameworkBundle] Fix a BC for Hinclude global template
  [HttpKernel] fixed locale management when exiting sub-requests
  fixed HInclude renderer (closes #7113)
  Removed some leaking deprecation warning in the Form component
  [HttpKernel] hinclude fragment renderer must escape URIs properly to return valid html

Conflicts:
	src/Symfony/Bundle/FrameworkBundle/composer.json
	src/Symfony/Component/Security/composer.json
2013-02-23 07:47:02 +01:00
Christophe Coevoet
189fba6d0f Removed some leaking deprecation warning in the Form component
Fixes #7101
2013-02-19 08:14:41 +01:00
Fabien Potencier
386884046d changed dependencies to allow all 2.3 versions of the components (closes #6983) 2013-02-11 11:13:11 +01:00
Fabien Potencier
c97be281c0 Merge branch '2.2'
* 2.2: (30 commits)
  [HttpFoundation] Added support for partial ranges in the BinaryFileResponse.
  [HttpFoundation] Fixed byte ranges in the BinaryFileResponse.
  updated required versions when depending on the HttpFoundation component
  updated required versions when depending on the HttpKernel component
  updated required versions when depending on the Config component
  updated required versions when depending on the Form component
  updated required versions when depending on the DependencyInjection component
  updated required versions when depending on the Validator component
  updated required versions when depending on the Translation component
  updated required versions when depending on the Routing component
  updated required versions when depending on the EventDispatcher component
  updated required versions when depending on the OptionsResolver component
  updated required versions when depending on the PropertyAccess component
  updated required versions when depending on the Security component
  updated required versions when depending on the Templating component
  updated required versions when depending on the Stopwatch component
  updated required versions when depending on the Process component
  updated required versions when depending on the Finder component
  updated required versions when depending on the Dom Crawler component
  use ~2.0 when depending on the Dom Crawler component
  ...
2013-02-11 11:09:44 +01:00
Fabien Potencier
270470596f updated required versions when depending on the HttpKernel component 2013-02-08 17:10:57 +01:00
Fabien Potencier
2f1939b4a0 updated required versions when depending on the Form component 2013-02-08 17:10:57 +01:00
Fabien Potencier
719628a5ce updated required versions when depending on the DependencyInjection component 2013-02-08 17:10:56 +01:00
Fabien Potencier
3db311a601 updated required versions when depending on the Validator component 2013-02-08 17:10:56 +01:00
Fabien Potencier
f971ccf231 updated required versions when depending on the Security component 2013-02-08 17:10:54 +01:00
Fabien Potencier
108a8c0117 updated required versions when depending on the Stopwatch component 2013-02-08 17:10:54 +01:00
Fabien Potencier
63bfd9ef79 [Doctrine] removed usage of the deprecated LoggerInterface in some tests 2013-02-08 17:10:08 +01:00
Fabien Potencier
223cc6f7c7 Merge branch '2.2'
* 2.2:
  fixed regression in the Finder component (it was possible to use it without using exec before, closes #6357)
  fixed a circular call (closes #6864)
  typo
  [Security] [Tests] added unit tests for the UserPasswordValidator class and made the validator service for the UserPassword constraint configurable.
  fixed wrong indentation
  tweaked previous commit
  [HttpKernel] Fix the URI signer (closes #6801)
  Add Arabic translations.
  [HttpKernel] fixed regression when rendering an inline controller and passing some objects  (closes #6822)
  [FrameworkBundle] fixed typo
  renamed some classes and Twig functions to more descriptive names (refs #6871)
  Classcollectionloader: fix traits + enhancements
  Fix a deprecated method call in the tests
  Update `composer.json` files: - to allow versions ~2.2 (>=2.2,<3.0) of Doctrine DBAL, ORM & Common - fixed Propel1 versions difference between main and bridge files - fixed Twig versions difference between main and bridge files - to allow versions ~1.11 (>=1.11,<2.0) of Twig - fixed Locale ext-intl version to accept all, not non-existing version
  Correct comment in NativeSessionStorage regarding session.save_handler
  [Security] Add PHPDoc to AuthenticationEvents
2013-02-04 13:42:02 +01:00
Joseph Bielawski
53c70548a0 Update composer.json files: - to allow versions ~2.2 (>=2.2,<3.0) of Doctrine DBAL, ORM & Common - fixed Propel1 versions difference between main and bridge files - fixed Twig versions difference between main and bridge files - to allow versions ~1.11 (>=1.11,<2.0) of Twig - fixed Locale ext-intl version to accept all, not non-existing version 2013-02-01 10:33:53 +01:00
Fabien Potencier
d0aaf62557 updated the branch alias in composer files 2013-01-31 22:39:01 +01:00
Fabien Potencier
1f762c7723 Merge branch '2.1'
* 2.1:
  [Yaml] fixed default value
  Added Yaml\Dumper::setIndentation() method to allow a custom indentation level of nested nodes.
  added a way to enable/disable object support when parsing/dumping
  added a way to enable/disable PHP support when parsing a YAML input via Yaml::parse()
  fixed CS
  [Process] Fix docblocks, remove `return` from `PhpProcess#start()` as parent returns nothing, cleaned up `ExecutableFinder`
  fixes a bug when output/error output contains a % character
  [Console] fixed input bug when the value of an option is empty (closes #6649, closes #6689)
  [Profiler] [Redis] Fix sort of profiler rows.
  Fix version_compare() calls for PHP 5.5.
  Removed underscores from test method names to be consistent with other components.
  [Process] In edge cases `getcwd()` can return `false`, then `proc_open()` should get `null` to use default value (the working dir of the current PHP process)
  Fix version_compare() calls for PHP 5.5.
  Handle the deprecation of IntlDateFormatter::setTimeZoneId() in PHP 5.5.
  removed the .gitattributes files (closes #6605, reverts #5674)
  [HttpKernel] Clarify misleading comment in ExceptionListener

Conflicts:
	src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_style.html.twig
	src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php
	src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php
	src/Symfony/Component/Form/Tests/Util/PropertyPathTest.php
	src/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php
	src/Symfony/Component/Process/Process.php
2013-01-17 16:25:59 +01:00
Jakub Zalas
802426272f Removed underscores from test method names to be consistent with other components.
It is more common to use fully camel-cased names for test methods. Only some of the test methods are called with underscore notation. To avoid confusion it is better to be consistent.
2013-01-11 00:31:43 +00:00
Fabien Potencier
39686077f8 merged branch bschussek/property-path (PR #6595)
This PR was merged into the master branch.

Commits
-------

6b1652e [PropertyAccess] Property path, small refactoring, read/writeProperty to read/write Property/Index.
1bae7b2 [PropertyAccess] Extracted PropertyAccess component out of Form

Discussion
----------

[PropertyAccess] Extracted PropertyAccess component out of Form

Bug fix: no
Feature addition: no
Backwards compatibility break: yes
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
License of the code: MIT
Documentation PR: -

TODO: adapt DoctrineBundle/PropelBundle to pass the "property_accessor" service to EntityType/ModelType

Usage:

```php
$accessor = PropertyAccess::getPropertyAccessor();

// equivalent to $object->getFoo()->setBar('value')
$accessor->setValue($object, 'foo.bar', 'value');

// equivalent to $object->getFoo()->getBar()
$accessor->getValue($object, 'foo.bar');

// equivalent to $object->getFoo()['bar']
$accessor->getValue($object, 'foo[bar]');

// equivalent to $array['foo']->setBar('value')
$accessor->setValue($array, '[foo].bar', 'value');

// equivalent to $array['foo']['bar']
$accessor->getValue($array, '[foo][bar]');
```

Later on, once we have generation and caching of class-specific accessors, configuration will be something like this (consistent with the Form and Validator component):

```php
$accessor = PropertyAccess::getPropertyAccessorBuilder()
    ->setCacheDirectory(__DIR__ . '/cache')
    ->setCacheLifeTime(86400)
    ->enableMagicGetSet()
    ->enableMagicCall()
    ->getPropertyAccessor();
```

or

```php
$accessor = PropertyAccess::getPropertyAccessorBuilder()
    ->setCache($cache)
    ->getPropertyAccessor();
```

etc.

---------------------------------------------------------------------------

by Burgov at 2013-01-07T08:48:15Z

+1. I use this feature outside of the Form context a lot

---------------------------------------------------------------------------

by stof at 2013-01-07T08:49:34Z

The classes in the Form component should be kept for BC (and deprecated) for people using the feature

---------------------------------------------------------------------------

by michelsalib at 2013-01-07T10:02:19Z

YES YES YES 👍. Sorry for my enthusiasm, but I already copy pasted the PropertyPath class to some of my libraries to avoid linking to the whole Form component. I thus will be glad to officially use this component into my libraries via composer.

---------------------------------------------------------------------------

by norzechowicz at 2013-01-07T10:17:39Z

Same as @michelsalib to avoid linking full Form component I was using copied parts of code. Can't wait to use this component in my lib. 👍

---------------------------------------------------------------------------

by bschussek at 2013-01-07T10:43:41Z

I split away `getValue()` and `setValue()` from `PropertyPath` into a new class `ReflectionGraph`. The component is also named ReflectionGraph now.

---------------------------------------------------------------------------

by michelsalib at 2013-01-07T10:47:10Z

I am not found of the name. What do you intend to do in the component more than what PropertyPath does ?

---------------------------------------------------------------------------

by bschussek at 2013-01-07T10:58:59Z

@michelsalib A `PropertyPath` is simply a string like `foo.bar[baz]`. `getValue()` and `setValue()` interpret this path. There may be different interpretations for the same path, so these methods were split into a new class.

I chose the name `ReflectionGraph` because the functionality is very similar to `ReflectionProperty`.

```php
$reflProperty = new ReflectionProperty('Vendor/Class', 'property');
$reflProperty->setValue($object, 'foo');

$reflGraph = new ReflectionGraph();
$reflGraph->setValue($object, 'property.path', 'foo');
```

---------------------------------------------------------------------------

by michelsalib at 2013-01-07T11:00:42Z

What about naming it `Reflection`, maybe sometime we will want to add more reflection tools for classes, interfaces... ?

---------------------------------------------------------------------------

by bschussek at 2013-01-07T11:02:32Z

@michelsalib I doubt that we will do that. PHP's implementation is sufficient.

---------------------------------------------------------------------------

by vicb at 2013-01-07T11:03:57Z

> Backwards compatibility break: no

Really ?

---------------------------------------------------------------------------

by michelsalib at 2013-01-07T11:05:07Z

Well, that is just a suggestion. If I am the only one to oppose, I won't complain.

---------------------------------------------------------------------------

by bschussek at 2013-01-07T11:09:08Z

> Really ?

@vicb Would you please refrain from such meanginless comments in the future? I'm getting a bit tired of them. If you think that BC is broken somewhere, tell me where so that I can fix it.

---------------------------------------------------------------------------

by stof at 2013-01-07T11:09:43Z

@vicb There is no BC break as he kept deprecated classes for BC

---------------------------------------------------------------------------

by norzechowicz at 2013-01-07T11:13:12Z

@bschussek what do you think about some kind of factory for Reflection? This will prevent creating new Reflection objects each time you want to access properties values.

---------------------------------------------------------------------------

by vicb at 2013-01-07T11:18:47Z

@bschussek my point is that my comment is no more meaningless than closing #6453 because it will break BC.We could also keep BC by extending the classes in the new ns but in both cases BC will ultimately be broken (when the legacy classes are removed)

---------------------------------------------------------------------------

by vicb at 2013-01-07T12:23:45Z

@bschussek @stof I think that modifying the constructor signatures of `EntityChoiceList`, `FormType` are BC breaks (this is not an exhaustive list)

---------------------------------------------------------------------------

by bschussek at 2013-01-07T12:35:13Z

@vicb You are right. I added corresponding entries to the CHANGELOG and adapted the above description.

---------------------------------------------------------------------------

by vicb at 2013-01-08T13:39:13Z

@bschussek looking at this PR, I was wondering if an alternate syntax would make sense:

```php
<?php
$reflGraph = new ReflectionGraph($object);

// equivalent to $object->getFoo()->setBar('value')
$reflGraph['foo.bar'] = 'value';

// equivalent to $object->getFoo()->getBar()
$reflGraph['foo.bar'];
```

_Sorry for the off topic_

---------------------------------------------------------------------------

by vicb at 2013-01-08T13:49:46Z

The advantage of using such a `ReflectionGraph` factory is that it might be easier to return specialized reflection graphs, ie optimized instances (that would be cached).

---------------------------------------------------------------------------

by Toflar at 2013-01-08T14:49:54Z

I was also puzzled by the fact that there will be many `ReflectionGraph` instances although they don't have to. I'm with @vicb and I'd also vote for using the constructor to set the subject you're working on. Otherwise you'll repeat yourself over and over again by passing the subject - say `$object` - to `getValue()` or `setValue()`. If however you don't like the constructor thing then why do we have to have an instance of `ReflectionGraph` rather than just go for static methods and use `ReflectionGraph::getValue()` and `ReflectionGraph::setValue()`?

In my opinion there are a few methods that could be static anyway (especially some private ones) :)

But probably I misunderstood something as I'm just about to discover the SF components and don't have any experience working with them (so basically I just read the PR because of @bschussek's tweet :D)

Couldn't come up with any intuitive name for the component though :(
Generally when we talk about "getting" and "setting" values we call those things "mutators"...so `GraphMutator` might be more intuitive than the word `Reflection` :)

---------------------------------------------------------------------------

by Taluu at 2013-01-08T14:57:42Z

I like the last proposition made by @vicb (implementing `ArrayAccess` on `ReflectionGraph` - or whatever name will be chosen (`PathMutator` for example :D), and also specify which object should be worked on in the constructor rather than in each method).

Would this also be used in the `Validator` component ?

---------------------------------------------------------------------------

by stof at 2013-01-08T15:16:12Z

@Toflar A static ``ReflectionGraph::getValue()`` means you have a coupling to the implementation (as with any static call). The current implementation allows you to replace it with your own implementation as long as you implement the interface as it follows the DI pattern (as done in other places in Symfony).

@vicb The issue with ``$reflGraph = new ReflectionGraph($object);`` is that you cannot inject the ReflectionGraph anymore, as you need a new one each time. This would mean adding a ``ReflectionGraphFactory`` to be injected (and which could then be replaced by a factory using code generation). Using the constructor directly would not allow using a replacement based on code generation later. So the resulting code would more likely be

```php

$reflGraph = new ReflectionGraph();

$mutator = $reflGraph->getMutator($object);

// equivalent to $object->getFoo()->setBar('value')
$mutator['foo.bar'] = 'value';

// equivalent to $object->getFoo()->getBar()
$mutator['foo.bar'];
```

Btw, writing this, I find the naming Mutator suggested by @Taluu good when it concerns the setter, but quite weird when getting the value.

---------------------------------------------------------------------------

by Taluu at 2013-01-08T15:21:00Z

I was not the one to suggest though, it was @everzet. But then something like `PathAccessor`, as it is both a mutator and a getter ? I also like @stof suggestion, still in the idea of avoiding to have to put the object as an argument and also allowing to use an `ArrayAccess` interface..

---------------------------------------------------------------------------

by vicb at 2013-01-08T15:21:54Z

@stof your remark makes sense.

What about `Accessor`, the benefit being that it might well be the name of a coming PHP feature: https://wiki.php.net/rfc/propertygetsetsyntax-v1.2

---------------------------------------------------------------------------

by everzet at 2013-01-08T15:27:02Z

```php
$manager = new PropertyManager(new PropertyPath());
$num = $manager->getValue($object, 'foo.num');
$manager->setValue($object, 'foo.num', $num + 1);

$objectManager = new ObjectPropertyManager($object[, $manager]);
$num = $objectManager->getValue('foo.num');
$objectManager->setValue('foo.num', $num + 1);

$objectManager['foo.num'] += 1;
```

---------------------------------------------------------------------------

by bschussek at 2013-01-08T15:28:01Z

It might be me, but I don't like `ArrayAccess` to be misused for features like that. If I access a key in an array access structure, I expect it to be something like a collection, an associative array or a key value store. This class is neither.

Putting that aside, an accessor for a specific object might make sense, but I'm not sure about that yet.

```php
$reflObject->setValue('foo.bar', 'value');
$reflObject->getValue('foo.bar');
```

---------------------------------------------------------------------------

by stof at 2013-01-08T15:28:52Z

@vicb I would vote for PathAccessor then, as we are not doing simple accessor but accessors through a path in an object graph.
In my snippet above, we would then have a ReflectionGraph instance and a PathAccessor instance (``$mutator``).

Btw, I would also keep the methods ``setValue`` and ``getValue``. I find it more clear.

---------------------------------------------------------------------------

by bschussek at 2013-01-08T15:32:07Z

@stof But then we're rather left with the question of ReflectionGraph **vs.** PathAccessor. I don't think that the tiny interface difference (one global, one object-based) justifies the big naming difference.

---------------------------------------------------------------------------

by vicb at 2013-01-08T15:33:24Z

> This class is neither.

It might be `$pa['foo.bar[baz]'] = $pa['foo.bar']['baz'];` I don't know if it would help though.

---------------------------------------------------------------------------

by stof at 2013-01-08T15:35:51Z

@bschussek In my suggestion, ``ReflectionGraph`` is a factory for the PathAccessor objects. It is not accessing anymore itself (which would probably continue to cause issues to implement it with code generation). But the naming could indeed be changed to something else.
2013-01-10 19:35:24 +01:00
Fabien Potencier
f0a66db79a merged branch Seldaek/psr3 (PR #6628)
This PR was merged into the master branch.

Commits
-------

67d7423 Remove use of deprecated HttpKernel LoggerInterface
dca4528 [HttpKernel] Extend psr/log's NullLogger class
1e5a890 [Monolog] Mark old non-PSR3 methods as deprecated
91a86f8 [HttpKernel][Monolog] Add PSR-3 support to the LoggerInterface

Discussion
----------

[HttpKernel][MonologBridge] PSR-3 support

This enables PSR-3 support and monolog 1.3+. The first commit is the main part. The rest deals with deprecation of short-hand methods (warn/err/crit/emerg) that are fully expanded in PSR-3 (warning/error/critical/emergency).

The downside of deprecating them is that for bundles it's a bit harder to support older and newer versions. If that is too much of a hassle you can drop that for now and cherry pick the first commit.

The upside is that it forces people to move towards PSR-3 compatible stuff, which means eventually we could completely drop the LoggerInterface from the framework. In any case I think the documentation should only mention the `Psr\Log\LoggerInterface` and people should start hinting against that. The change should be done in core as well I suppose.

Anyway I wanted to throw this out there as it is to get feedback.

---------------------------------------------------------------------------

by stof at 2013-01-09T09:15:15Z

@Seldaek I also think you should change the typehint to use the PSR LoggerInterface in all classes using the logger

---------------------------------------------------------------------------

by Seldaek at 2013-01-09T09:54:55Z

OK updated according to all the feedback. I tested it in an app and it still seems to work so there shouldn't be any major issues.

---------------------------------------------------------------------------

by Seldaek at 2013-01-09T09:59:55Z

@fabpot if you merge please merge also the bundle PR, otherwise it won't be possible to update without conflict.

---------------------------------------------------------------------------

by frosas at 2013-01-10T14:59:20Z

I'm trying to understand why a `composer update` of a Symfony 2.1.* resulted in a fatal error. Shouldn't a stable version don't break like this?

As @olaurendeau points, why Symfony depends 1.* instead of 1.2.*? Or why Monolog 1.3 breaks its public interface (EDIT: I'm not sure about it)? Or why isn't this PR being merged (into branch 2.1) at the same time Monolog 1.3 is released?

Please, understand I'm not looking for who to blame, it's just I want to know if this situation is unexpected or if otherwise a `composer update` on a stable branch is not as innocent as it seems.

---------------------------------------------------------------------------

by stof at 2013-01-10T15:06:51Z

@frosas it cannot be merged into 2.1 as it is a BC break. The 2.1 branch has been updated to forbid Monolog 1.3 already

---------------------------------------------------------------------------

by Seldaek at 2013-01-10T15:11:58Z

@frosas you can blame me for releasing as 1.3.0 and not 2.0, but technically for monolog this isn't really a BC break, I just added an interface. The problem is due to the way it's used in symfony, it ended up as a fatal error. In any case the situation is now sorted out I think.

---------------------------------------------------------------------------

by frosas at 2013-01-10T15:26:43Z

@stof now I see this `>=1.0,<1.3-dev` change in the 2.1 branch. Now, shouldn't a new (2.1.7) version be released for all of us not in the dev minimum-stability?

@Seldaek then do you see feasible to rely only in X.Y.* versions to avoid this kind of errors?

---------------------------------------------------------------------------

by Seldaek at 2013-01-10T15:45:22Z

@frosas relying on X.Y.* is painful because you always need to wait until someone updates the constraint to get the new version. Of course using ~1.3 like in this PR means if I fuck up and break BC people will update to it, but that's a less likely occurrence than the alternative I think, so I would rather not use X.Y.*

---------------------------------------------------------------------------

by frosas at 2013-01-10T15:50:50Z

@Seldaek you are right about this, but I was thinking more in changing it only for the stable versions. EDIT: I mean, how often do you need a new feature in a branch you only apply fixes to?

---------------------------------------------------------------------------

by stof at 2013-01-10T15:57:32Z

@frosas Monolog and Symfony have separate release cycles. Foorcing Symfony users to use an old version of Monolog until they update to a new version of Symfony whereas the newer Monolog is compatible is a bad idea. Thus, as Monolog keeps BC, it does not maintain bugfix releases for all older versions (just like Twig does too). So it would also forbid you to get the fixes done in newer Monolog versions.

The incompatibility between Symfony 2.1 LoggerInterface and PSR-3 (whereas they expect exactly the same behavior and signature for methods with the same name) is unfortunate and is the reason why we get some issues here.

---------------------------------------------------------------------------

by frosas at 2013-01-10T16:21:06Z

@stof I appreciate you prefer to allow newer versions at the price of having to be constantly monitoring its changes to avoid breaks.

Another similar but safer strategy would be to stick to X.Y.* versions and upgrade to X.Y+1.* once the new version integration is tested, but I understand this is discutible in projects as close to Symfony as Monolog.

Returning to the issue, what do you say to release this 2.1.7 version? Or is it only me who is having issues here?

---------------------------------------------------------------------------

by stof at 2013-01-10T16:26:20Z

@frosas a minor release should not break BC when following smeantic versionning (Symfony warned about the fact it is not strictly followed for the first releases of 2.x). But as far as monolog is concerned, 1.3 is BC with 1.2.

---------------------------------------------------------------------------

by Seldaek at 2013-01-10T16:49:55Z

@frosas sorry I didn't get you still had the problem. I tagged a 2.1.7 of monologbundle which hopefully fixes your issue.
2013-01-10 17:57:14 +01:00
Bernhard Schussek
1bae7b242c [PropertyAccess] Extracted PropertyAccess component out of Form 2013-01-10 09:49:37 +01:00
Jordi Boggiano
67d7423456 Remove use of deprecated HttpKernel LoggerInterface 2013-01-09 10:52:29 +01:00
Fabien Potencier
b33d5bc352 removed the .gitattributes files (closes #6605, reverts #5674) 2013-01-09 09:51:07 +01:00
Fabien Potencier
f07c61d25c merged branch bschussek/issue5844 (PR #6137)
This PR was merged into the master branch.

Commits
-------

586a16e [Validator] Changed DefaultTranslator::getLocale() to always return 'en'
58bfd60 [Validator] Improved the inline documentation of DefaultTranslator
cd662cc [Validator] Added ExceptionInterface, BadMethodCallException and InvalidArgumentException
e00e5ec [Validator] Fixed failing test
cc0df0a [Validator] Changed validator to support pluralized messages by default
56d61eb [Form][Validator] Added BC breaks in unstable code to the CHANGELOG
1e34e91 [Form] Added upgrade instructions to the UPGRADE file
b94a256 [DoctrineBridge] Adapted DoctrineBridge to translator integration in the validator
c96a051 [FrameworkBundle] Adapted FrameworkBundle to translator integration in the validator
92a3b27 [TwigBridge] Adapted TwigBridge to translator integration in the validator
e7eb5b0 [Form] Adapted Form component to translator integration in the validator
46f751c [Validator] Extracted message interpolation logic of ConstraintViolation and used the Translation component for that

Discussion
----------

[Validator] Integrated the Translator in the Validator component

Bug fix: no
Feature addition: no
Backwards compatibility break: yes
Symfony2 tests pass: yes
Fixes the following tickets: #5844, #6117
Todo: -
License of the code: MIT
Documentation PR: -

This PR allows to replace the default message substitution strategy in the validator (`strtr()`) by passing an implementation of `Symfony\Component\Translation\TranslatorInterface`. The motivation for this are both #5844 and the need to replace the translation strategy in Drupal's integration of the Validator.

In the stand-alone usage of the validator, both the translator and the default translation domain can now be passed to `ValidatorBuilderInterface`:

```php
$validator = Validation::createValidatorBuilder()
    ->setTranslator(new MyTranslator())
    ->setTranslationDomain('validators')
    ->getValidator();
```

References:

* #5844
* #6117
* #6129
* [Add a validation framework to Drupal 8](http://drupal.org/node/1845546)
* [Add the symfony validator component to core despite Symfony potentially releasing BC-breaking updates after 2.3.](http://drupal.org/node/1849564)

---------------------------------------------------------------------------

by Tobion at 2012-11-28T08:53:25Z

no BC break? Looking at ValidatorBuilderInterface there is definitely one.

---------------------------------------------------------------------------

by bschussek at 2012-11-28T08:55:01Z

ValidatorBuilderInterface is not part of the stable API. You are not supposed to implement this interface.

---------------------------------------------------------------------------

by Tobion at 2012-11-28T09:01:07Z

We're not only documenting bc breaks for stable API, otherwise we could remove 90% of the upgrade file since few methods are tagged with API.
An interface that nobody should implement?

---------------------------------------------------------------------------

by bschussek at 2012-11-28T09:30:02Z

The question is what to consider a BC break. Something will always break for someone. Should we consequently mark everything as BC break? I don't think so.

For example, since 2.1, you are supposed to use `Validation::createValidator*()` for creating a validator. Because of that, I won't consider changing the constructor signature of `Validator` a BC break anymore from 2.1 on.

The same for the unstable interfaces. These are currently meant to be used only, that is, type hint against them and call their methods. But we don't guarantee that we won't add methods to them.

---------------------------------------------------------------------------

by Tobion at 2012-11-28T09:38:19Z

I agree that almost any change could be considered a BC break. So we probably need to better define what a BC break is and what not. Otherwise Symfony will stop evolving after 2.3 because from then on Fabien wanted to prevent BC breaks which is almost impossible in a strict definition of bc break.

---------------------------------------------------------------------------

by fabpot at 2012-11-28T11:37:22Z

BC breaks should always be documented, and we guarantee BC only for things tagged with @api. I'm going to update the docs to make things clearer.

---------------------------------------------------------------------------

by bschussek at 2012-11-28T13:09:57Z

@fabpot I documented these changes now in the CHANGELOG: af99ebb1206ac92889b7193ba1ecc12bf2617e85

Are we sure we want to document *all* BC breaks from now on, even in non-@api code? This could rather scare people looking at our changelogs (lots of BC BREAKS there).

---------------------------------------------------------------------------

by fago at 2012-11-28T17:29:58Z

Unfortunately, it turns out the symfony translator interface does not mach the Drupal translation system as well as we initally thought, see http://drupal.org/node/1852106. Given that, this would integrating the validator component into Drupal even harder, because it introduces the dependency on the (unwanted) translation component. :(

---------------------------------------------------------------------------

by stof at 2012-11-28T18:19:36Z

If this does not help Drupal anyway, maybe #5844 is a better way to manage translations for people using the validator outside forms ?
and the Drupal guys would simply follow a similar approach, but based on their own translator instead of the symfony one.

---------------------------------------------------------------------------

by fago at 2012-11-28T18:50:12Z

Yeah. The only problem I see with the approach of #5844 is that *after* validation only the translated messages are available. We'd need to have access to the untranslated messages also.

---------------------------------------------------------------------------

by fago at 2012-11-29T09:49:47Z

As our translation system handles translating pluralized messages differently, the current ExecutionContextInterface::addViolation() method poses a problem also. We need to pass on - both the single and plural - message, as the message gets chosen during translation, see http://api.drupal.org/api/drupal/core!includes!common.inc/function/format_plural/8
So maybe, we could allow adding an already created ConstraintViolation object also? Then, we could implement a "PluralConstraintViolation" class that takes both message templates.

---------------------------------------------------------------------------

by bschussek at 2012-12-03T15:52:36Z

I updated this PR to support pluralized messages by default in the validator. This should solve the problem of the Drupal guys, because their implementation of `TranslatorInterface::transChoice($id, $number, ...)` can now simply split the $id by pipes (`|`) and pass the parts to their own `format_plural($count, $singular, $plural, ...)` function.

For us, it breaks BC because translation catalog sources had to be adapted.

---------------------------------------------------------------------------

by fabpot at 2012-12-03T16:25:52Z

Most of the XLF files are broken (the end is missing now).

IIUC, we now have a hard dependency on the Translation component, which is something we wanted to avoid.

---------------------------------------------------------------------------

by fabpot at 2012-12-03T16:27:56Z

Oops, clicked on the "comment" button too fast.

So, the dependency is hard (you need to install the dep) but light as we only rely on the translation interface from the component (when using the default translator). It looks acceptable to me, especially because we now use Composer to manage dependencies.

---------------------------------------------------------------------------

by bschussek at 2012-12-03T16:54:10Z

@fabpot Thanks for the hint. Going to fix this.

---------------------------------------------------------------------------

by bschussek at 2012-12-04T11:34:43Z

@fabpot Fixed.

---------------------------------------------------------------------------

by bschussek at 2012-12-07T12:40:24Z

Is there anything missing for this PR to be merged?
2013-01-09 09:22:50 +01:00
Fabien Potencier
aba96c7cae Merge branch '2.1'
* 2.1:
  [Console] Fix style escaping parsing
  [Console] Make style formatter matching less greedy to avoid having to escape when not needed
  [Bundle] [FrameworkBundle] fixed indentation in esi.xml services file.
  [Component] [Security] fixed PSR-2 coding violation in ClassUtilsTest class.
  [Form] Fixed EntityChoiceList when loading objects with negative integer IDs
  [TwigBundle] There is no CSS visibility of display, should be visible instead
  [Form] corrected source node for a Danish translation
  [DependencyInjection] fixed a bug where the strict flag on references were lost (closes #6607)
  [HttpFoundation] Check if required shell functions for `FileBinaryMimeTypeGuesser` are not disabled
  [CssSelector] added css selector with empty string
  [HttpFoundation] Docblock for Request::isXmlHttpRequest() now points to Wikipedia
  [DependencyInjection] refactored code to avoid logic duplication
  [Form] Deleted references in FormBuilder::getFormConfig() to improve performance
  [HttpFoundation] Update docblock for non-working method

Conflicts:
	src/Symfony/Bundle/TwigBundle/Resources/views/Exception/trace.html.twig
	src/Symfony/Bundle/TwigBundle/Resources/views/Exception/traces.html.twig
2013-01-08 19:17:41 +01:00
Bernhard Schussek
b94a256cc7 [DoctrineBridge] Adapted DoctrineBridge to translator integration in the validator 2013-01-08 14:43:29 +01:00
Bernhard Schussek
55aa0120cf [Form] Fixed EntityChoiceList when loading objects with negative integer IDs 2013-01-08 11:08:32 +01:00
Bernhard Schussek
fee1bf5448 [Form] Introduced base ExceptionInterface 2013-01-07 16:58:41 +01:00
Bernhard Schussek
184c8e586f Fixed @expectedException definitions to reference absolute exception paths 2013-01-05 18:52:40 +01:00
Fabien Potencier
31ff3db517 Merge branch '2.1'
* 2.1: (24 commits)
  updated license year
  Update src/Symfony/Component/HttpFoundation/Response.php
  [Form] Fixed inheritance of "error_bubbling" in RepeatedType
  [Form] Fixed DateType when used with the intl extension disabled.
  [HttpFoundation] fix return types and handling of zero in Response
  [HttpFoundation] better fix for non-parseable Expires header date
  Fixed missing plural message in portuguese validator
  Fix Expires when the header is -1
  [DoctrineBridge] Allowing memcache port to be 0 to support memcache unix domain sockets.
  [Console] fixed unitialized properties (closes #5935)
  [Process] Prevented test from failing when pcntl extension is not enabled.
  Revert "[DoctrineBridge] Improved performance of the EntityType when used with the "query_builder" option"
  [Form] Fixed failing tests for DateTimeToStringTransformer.
  [Locale] Fixed the StubLocaleTest for ICU versions lower than 4.8.
  [Bundle] [FrameworkBundle] fixed typo in phpdoc of the SessionListener.
  [Form] Fixed test regression introduced in #6440
  [Tests] Fix namespaces
  Fixed php doc of GenericEvent::__construct
  HttpUtils must handle RequestMatcher too
  use preferred_choices in favor of preferred_query
  ...

Conflicts:
	src/Symfony/Bridge/Propel1/Form/ChoiceList/ModelChoiceList.php
2013-01-04 18:02:19 +01:00
Fabien Potencier
8349816dc5 Merge branch '2.0' into 2.1
* 2.0:
  updated license year
  Update src/Symfony/Component/HttpFoundation/Response.php
  [Console] fixed unitialized properties (closes #5935)
  [Bundle] [FrameworkBundle] fixed typo in phpdoc of the SessionListener.
  bumped Symfony version to 2.0.21-DEV
  updated VERSION for 2.0.21
  updated CHANGELOG for 2.0.21

Conflicts:
	src/Symfony/Bundle/SwiftmailerBundle/LICENSE
	src/Symfony/Component/Filesystem/LICENSE
	src/Symfony/Component/HttpFoundation/Response.php
	src/Symfony/Component/HttpKernel/Kernel.php
2013-01-04 18:00:54 +01:00
Fabien Potencier
df5c171490 updated license year 2013-01-04 17:59:43 +01:00
Fabien Potencier
18856428b6 updated license year 2013-01-04 17:58:00 +01:00
Tammy D
c282a2bf15 [DoctrineBridge] Allowing memcache port to be 0 to support memcache unix domain sockets. 2012-12-31 09:26:26 -08:00
Fabien Potencier
1d395ad16d Revert "[DoctrineBridge] Improved performance of the EntityType when used with the "query_builder" option"
This reverts commit b604eb7b52.

Conflicts:
	src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php
2012-12-29 23:35:33 +01:00
Florin Patan
c2acc6c2cb Fixed most of the docblocks/unused namespaces 2012-12-19 08:09:49 +01:00
Fabien Potencier
e3cc337b00 merged branch colinfrei/deprecationErrors (PR #6180)
This PR was merged into the master branch.

Commits
-------

6b10550 Merge branch 'master' of github.com:symfony/symfony into deprecationErrors
1d82112 [Form] Fix two cases where deprecated methods were being used
b8cdbdc [Form] Catch deprecation errors that are caused by BC code
ebcb432 [Form] [FrameworkBundle] catch deprecation errors in tests
c21b12e [Form] handle BC use of deprecated stuff in non-test-methods.
fc2be6d [Form] catch deprecated errors in tests
800a032 [Form] replace bindRequest() with bind(), as bindRequest is deprecated
d5b2638 [Form] Trigger errors for deprecated methods in Form Component
f3d6966 [Validator] Stop using deprecated methods
d57ad32 [Form] Catch deprecation errors when using deprecated methods/classes in tests
3241157 [Validator] Trigger errors for deprecations
1f9eb7f return value of handleError
b35de9e Handle errors using a custom error handler
f49704b trigger errors for deprecated methods in HttpFoundation component

Discussion
----------

trigger_error() for deprecations

See also #6173 and #6139.

Started triggering errors in the HttpFoundation component.
It seems as if most of the time the error is just duplicating the text in the @deprecation comment.

Any opinions on if duplicating the text is acceptable, or if fetching the comment text to output the error makes sense?

---------------------------------------------------------------------------

by Seldaek at 2012-12-04T13:39:42Z

IMO it's fine to just duplicate the `@deprecated` note in the message, since anyway this code is meant to be completely deleted, this duplication should not do much harm.

---------------------------------------------------------------------------

by fabpot at 2012-12-06T08:22:21Z

@colinfrei I've merged PR #6173. Do you have time to implement the `trigger_error()` call everywhere? Thanks.

---------------------------------------------------------------------------

by colinfrei at 2012-12-06T08:36:55Z

Yep I'll finish that, probably until the beginning of next week.

---------------------------------------------------------------------------

by bschussek at 2012-12-10T10:15:12Z

Thank you for working on this!

---------------------------------------------------------------------------

by fabpot at 2012-12-12T11:08:53Z

@colinfrei: Is this PR finished? Can I merge it?

---------------------------------------------------------------------------

by colinfrei at 2012-12-12T12:09:19Z

@fabpot not quite - I lost some work due to a computer crash over the weekend. The only thing open is fixing the tests  for the Form Component and catching the cases where the Form Component intentionally uses deprecated stuff.

---------------------------------------------------------------------------

by colinfrei at 2012-12-15T07:32:28Z

@fabpot - finished adding trigger_errors and catching them in Tests and as needed.
Travis is failing, but that seems to be master being broken due to the Finder changes?

I changed a few cases where the code was using deprecated methods which wasn't necessary in my eyes, specifically   1d8211249b, 800a032f07, f3d696636a
2012-12-15 08:53:57 +01:00
Colin Frei
6b105504f4 Merge branch 'master' of github.com:symfony/symfony into deprecationErrors 2012-12-14 23:30:36 +01:00
Pascal Borreli
60eeacd2d1 Fixed typos 2012-12-14 22:27:02 +00:00
Colin Frei
d5b2638ff4 [Form] Trigger errors for deprecated methods in Form Component 2012-12-12 17:43:13 +01:00
Fabien Potencier
3c010db2cb Merge branch '2.1'
* 2.1:
  fixed CS
  fixed CS
  [Security] fixed path info encoding (closes #6040, closes #5695)
  [HttpFoundation] added some tests for the previous merge and removed dead code (closes #6037)
  Improved Cache-Control header when no-cache is sent
  removed unneeded comment
  Fix to allow null values in labels array
  fix date in changelog
  removed the Travis icon (as this is not stable enough -- many false positive, closes #6186)
  Revert "merged branch gajdaw/finder_splfileinfo_fpassthu (PR #4751)" (closes #6224)
  Fixed a typo
  Fixed: HeaderBag::parseCacheControl() not parsing quoted zero correctly
  [Form] Fix const inside an anonymous function
  [Config] Loader::import must return imported data
  [DoctrineBridge] Fixed caching in DoctrineType when "choices" or "preferred_choices" is passed
  [Form] Fixed the default value of "format" in DateType to DateType::DEFAULT_FORMAT if "widget" is not "single_text"
  [HttpFoundation] fixed a small regression

Conflicts:
	src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php
2012-12-11 11:41:51 +01:00
Fabien Potencier
7f3be5c49d fixed CS 2012-12-11 11:40:22 +01:00
Bernhard Schussek
ca5d9acb19 [DoctrineBridge] Fixed caching in DoctrineType when "choices" or "preferred_choices" is passed 2012-12-07 13:39:00 +01:00
Fabien Potencier
6e45f1cd78 Merge branch '2.1'
* 2.1:
  [HttpFoundation] changed UploadedFile::move() to use move_uploaded_file() when possible (closes #5878, closes #6185)
  [HttpFoundation] added a check for the host header value
  [DoctrineBridge] Improved performance of the EntityType when used with the "query_builder" option
  [DoctrineBridge] Improved exception message
  [DoctrineBridge] Fixed: Exception is thrown if the entity class is not known to Doctrine
  Removed useless branch alias for dev-master in composer.json

Conflicts:
	composer.json
	src/Symfony/Bridge/Doctrine/composer.json
	src/Symfony/Bridge/Monolog/composer.json
	src/Symfony/Bridge/Propel1/composer.json
	src/Symfony/Bridge/Swiftmailer/composer.json
	src/Symfony/Bridge/Twig/composer.json
	src/Symfony/Bundle/FrameworkBundle/composer.json
	src/Symfony/Bundle/SecurityBundle/composer.json
	src/Symfony/Bundle/TwigBundle/composer.json
	src/Symfony/Bundle/WebProfilerBundle/composer.json
	src/Symfony/Component/BrowserKit/composer.json
	src/Symfony/Component/ClassLoader/composer.json
	src/Symfony/Component/Config/composer.json
	src/Symfony/Component/Console/composer.json
	src/Symfony/Component/CssSelector/composer.json
	src/Symfony/Component/DependencyInjection/composer.json
	src/Symfony/Component/DomCrawler/composer.json
	src/Symfony/Component/EventDispatcher/composer.json
	src/Symfony/Component/Filesystem/composer.json
	src/Symfony/Component/Finder/composer.json
	src/Symfony/Component/Form/composer.json
	src/Symfony/Component/HttpFoundation/composer.json
	src/Symfony/Component/HttpKernel/composer.json
	src/Symfony/Component/Locale/composer.json
	src/Symfony/Component/OptionsResolver/composer.json
	src/Symfony/Component/Process/composer.json
	src/Symfony/Component/Routing/composer.json
	src/Symfony/Component/Security/composer.json
	src/Symfony/Component/Serializer/composer.json
	src/Symfony/Component/Templating/composer.json
	src/Symfony/Component/Translation/composer.json
	src/Symfony/Component/Validator/composer.json
	src/Symfony/Component/Yaml/composer.json
2012-12-07 10:33:24 +01:00
Colin Frei
f3d696636a [Validator] Stop using deprecated methods 2012-12-06 21:41:54 +01:00
Fabien Potencier
6be1d29a3d merged branch bschussek/issue6141 (PR #6206)
This PR was merged into the 2.1 branch.

Commits
-------

b604eb7 [DoctrineBridge] Improved performance of the EntityType when used with the "query_builder" option
db2ee54 [DoctrineBridge] Improved exception message
99321cb [DoctrineBridge] Fixed: Exception is thrown if the entity class is not known to Doctrine

Discussion
----------

[DoctrineBridge] fixed caching when EntityType is used with the "query_builder" option

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
License of the code: MIT
Documentation PR: -
2012-12-06 15:43:13 +01:00
Bernhard Schussek
b604eb7b52 [DoctrineBridge] Improved performance of the EntityType when used with the "query_builder" option 2012-12-06 13:37:46 +01:00
Bernhard Schussek
db2ee54bda [DoctrineBridge] Improved exception message 2012-12-06 13:35:16 +01:00
Bernhard Schussek
99321cbe24 [DoctrineBridge] Fixed: Exception is thrown if the entity class is not known to Doctrine 2012-12-06 13:35:16 +01:00
Martin Hasoň
10e5f3b3df Removed useless branch alias for dev-master in composer.json 2012-12-06 11:00:55 +01:00
Fabien Potencier
18495e7b3c Merge branch '2.1'
* 2.1: (29 commits)
  [DependencyInjection] fixed composer.json
  [Validator] Fix typos in validators.ru.xlf
  Edited some minor grammar and style errors in russian validation file
  Updated Bulgarian translation
  [Form] improve error message with a "hasser" hint for PropertyAccessDeniedException
  [Form] Updated checks for the ICU version from 4.5+ to 4.7+ due to test failures with ICU 4.6
  [Form] simplified a test from previous merge
  Update src/Symfony/Component/Form/Extension/Core/Type/FileType.php
  fixed CS
  Xliff with other node than source or target are ignored
  small fix of #5984 when the container param is not set
  Filesystem Component mirror symlinked directory fix
  [Process][Tests] fixed chainedCommandsOutput tests
  fixed CS
  Use better default ports in urlRedirectAction
  Add tests for urlRedirectAction
  info about session namespace
  fix upgrade info about locale
  Update src/Symfony/Component/DomCrawler/Tests/FormTest.php
  Update src/Symfony/Component/DomCrawler/Form.php
  ...
2012-11-29 11:32:45 +01:00
Fabien Potencier
ee90986c9f merged branch bschussek/drupal-validator (PR #6096)
This PR was merged into the master branch.

Commits
-------

1858b96 [Form] Adapted FormValidator to latest changes in the Validator
1f752e8 [DoctrineBridge] Adapted UniqueValidator to latest changes in the Validator
efe42cb [Validator] Refactored the GraphWalker into an implementation of the Visitor design pattern.

Discussion
----------

[Validator] Refactored the Validator for use in Drupal

Bug fix: no
Feature addition: no
Backwards compatibility break: yes
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
License of the code: MIT
Documentation PR: TODO

Drupal wants to use the Symfony Validator component in their next version. I was talking to @fago recently about the changes that we'd need to make and implemented these changes in this PR. I don't want to rush this, but the deadline is tight, since Drupal feature freeze is on December 1st and @fago needs at least a couple of days to integrate the Validator into Drupal.

This PR introduces two significant changes:

* Interfaces were created for all classes that constitute the Validator's API. This is were the PR breaks BC, because `ConstraintValidatorInterface::initialize()` is now type hinted against `ExecutionContextInterface` instead of `ExecutionContext`.

* The graph walker was refactored into an implementation of the Visitor pattern. This way, the validator was decoupled from the structure of the metadata (class → properties and getter methods) and makes it possible to implement a different metadata structure, as is required by the Drupal Entity API.

As a consequence of the API change, custom validation code is now much easier to write, because `ValidatorInterface` and `ExecutionContextInterface` share the following set of methods:

```php
interface ValidatorInterface
{
    public function validate($value, $groups = null, $traverse = false, $deep = false);
    public function validateValue($value, $constraints, $groups = null);
    public function getMetadataFor($value);
}

interface ExecutionContextInterface
{
    public function validate($value, $subPath = '', $groups = null, $traverse = false, $deep = false);
    public function validateValue($value, $constraints, $subPath = '', $groups = null);
    public function getMetadataFor($value);
}
```

No more juggling with property paths, no more fiddling with the graph walker. Just call on the execution context what you'd call on the validator and you're done.

There are two controversial things to discuss and decide (cc @fabpot):

* I moved the `@api` tags of all implementations to the respective interfaces. Is this ok?
* I would like to deprecate `ValidatorInterface::getMetadataFactory()` (tagged as `@api`) in favor of the added `ValidatorInterface::getMetadataFor()`, which offers the exact same functionality, but with a different API and better encapsulation, which makes it easier to maintain for us. We can tag `getMetadataFor()` as `@api`, as I don't expect it to change. Can we do this or should we leave the old method in?

I would like to decide the major issues of this PR until **Sunday November 25th** in order to give @fago enough room for his implementation.

Let me hear your thoughts.
2012-11-24 13:18:53 +01:00
Bernhard Schussek
1f752e866e [DoctrineBridge] Adapted UniqueValidator to latest changes in the Validator 2012-11-24 13:00:33 +01:00
Fabien Potencier
6831a3d1c5 merged branch sterrien/patch-1 (PR #5842)
This PR was merged into the 2.0 branch.

Commits
-------

2d9a6fc Use Norm Data instead of Data

Discussion
----------

[Form] Use Norm Data instead of App Data

This listener is triggered when normalized data are binded.

We have to use $event->getForm()->getNormData() instead of $event->getForm()->getData().

I have made a new FormType having 'entity' as parent and having a NormTransformer. I encountered a problem in MergeCollectionListener when the request is binded.

My commit fix it.
2012-11-24 12:53:16 +01:00
Mario A. Alvarez Garcia
644de740c4 Fix docblock in Doctrine Bridge 2012-11-16 12:36:52 -05:00
Thomas Tourlourat
82334d2640 Force loader to be null or a EntityLoaderInterface 2012-11-15 16:44:00 +01:00
Fabien Potencier
b126664406 Merge branch '2.1'
* 2.1: (24 commits)
  forced Travis to use source to workaround their not-up-to-date Composer on PHP 5.3.3
  [Routing] removed irrelevant string cast in Route
  Fixed typo
  Make YamlFileLoader and XmlFileLoader file loading extensible
  [HttpKernel] fix typo
  Fixed singularization of "prices"
  [Form] Removed an exception that prevented valid formats from being passed, e.g. "h" for the hour, "L" for the month etc.
  [HttpKernel] fixed Client when using StreamedResponses (closes #5370)
  fixed PDO session handler for Oracle (closes #5829)
  [HttpFoundation] fixed PDO session handler for Oracle (closes #5829)
  [Locale] removed a check that is done too early (and it is done twice anyways)
  Update src/Symfony/Component/Validator/Resources/translations/validators.fa.xlf
  Adding new localized strings for farsi validation.
  [HttpFoundation] moved the HTTP protocol check from StreamedResponse to Response (closes #5937)
  [Form] Fixed forms not to be marked invalid if their children are already marked invalid
  [Form] Excluded some tests in NumberToLocalizedStringTransformerTest which fail on ICU 4.4, but work on ICU 4.8
  added missing tests from previous merge
  [Form] Fixed NumberToLocalizedStringTransformer to accept both comma and dot as decimal separator, if possible
  Fix export-ignore on Windows
  Show correct class name InputArgument in error message
  ...

Conflicts:
	.travis.yml
	src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php
2012-11-13 15:08:04 +01:00
Fabien Potencier
061421b3b5 fixed typo 2012-11-10 19:41:36 +01:00
Fabien Potencier
e621b6f169 fixed wrong merge 2012-11-10 09:21:13 +01:00
Fabien Potencier
2a156cf9f4 merged branch fabpot/tests-in-components (PR #5958)
This PR was merged into the master branch.

Commits
-------

b27b749 made usage of Composer autoloader for subtree-split unit tests

Discussion
----------

made usage of Composer autoloader for subtree-split unit tests

This PR also normalizes the way components are tested.

---------------------------------------------------------------------------

by stof at 2012-11-09T23:14:22Z

👍
2012-11-10 09:20:22 +01:00
Fabien Potencier
b27b749025 made usage of Composer autoloader for subtree-split unit tests 2012-11-09 14:10:06 +01:00
Fabien Potencier
6b54a51963 moved the Stopwatch classes to their own component 2012-11-09 10:08:25 +01:00
Fabien Potencier
dd23f6c418 merged branch gajdaw/gitattributes-windows (PR #5938)
This PR was merged into the 2.1 branch.

Commits
-------

646a714 Fix export-ignore on Windows

Discussion
----------

Fix export-ignore on Windows

Rules:

    Tests/ export-ignore

don't work on Windows. My proposition is:

    /Tests export-ignore
2012-11-09 09:52:51 +01:00
Fabien Potencier
e425f6cf9a Merge branch '2.0' into 2.1
* 2.0:
  [Form] Fixed NumberToLocalizedStringTransformer to accept both comma and dot as decimal separator, if possible
  Show correct class name InputArgument in error message
  shows correct class name InputOption in error message
  The exception message should say which field is not mapped
  [HttpFoundation] Fix name sanitization after perfoming move
  Add check to Store::unlock to ensure file exists

Conflicts:
	src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php
	src/Symfony/Component/HttpFoundation/File/UploadedFile.php
	tests/Symfony/Tests/Component/Console/Input/InputArgumentTest.php
	tests/Symfony/Tests/Component/Console/Input/InputOptionTest.php
	tests/Symfony/Tests/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php
	tests/Symfony/Tests/Component/HttpFoundation/File/FileTest.php
	tests/Symfony/Tests/Component/HttpKernel/HttpCache/StoreTest.php
2012-11-08 18:02:05 +01:00
Włodzimierz Gajda
646a714ded Fix export-ignore on Windows 2012-11-08 10:51:48 +01:00
Miha Vrhovnik
6b42c8cc04 The exception message should say which field is not mapped 2012-10-28 23:16:09 +01:00
Fabien Potencier
7b998d9b2d Merge branch '2.1'
* 2.1:
  [ClassLoader] fixed unbracketed namespaces (closes #5747)
  slight refactoring in UrlMatcher
  [Form] Created test for DoctrineOrmTypeGuesser see #5790
  [Form] Fixed DoctrineOrmTypeGuesser to guess the "required" option for to-one associations
2012-10-27 17:59:37 +02:00
Fabien Potencier
e3ceb56b48 merged branch Burgov/doctrine_orm_type_guesser_tests (PR #5793)
This PR was merged into the 2.1 branch.

Commits
-------

5d2525b [Form] Created test for DoctrineOrmTypeGuesser see #5790
b844d6b [Form] Fixed DoctrineOrmTypeGuesser to guess the "required" option for to-one associations

Discussion
----------

[Form] Doctrine orm type guesser tests

This PR adds tests to https://github.com/symfony/symfony/pull/5790

---------------------------------------------------------------------------

by Tobion at 2012-10-20T10:53:56Z

Using real test entities would be better IMO. Using mocks ties it pretty much to the implementation.

---------------------------------------------------------------------------

by sstok at 2012-10-21T10:38:53Z

@Tobion thats true, but Doctrine Class meta data takes quite some coding to set-up.
For instance you need the EntityManager to get even get the meta data set!

So you'd end having more code to set-up then your actually testing.

---------------------------------------------------------------------------

by Burgov at 2012-10-21T12:58:58Z

I wasn't sure whether do use a test entity manager, or do it the way I finally did it.

@sstok true, it's quite some work to set it up, but on the other hand there's the base OrmTestCase class which does it for you, so it'd actually mean I'd only have to create one entity for all the cases: https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Doctrine/Tests/DoctrineOrmTestCase.php

@Tobion on the other hand I tend to use a test EM only when I actually need to test persisting and loading, while this test case here is so isolated that I didn't really feel it would be necessary.

I'd like to know which method is preferred though, I'll change it if necessary, and other tests can be added to test the rest of this specific class
2012-10-27 15:36:11 +02:00
Simon Terrien
2d9a6fcc19 Use Norm Data instead of Data
This listener is triggered when normalized data are binded.

We have to use $event->getForm()->getNormData() instead of $event->getForm()->getData().
2012-10-26 12:03:13 +03:00
Fabien Potencier
67d9253127 Merge branch '2.1'
* 2.1:
  added missing use statment (closes #5825)
  Code cleanup
  [WebProfilerBundle] Fixed the use of nested macros
  Removed unused use statements.
  Nsdocblocks
  [ConfigDumpReference] avoid notice for variable nodes
  fixed fallback locale
  UniqueValidatorTest, Change message on assertions
  Documented removed _form_is_choice_group function

Conflicts:
	src/Symfony/Bundle/FrameworkBundle/Command/ConfigDumpReferenceCommand.php
	src/Symfony/Bundle/WebProfilerBundle/Profiler/TemplateManager.php
2012-10-24 17:41:27 +02:00
Stano Turza
11ba41bb17 added missing use statment (closes #5825) 2012-10-24 17:10:37 +02:00
Bart van den Burg
5d2525b082 [Form] Created test for DoctrineOrmTypeGuesser
see #5790
2012-10-20 12:37:21 +02:00
Bernhard Schussek
b844d6be09 [Form] Fixed DoctrineOrmTypeGuesser to guess the "required" option for to-one associations 2012-10-19 19:36:52 +02:00
Gilles Gauthier
602a5eb3f4 UniqueValidatorTest, Change message on assertions 2012-10-19 13:20:42 +02:00
Danny Berger
3d2a7db61e Fix a few namespaces to match file system. 2012-10-13 13:20:28 -06:00
Fabien Potencier
5956f9f2b4 Merge branch '2.1'
* 2.1:
  fixed CS
  added doc comments
  added doc comments
  [Validator] Updated swedish translation
  Update src/Symfony/Component/Validator/Resources/translations/validators.de.xlf
  [2.1] Exclude tests from zips via gitattributes
  [HttpKernel][Translator] Fixed type-hints
  Updated lithuanian validation translation
  [DomCrawler] Allows using multiselect through Form::setValues().
  [Translation] forced the catalogue to be regenerated when a resource is added (closes symfony/Translation#1)
  Unit test for patched method OptionsResolver::validateOptionValues().
  validateOptionValues throw a notice if an allowed value is set and the corresponding option isn't.
  [Form] Hardened code of ViolationMapper against errors
  [HttpFoundation] Fixed #5611 - Request::splitHttpAcceptHeader incorrect result order.
  [Form] Fixed negative index access in PropertyPathBuilder
  Update src/Symfony/Component/Validator/Resources/translations/validators.ro.xlf

Conflicts:
	src/Symfony/Component/DomCrawler/Form.php
	src/Symfony/Component/Process/Process.php
2012-10-06 21:57:59 +02:00
Igor Wiedler
462dddfac9 [2.1] Exclude tests from zips via gitattributes 2012-10-04 17:17:57 +02:00
Fabien Potencier
0bfa86ce8a Merge branch '2.1'
* 2.1:
  [2.1] Fix SessionHandlerInterface autoloading
  Remove executable bit from HttpKernel/DependencyInjection/ConfigurableExtension.php
  [2.0][http-foundation] Fix Response::getDate method
  [DoctrineBridge] Require class option for DoctrineType
  [HttpFoundation] fixed the path to the SensioHandlerInterface class in composer.json
  Support the new Microsoft URL Rewrite Module for IIS 7.0. @see http://framework.zend.com/issues/browse/ZF-4491 @see http://framework.zend.com/code/revision.php?repname=Zend+Framework&rev=24842
  fixed undefined variable
  hasColorSupport does not take an argument
  Improve FilterResponseEvent docblocks Response ref
2012-10-02 12:23:35 +02:00
Jeremy Mikola
3cc3c67e5a [DoctrineBridge] Require class option for DoctrineType 2012-09-29 16:16:47 -07:00
Filippo Tessarotto
45bf52358e Optimize autoload prefix in composer.json
By having more specific autoload prefixes it is possible to reduce the
number of stat calls made. Also it prevents conflicts with similar
namespaces.
2012-09-28 09:34:16 +02:00
Fabien Potencier
2ceebdcaba fixed stringification of array objects in RequestDataCollector (closes #5295) 2012-09-21 08:32:55 +02:00
Fabien Potencier
13937de2c8 replaced self.version/2.1.* by 2.2.* in composer.json files 2012-09-10 12:59:37 +02:00
Fabien Potencier
a9a0f420e2 merged 2.1 2012-09-10 12:54:04 +02:00
Fabien Potencier
3c32fd993d replaced self.version by 2.1.* in composer.json files 2012-09-10 12:53:42 +02:00
Fabien Potencier
4dc197c3e1 udpated composer.json to 2.2 2012-09-06 20:45:30 +02:00
Fabien Potencier
66a060defd merged branch Tobion/formdoc (PR #5350)
Commits
-------

83dc966 [Form] Fixed some PHPDoc
596bbb1 [Form] fixed FormConfigBuilder to use PropertyPathInterface
a523823 [Form] fixed and added phpDoc

Discussion
----------

[Form] fixed and added phpDoc

[ci skip]

---------------------------------------------------------------------------

by sstok at 2012-08-26T08:11:01Z

Some descriptions don''t seem to be properly aligned, use the CS-fixer.

---------------------------------------------------------------------------

by Tobion at 2012-08-26T17:02:25Z

@sstok This is more about manual fixes concerning forgotten exceptions or wrong data type. The cs fixer gives many false positives and can be applied later.
2012-08-28 07:38:26 +02:00
Tobias Schultze
a52382344d [Form] fixed and added phpDoc 2012-08-27 18:33:43 +02:00
William DURAND
933e821496 Add minimum-stability (dev) in each component 2012-08-22 15:48:41 +02:00
Bilal Amarni
bd9319bd6e added a missing phpdoc param 2012-08-17 13:01:11 +03:00
Bernhard Schussek
3ad3876ff8 [Form] Fixed support for preferred choices in "entity" type 2012-08-16 18:19:53 +02:00
Guilherme Blanco
493aa12f99 Added support to redis, wincache and zend data cache. 2012-08-09 15:02:27 -04:00
Fabien Potencier
0ccda38775 merged branch Garfield-fr/master (PR #5015)
Commits
-------

f1c4b8b [Doctrine Bridge] Added a parameter ignoreNull on Unique entity to allow a nullable value on field. Added Test

Discussion
----------

[Doctrine Bridge] Added parameter ignoreNull to accept a nullable value on field

In my last project, i use this syntax to test unicity on 2 fields, but it fail because the validator stop if value is null. I dropped the test on validator and my unicity work fine.

```
@UniqueEntity(fields={"username", "deletedAt"})
```

It's possible to add this PR on Bridge.

Thanks

Bertrand

---------------------------------------------------------------------------

by stof at 2012-07-23T08:14:19Z

This is wrong. RDBMS allow several null values in a unique column and this change will break it.

---------------------------------------------------------------------------

by henrikbjorn at 2012-07-23T08:17:08Z

@stof seems weird indeed it would return if any of the values are null. Makes sense to do a query where the field `IS NULL` or whatever the find method does.

---------------------------------------------------------------------------

by stof at 2012-07-23T08:18:50Z

@henrikbjorn if you do a query with IS NULL, the validator would force to have only 1 entity with a null field whereas it is not the behavior of the DB-level constraint.

---------------------------------------------------------------------------

by henrikbjorn at 2012-07-23T08:20:41Z

In this case i suspect that he wants to achieve a `WHERE username = "henrikbjorn" AND deletedAt IS NULL` which would be valid right? Currently it just returns if any of the fields are null and the validation is never done.

---------------------------------------------------------------------------

by bschussek at 2012-07-23T08:27:24Z

I suggest to make this configurable as the handling of NULL values in UNIQUE columns [differs between SQL implementations](http://forums.mysql.com/read.php?22,53591,53591#msg-53591).

---------------------------------------------------------------------------

by Garfield-fr at 2012-07-23T08:52:53Z

@stof What the correct solution to test my unicity with deletedAt == null ?

I use this definition: @ORM\Column(name="deleted_at", type="datetime", nullable=true)

---------------------------------------------------------------------------

by Garfield-fr at 2012-07-23T20:28:44Z

In my local repository, i added a new parameter "$authorizedNullField" on UniqueEntity.php and tested this on UniqueEntityValidator.php:

Code: https://gist.github.com/4122efbe569e3c2c95c0

What about that ?

Thanks for your help

---------------------------------------------------------------------------

by stof at 2012-07-23T20:45:30Z

yep, this would be good (except for the naming which seems weird)

---------------------------------------------------------------------------

by Garfield-fr at 2012-07-23T20:46:44Z

No problem to change this. I don't find a good name for this ?

---------------------------------------------------------------------------

by stof at 2012-07-23T20:47:57Z

what about ``allowMultipleNull`` (defaulting to ``true`` for BC) ?

---------------------------------------------------------------------------

by Garfield-fr at 2012-07-23T20:51:30Z

Why multiple ? This option is for one or many. what about `allowNullable` ?

---------------------------------------------------------------------------

by stof at 2012-07-23T20:52:44Z

@Garfield-fr the current behavior allows having multiple null values without failing to the unique constraint

---------------------------------------------------------------------------

by Garfield-fr at 2012-07-23T20:56:07Z

ok. I make `allowMultipleNull`.

It's ok with that: https://gist.github.com/cae8d43780c45a5011ed

Thanks

---------------------------------------------------------------------------

by bschussek at 2012-07-23T20:58:12Z

What about `uniqueNull` (`false` by default)? `ignoreNull` (`true` by default)? I find `allowMultipleNull` a bit cumbersome.

---------------------------------------------------------------------------

by stof at 2012-07-23T20:58:26Z

no it is not. You have an issue in the validator. You have an extra negation.

Please update your PR

---------------------------------------------------------------------------

by Garfield-fr at 2012-07-23T21:01:59Z

@stof `ignoreNull` is ok for you ?

---------------------------------------------------------------------------

by stof at 2012-07-23T21:10:24Z

yes

---------------------------------------------------------------------------

by fabpot at 2012-08-05T07:48:03Z

Is it mergeable now? Is yes, @Garfield-fr Can you squash your commits?

---------------------------------------------------------------------------

by travisbot at 2012-08-05T08:43:23Z

This pull request [fails](http://travis-ci.org/symfony/symfony/builds/2039523) (merged 19ae3cf9 into c20c1d18).

---------------------------------------------------------------------------

by stof at 2012-08-05T12:09:02Z

@Garfield-fr when squashing the commits, you need to force the push as you are rewriting the history. You should not have merged with your remote branch

---------------------------------------------------------------------------

by Garfield-fr at 2012-08-05T12:10:15Z

What's the right solution for resolve this ?

---------------------------------------------------------------------------

by stof at 2012-08-05T12:11:09Z

@Garfield-fr reset your local branch to the squashed commit and force the push

---------------------------------------------------------------------------

by Garfield-fr at 2012-08-05T12:14:09Z

@stof Thanks for your help

---------------------------------------------------------------------------

by travisbot at 2012-08-05T12:19:06Z

This pull request [fails](http://travis-ci.org/symfony/symfony/builds/2040210) (merged f1c4b8b4 into 20d2e5a1).
2012-08-06 10:17:10 +02:00
Christophe Coevoet
85187ec266 [DoctrineBridge] Fixed the testsuite 2012-08-05 14:43:59 +02:00
Bertrand Zuchuat
f1c4b8b415 [Doctrine Bridge] Added a parameter ignoreNull on Unique entity to allow a nullable value on field. Added Test 2012-08-05 10:35:10 +02:00
Fabien Potencier
c99f9d29cd fixed merge 2012-08-04 12:08:20 +02:00
Victor Berchet
6097c804ce [DoctrineBridge] Fix log of non utf8 data 2012-08-03 10:23:47 +02:00
Victor Berchet
a0709fc365 [DoctrineBridge] Fix log of non utf8 data 2012-08-01 13:10:42 +02:00
Victor Berchet
4ae54e39fc [Composer] Bumped doctrine/orm to 2.2.3 2012-07-31 16:51:24 +02:00
Pascal Borreli
4c726ea64c Fixed Phpdoc 2012-07-28 16:07:17 +00:00
Bernhard Schussek
0315d431f4 [Form] Fixed failing UniqueValidatorTest when Doctrine Common 2.2 is loaded 2012-07-25 22:49:37 +02:00
Bernhard Schussek
b4b5408fdc [Form] Fixed failing tests 2012-07-25 22:16:38 +02:00
Bernhard Schussek
686bf6b664 [Form] Made original data of a form and choices accessible in templates 2012-07-23 19:24:46 +02:00
Fabien Potencier
a5451e48b7 fixed typo 2012-07-23 18:54:03 +02:00
Fabien Potencier
76c1e26272 moved deps in recommend to suggest 2012-07-23 16:23:01 +02:00
Fabien Potencier
019625d34e merged branch bschussek/options_performance (PR #5004)
Commits
-------

24b764e [Form] Fixed issues mentioned in the PR
9216816 [Form] Turned Twig filters into tests
310f985 [Form] Added a layer of 2.0 BC methods to FormView and updated UPGRADE and CHANGELOG
5984b18 [Form] Precalculated the closure for deciding whether a choice is selected (PHP +30ms, Twig +30ms)
5dc3c39 [Form] Moved the access to templating helpers out of the choice loop for performance reasons (PHP +100ms)
0ef9acb [Form] Moved the method isChoiceSelected() to the ChoiceView class (PHP +150ms)
8b72766 [Form] Tweaked the generation of option tags for performance (PHP +200ms, Twig +50ms)
400c95b [Form] Replace methods in ChoiceView by public properties (PHP +100ms, Twig +400ms)
d072f35 [Form] The properties of FormView are now accessed directly in order to increase performance (PHP +200ms, Twig +150ms)

Discussion
----------

[Form] Made FormView and ChoiceView properties public for performance reasons

Bug fix: no
Feature addition: no
Backwards compatibility break: **yes**
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -

This PR changes the access to properties of `FormView` and `ChoiceView` objects from getters to direct property accesses. On [my example form](http://advancedform.gpserver.dk/app_dev.php/taxclasses/1) this improves rendering performance for **300ms** with PHP templates and **550ms** with Twig on my local machine.

Unfortunately, this breaks BC both with 2.0 and with the current master in Form Types and PHP templates. Twig templates are not affected by this change.

2.0:
```
$formView->set('my_var', 'foobar');
$formView->get('my_var');
$formView->getChild('childName');
$formView['childName'];
```

master:
```
$formView->setVar('my_var', 'foobar');
$formView->getVar('my_var');
$formView->get('childName');
$formView['childName'];
```

this PR:
```
$formView->vars['my_var'] = 'foobar';
$formView->vars['my_var'];
$formView->children['childName'];
$formView['childName'];
```

Should we add methods to keep BC with 2.0?

The second part of this PR contains improvements to the rendering of choice fields. These gain another **~500ms** for PHP templates and **80ms** for Twig. These improvements are BC, unless you overwrote the block "choice_widget_options" in your form themes which then needs to be adapted.

**Update:**

The PR now includes a BC layer for 2.0.

---------------------------------------------------------------------------

by stof at 2012-07-21T11:37:41Z

@bschussek couldn't we keep the getters and setters for BC even if the rendering accesses the public properties directly ?

---------------------------------------------------------------------------

by bschussek at 2012-07-21T11:52:33Z

@stof A BC layer for 2.0 is now included. People who upgraded to master already unfortunately need to adapt their code.

---------------------------------------------------------------------------

by sstok at 2012-07-21T12:40:57Z

👍
2012-07-21 19:51:42 +02:00
Bernhard Schussek
3075fa6b39 [OptionsResolver] Renamed filters to normalizers 2012-07-21 13:02:12 +02:00
Bernhard Schussek
d072f35ea0 [Form] The properties of FormView are now accessed directly in order to increase performance (PHP +200ms, Twig +150ms) 2012-07-21 12:56:11 +02:00
Klein Florian
4eb54a042d update CHANGELOG 2012-07-20 09:25:13 +02:00
Klein Florian
db9ea095f0 [Doctrine] [Bridge] fix repositoryMethod test 2012-07-19 16:54:35 +02:00
Klein Florian
2a6c222c51 Add a customRepository option to the uniqueEntity validator 2012-07-19 16:24:10 +02:00
Fabien Potencier
8754c0c33f merged branch stof/doctrine_2_3 (PR #4941)
Commits
-------

8f99be3 [DoctrineBridge] Fixed the type guesser for doctrine 2.3

Discussion
----------

[DoctrineBridge] Fixed the type guesser for doctrine 2.3

Doctrine 2.3 now uses the drivers moved to Common, so the exception was not catched anymore and was breaking the guessing when a non-entity was used.

---------------------------------------------------------------------------

by craue at 2012-07-16T14:54:30Z

👍

---------------------------------------------------------------------------

by ddeboer at 2012-07-17T20:07:57Z

👍

---------------------------------------------------------------------------

by stof at 2012-07-17T20:17:01Z

@fabpot please merge this as 2.1 is currently broken when you rely on the form guessers for unmapped classes
2012-07-17 22:45:07 +02:00
Bernhard Schussek
17ca9b671a [Form] Fixed DoctrineType to use getManagerForClass() if no EM name is given 2012-07-17 10:16:11 +02:00
Christophe Coevoet
8f99be39ab [DoctrineBridge] Fixed the type guesser for doctrine 2.3 2012-07-16 16:48:22 +02:00
Fabien Potencier
cd24e6ea8f Revert "raised the minimum version of PHP to 5.3.4 (closes #3856)"
This reverts commit 2dcc44897e.
2012-07-15 12:13:51 +02:00
Alexander
33f29ed174 [Form] '@group benchmark' for form performance tests 2012-07-14 16:20:31 +02:00
Fabien Potencier
a27aeda8f4 merged branch bschussek/performance (PR #4882)
Commits
-------

cd7835d [Form] Cached the form type hierarchy in order to improve performance
2ca753b [Form] Fixed choice list hashing in DoctrineType
2bf4d6c [Form] Fixed FormFactory not to set "data" option if not explicitely given
7149d26 [Form] Removed invalid PHPDoc text

Discussion
----------

[Form] WIP Improved performance of form building

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: **Update the Silex extension**

This PR is work in progress and up for discussion. It increases the performance of FormFactory::createForm() on a specific, heavy-weight form from **0.848** to **0.580** seconds.

Before, the FormFactory had to traverse the hierarchy and calculate the default options of each FormType everytime a form was created of that type.

Now, FormTypes are wrapped within instances of a new class `ResolvedFormType`, which caches the parent type, the type's extensions and its default options.

The updated responsibilities: `FormFactory` is a registry and proxy for `ResolvedFormType` objects, `FormType` specifies how a form can be built on a specific layer of the type hierarchy (e.g. "form", or "date", etc.) and `ResolvedFormType` *does the actual building* across all layers of the hierarchy (by delegating to the parent type, which delegates to its parent type etc.).

---------------------------------------------------------------------------

by schmittjoh at 2012-07-12T18:25:40Z

Maybe ResolvedFormType

---------------------------------------------------------------------------

by jmather at 2012-07-13T02:56:38Z

I really like ResolvedFormType. That's the naming method I took for my tag parser that handes the same conceptual issue.

---------------------------------------------------------------------------

by axelarge at 2012-07-13T05:25:00Z

ResolvedFormType sounds very clear.
This change is great and I desperately hope to see more of this kind

---------------------------------------------------------------------------

by Baachi at 2012-07-13T06:41:26Z

Yes `ResolvedFormType` sounds good :) 👍

---------------------------------------------------------------------------

by fabpot at 2012-07-13T07:11:33Z

I like `ResolvedFormType` as well.

---------------------------------------------------------------------------

by henrikbjorn at 2012-07-13T07:46:48Z

👍 `ResolvedFormType` :shipit:

---------------------------------------------------------------------------

by stof at 2012-07-13T18:01:51Z

This looks good to me
2012-07-13 21:26:31 +02:00
Fabien Potencier
2dcc44897e raised the minimum version of PHP to 5.3.4 (closes #3856)
We've raised the minimum version of PHP because of a PHP
bug before 5.3.4:

https://bugs.php.net/bug.php?id=52083
https://bugs.php.net/bug.php?id=50027
2012-07-13 21:22:46 +02:00
Bernhard Schussek
cd7835d8d2 [Form] Cached the form type hierarchy in order to improve performance 2012-07-13 20:39:30 +02:00
Alexander
e97cd61a89 [DoctrineBridge] Fix arguments when registering event listeners on multiple connections
Fixes #4712
2012-07-13 15:19:24 +02:00
Alexander
0bf3c068d7 [DoctrineBridge] Failing testcase for event listeners and multiple connections 2012-07-13 15:05:25 +02:00
Bernhard Schussek
2ca753bc68 [Form] Fixed choice list hashing in DoctrineType 2012-07-13 14:48:51 +02:00
Bernhard Schussek
70307e5648 [Form] Improved EntityType performance by caching the EntityChoiceList 2012-07-12 19:13:41 +02:00
Christophe Coevoet
ac7875569a [DoctrineBridge] Added an option to choose the subpath for the violation
By default, the UniqueEntityValidator maps the violation on the first
field of the UniqueEntity constraint. The new option allows to control
this behavior if a better mapping is suited.
2012-07-12 00:19:02 +02:00
Fabien Potencier
d100ffaf76 fixed CS 2012-07-09 14:54:20 +02:00
Fabien Potencier
03d22b74ec fixed CS (mainly method signatures) 2012-07-09 14:43:50 +02:00
Grégoire Paris
f541a54770 [Form] implement force append / prepend 2012-06-09 17:05:41 +02:00
Fabien Potencier
e08252897a Revert "merged branch nomack84/rename_form_methods (PR #4473)"
This reverts commit 136b7868f7, reversing
changes made to 78747e6cc5.
2012-06-01 07:45:48 +02:00
nomack84
cbc99442c6 [Bridge][Form] Rename some deprecated methods 2012-05-31 08:09:25 -04:00
Eric GELOEN
395004c03f [Bridge][Doctrine] Fix missing dot in unique entity error message 2012-05-29 14:41:27 +02:00
Bernhard Schussek
90516223ab Fixing email 2012-05-26 09:48:33 +02:00
Bernhard Schussek
98a7c0cf5f [Form] Consolidated FormInterface, FormBuilderInterface and FormViewInterface 2012-05-25 12:34:16 +02:00
Bernhard Schussek
877d8f7195 [Form] Reversed the order of $type and $name in FormFactory::createNamed[Builder]() 2012-05-25 12:34:16 +02:00
Bernhard Schussek
33fecca210 [Form] Merged various form events and added class FormEvent 2012-05-25 12:34:16 +02:00
Bernhard Schussek
8cae3282d8 [Form] setDefaultOptions() is now coded against OptionsResolverInterface 2012-05-25 12:34:16 +02:00
Bernhard Schussek
2cd99e80b6 [Form] Added FormBuilderInterface and FormViewInterface and cleaned up FormTypeInterface and FormTypeExtensionInterface 2012-05-25 12:28:17 +02:00
Bernhard Schussek
027259eba4 [Form] Changed getDefaultOptions() to setDefaultOptions(OptionsResolver $resolver) in FormTypeInterface 2012-05-25 12:28:17 +02:00
Fabien Potencier
335d4eab86 fixed CS 2012-05-21 22:27:15 +02:00
Fabien Potencier
ea33d4d377 fixed CS 2012-05-21 16:06:09 +02:00
Fabien Potencier
aa3e1a3b8c merged 2.0 2012-05-21 16:05:28 +02:00
Christophe Coevoet
cdfb0b19d2 Changed composer constraint to allow Doctrine 2.3 too 2012-05-20 22:28:43 +02:00
Fabien Potencier
9b7aab5e94 merged 2.0 2012-05-20 18:16:37 +02:00
Fabien Potencier
26b489f499 fixed CS 2012-05-20 18:15:10 +02:00
Fabien Potencier
3bdf52a16a fixed CS 2012-05-18 19:42:42 +02:00
Fabien Potencier
e173d79e34 fixed CS 2012-05-18 19:37:58 +02:00
Fabien Potencier
ec36ae7eda merged 2.0 2012-05-18 19:04:58 +02:00
Fabien Potencier
c9ba077a20 added missing LICENSE files 2012-05-18 19:00:00 +02:00
Christophe Coevoet
d1f0c25413 Fixed the composer constraint for Doctrine Common 2012-05-18 00:28:41 +02:00
Fabien Potencier
41621e42e9 fixed phpdoc @param alignment 2012-05-15 22:19:31 +02:00
Fabien Potencier
ce9791246b fixed phpdoc @param alignment 2012-05-15 18:56:32 +02:00
Bernhard Schussek
256b7081a4 [OptionsParser] Renamed OptionsParser to OptionsResolver 2012-05-14 19:35:07 +02:00
Bernhard Schussek
b9d053edb2 [Form] Moved Options classes to new OptionsParser component 2012-05-14 19:35:07 +02:00
Fabien Potencier
f9aa6f7d1e merged branch bamarni/master (PR #4153)
Commits
-------

a2b3d3c added cache service definition

Discussion
----------

[Doctrine Bridge] Added a method to load a cache definition

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -

Following this discussion (https://github.com/doctrine/DoctrineBundle/pull/62), this will let DoctrineBundle, MongodbBundle and CouchdbBundle share the same code for cache definitions.

---------------------------------------------------------------------------

by dlsniper at 2012-04-30T06:56:49Z

+1 for this PR.

---------------------------------------------------------------------------

by stof at 2012-04-30T06:57:58Z

👍

---------------------------------------------------------------------------

by fabpot at 2012-04-30T15:41:05Z

Can you add a note abou this change in the CHANGELOG?

---------------------------------------------------------------------------

by stof at 2012-04-30T15:46:48Z

does it really need to be in the changelog ? End-users don't know about this at all. The only guys affected by this change are the maintainers of the different Doctrine bundles as they can remove some code now.

---------------------------------------------------------------------------

by fabpot at 2012-04-30T16:41:21Z

@stof: right

@bamarni: Can you squash your commits?

---------------------------------------------------------------------------

by bamarni at 2012-04-30T17:03:38Z

@fabpot : done

---------------------------------------------------------------------------

by dlsniper at 2012-04-30T17:22:07Z

@bamarni can you also do a patch for the docs after this gets merged so that people know about this change and know how to use it?

Thank you!

---------------------------------------------------------------------------

by bamarni at 2012-04-30T17:29:05Z

@dlsniper : no problem ;)

---------------------------------------------------------------------------

by fabpot at 2012-04-30T18:29:03Z

ping @beberlei
2012-05-10 07:18:48 +02:00
Fabien Potencier
3719c70870 updated minimum PHP version to 5.3.3
5.3.3 has some interesting fixes and this is the version used by
Redhat 6 and Debian 6
2012-05-07 10:29:11 +02:00
Stéphane PY
bc63fb26be Fix some cs 2012-05-04 00:17:06 +02:00
Bilal Amarni
a2b3d3cf00 added cache service definition 2012-04-30 19:01:18 +02:00
Fabien Potencier
9fbf8555f0 Revert "merged branch Seldaek/master (PR #4133)"
This reverts commit 00e7a94a8c, reversing
changes made to a01dec00f4.
2012-04-27 19:55:40 +02:00
Jordi Boggiano
00c4267726 Update branch aliases 2012-04-27 12:47:50 +02:00
Fabien Potencier
41465e655c [DoctrineBridge] added CHANGELOG 2012-04-26 22:41:39 +02:00
Bernhard Schussek
d9e142bd62 [Form] Restored and deprecated method guessMinLength in FormTypeGuesser 2012-04-23 16:02:44 +02:00
julien.galenski
f7200e479c [Form] added method guessPattern to FormTypeGuesserInterface
rephrase changelog
2012-04-23 12:28:18 +02:00
William DURAND
3601f61a36 [DoctrineBridge] Fixed composer.json
'recommend' section no more exists
2012-04-22 15:32:41 +02:00
pierre
8bdff01f17 [DoctrineBridge][Form] added collection guess for array Doctrine type and array constraint type
Fixes #1692
2012-04-18 19:15:40 +02:00
Bernhard Schussek
6336d9314e [Validator] Renamed ConstraintValidatorInterface::isValid() to validate() because of the lack of a return value 2012-04-17 16:46:43 +02:00
Bernhard Schussek
46f0393f70 [Validator] Removed return value from ConstraintValidatorInterface::isValid() 2012-04-17 16:46:43 +02:00
Jeremy Mikola
41bdf26cb2 [DoctrineBridge] Initialize proxies in UniqueEntityValidator
Fixes #3163
2012-04-13 14:24:50 -04:00
Bernhard Schussek
8329087a20 [Form] Moved calculation of ChoiceType options to closures 2012-04-11 16:50:57 +02:00
Bernhard Schussek
b7330456b6 [Form] Fixed option support in Form component 2012-04-11 16:37:42 +02:00
Fabien Potencier
191aaa3f0c merged branch bschussek/issue3635 (PR #3820)
Commits
-------

65aa387 [Form] Fixed index generation in EntityChoiceList if ID is not an integer

Discussion
----------

[Form] Fixed index generation in EntityChoiceList if ID is not an integer

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #3635
Todo: -

![Travis Build Status](https://secure.travis-ci.org/bschussek/symfony.png?branch=issue3635)
2012-04-11 11:36:22 +02:00
Bernhard Schussek
2e07256921 [Form] Simplified choice list API 2012-04-10 15:37:24 +02:00
Bernhard Schussek
26451201e0 [Form] Fixed handling of expanded choice lists, checkboxes and radio buttons with empty values ("") 2012-04-10 15:35:46 +02:00
Bernhard Schussek
65aa387da0 [Form] Fixed index generation in EntityChoiceList if ID is not an integer 2012-04-08 12:32:10 +02:00
Fabien Potencier
72e854e943 fixed CS 2012-04-07 09:10:50 +02:00
Thomas Chmielowiec (chmielot)
a430f3d8a6 [#3446] [Form] Fix getChoicesForValues of EntityChoiceList on empty values 2012-04-04 15:46:22 +02:00
Eriksen Costa
2cac50d8a9 fixed CS (missing or misplaced license blocks) 2012-04-02 00:52:14 -03:00
Fabien Potencier
aed954cb63 fixed typo in the previous commit 2012-03-29 08:41:52 +02:00
Fabien Potencier
fea6b79acd moved component and bridge unit tests to the src/ directory
This is the first step to make each Symfony Component and Bridge self-contained.
2012-03-29 08:37:22 +02:00
Fabien Potencier
1aaf5c9423 merged branch marcw/patch-security-refresh-user (PR #3402)
Commits
-------

10947cb [DoctrineBridge][Security] Fixes bug that prevents repository's refreshUser from being called

Discussion
----------

[Security][DoctrineBridge] Fixes bug that prevents repository's refreshUser from being called

---------------------------------------------------------------------------

by marcw at 2012-02-21T08:46:09Z

Updated. What do you guys think about this patch ?

---------------------------------------------------------------------------

by henrikbjorn at 2012-02-21T08:57:47Z

Isnt this a bit dangerous, the custom repository implementing refreshUser should always be called first right? You wouldnt specify the $property property if your class has custom implementations would you?

---------------------------------------------------------------------------

by marcw at 2012-02-21T09:05:08Z

@henrikbjorn At this time, the refreshUser method is never called from the custom repository, even if you don't specify the "property" property. This patch fixes this.

---------------------------------------------------------------------------

by marcw at 2012-02-21T09:44:06Z

Updated & Squashed.

---------------------------------------------------------------------------

by stof at 2012-02-21T10:03:33Z

@marcw please move the retrieval of the id in the ``else`` block, like in my comment as it is useless to do this logic for the case where the userProviderInterface is implemented (and it will answer to @vicb by making it impossible to write it with elseif)

---------------------------------------------------------------------------

by marcw at 2012-02-21T10:19:06Z

I'm not sure about this, but Isn't the check of the id essential here to ensure that the entity is a persisted one ?

---------------------------------------------------------------------------

by stof at 2012-02-21T10:21:55Z

@marcw if the interface is used, it means that the user wants to do the work himself. So you should really let him do the way he wants. If he does not use the id to refresh the user, he could choose not to include it in the serialized data.
Retrieving the id is needed for the ``find()`` call because we pass the id as argument and so we fail when the serialized data don't contain it

---------------------------------------------------------------------------

by marcw at 2012-02-21T10:33:30Z

@stof Roger that. I'll do the fix.

---------------------------------------------------------------------------

by marcw at 2012-02-21T10:41:58Z

Updated & Squashed, again.

---------------------------------------------------------------------------

by stof at 2012-02-21T11:00:44Z

btw, to answer to your previous question, the exception when retrieving the id does not check if the object is persisted (you need to reach teh DB for this, which is what find() does) but that the id is part of the serialized data to give a better error reporting.

---------------------------------------------------------------------------

by fabpot at 2012-03-07T19:39:33Z

ready to be merged now?

---------------------------------------------------------------------------

by henrikbjorn at 2012-03-08T07:21:37Z

would say so.

---------------------------------------------------------------------------

by dlsniper at 2012-03-25T11:58:34Z

Hi, can this be merged now or not?
2012-03-26 09:36:13 +02:00
Victor Berchet
fc7c7f6458 [Form] Fix min/max length guessing for numeric types (fix #3091) 2012-03-19 23:57:21 +01:00
Drak
a6a9280a3b [DoctrineBridge] Refactor session storage to handler. 2012-03-14 20:27:23 +05:45
Fabien Potencier
673bbb8a8e fixed CS 2012-03-11 18:00:25 +01:00
Fabien Potencier
595e6d6ca2 merged 2.0 2012-03-11 18:00:10 +01:00
Christophe Coevoet
f26c1ce98d Fixed constraint requirements for Doctrine Common 2012-03-11 02:47:07 +01:00
Jeremy Mikola
c8e74da8be [DoctrineBridge] Iterator->current() is not the same as current(Iterator) 2012-03-09 10:27:18 -05:00
Jeremy Mikola
a5ed6abd88 [DoctrineBridge] Rewind MongoCursor before use in unique validator
Fixes a regression I introduced in: 265360d142
2012-03-08 17:10:27 -05:00
Fabien Potencier
c4256688d1 merged branch jmikola/patch-3 (PR #3450)
Commits
-------

265360d [DoctrineBridge] Simpler result checking in UniqueEntityValidator

Discussion
----------

[DoctrineBridge] Simpler result checking in UniqueEntityValidator

In 928e352d09, support for MongoDB cursors was implemented by converting an Iterable, non-ArrayAccess object to an array. The ArrayAccess check didn't seem purposeful, since cursors are only Iterable and ORM returns real arrays. Since we only need to access the first element of the cursor (and only in cases where the count is exactly 1), we can simply use current() to handle Iterables and arrays.

@henrikbjorn: Any thoughts on this? I was testing @stof's work in doctrine/DoctrineMongoDBBundle#68 and our Symfony submodule was a bit old, so I fixed UniqueEntityValidator on my local machine before I realized you had come up with a solution a few weeks ago.
2012-03-02 21:39:39 +01:00
Fabien Potencier
4c1cea7093 merged branch jmikola/doctrine-lazy-event-manager (PR #3434)
Commits
-------

71493a2 [DoctrineBridge] Compiler pass for registering event listeners/subscribers
f15dde6 [DoctrineBridge] ContainerAwareEventManager class

Discussion
----------

[DoctrineBridge] ContainerAwareEventManager class

```
Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
```

[![Build Status](https://secure.travis-ci.org/jmikola/symfony.png?branch=doctrine-lazy-event-manager)](http://travis-ci.org/jmikola/symfony)

This allows services to be registered (and lazily loaded) with Doctrine Common's EventManager.

It is ported from @schmittjoh's previous commits here: doctrine/DoctrineBundle#23. I'd like to integrate this with DoctrineMongoDBBundle, so the Bridge once again seemed like an ideal alternative to duplicating code.

---------------------------------------------------------------------------

by jmikola at 2012-02-23T20:37:51Z

Per conversation with @stof in doctrine/DoctrineBundle#23, I'm also going to integrate the compiler pass (an abstract version both bundles can use) into this PR.

---------------------------------------------------------------------------

by jmikola at 2012-02-23T21:56:47Z

Just realized there's an issue with the naming assumptions, since Doctrine ORM uses "doctrine" as its registry service ID but "doctrine.dbal" as its event manager prefix. Fixing.
2012-03-01 01:01:15 +01:00
Fabien Potencier
3de31c62d6 merged branch snc/session-handler (PR #3436)
Commits
-------

9c8a283 Some \SessionHandlerInterface related documentation updates
9b2de81 Fixed \SessionHandlerInterface in DbalSessionStorage

Discussion
----------

Some \SessionHandlerInterface related updates

---------------------------------------------------------------------------

by snc at 2012-02-23T20:01:51Z

I checked the `Locale` stub in the documentation and it looks like the `\` is not prefixed, so I'll change this, too.

---------------------------------------------------------------------------

by drak at 2012-02-24T07:40:39Z

We really need some tests for the bridge classes, even if they stubs which cause the compiler to at least parse the class, would pick up refactorings like this.
2012-02-27 10:09:42 +01:00
Jordi Boggiano
bafcaafbe6 Removed version field 2012-02-27 09:59:20 +01:00
Jeremy Mikola
265360d142 [DoctrineBridge] Simpler result checking in UniqueEntityValidator
In 928e352d09, support for MongoDB cursors was implemented by converting an Iterable, non-ArrayAccess object to an array. The ArrayAccess check didn't seem purposeful, since cursors are only Iterable and ORM returns real arrays. Since we only need to access the first element of the cursor (and only in cases where the count is exactly 1), we can simply use current() to handle Iterables and arrays.
2012-02-25 17:21:07 -05:00
Jordi Boggiano
f9d9dc7ce9 Add branch-alias for composer 2012-02-25 03:26:20 +01:00
Jeremy Mikola
71493a2d94 [DoctrineBridge] Compiler pass for registering event listeners/subscribers
This was imported from DoctrineBundle (see: doctrine/DoctrineBundle#23), since it can be used by other Doctrine bundles, too. It utilizes the ContainerAwareEventManager from f15dde6c59.
2012-02-23 17:50:43 -05:00
H. Westphal
9b2de819ff Fixed \SessionHandlerInterface in DbalSessionStorage 2012-02-23 20:02:31 +01:00
Johannes Schmitt
f15dde6c59 [DoctrineBridge] ContainerAwareEventManager class
This allows services to be registered (and lazily loaded) with Doctrine Common's EventManager.
2012-02-23 13:17:44 -05:00
marc.weistroff
10947cba8c [DoctrineBridge][Security] Fixes bug that prevents repository's refreshUser from being called 2012-02-21 13:38:07 +01:00
Fabien Potencier
e7adf546ef merged branch jmikola/doctrine-data-fixtures (PR #3328)
Commits
-------

c754f28 [DoctrineBridge] Rename data fixtures loader class
af84805 [DoctrineBridge] Suggest doctrine/data-fixtures dependency
e4243a1 [DoctrineBridge] Add common data fixtures loader

Discussion
----------

[DoctrineBridge] Add common data fixtures loader

Symfony does not depend on doctrine/data-fixtures, but having this class in the bridge would enable DoctrineMongoDBBundle (and possibly others) to load fixtures without requiring DoctrineFixturesBundle to be installed.

Additionally, DoctrineFixturesBundle seems to only consist of this class and a command for loading ORM fixtures. With this in the bridge, we can possibly eliminate DoctrineFixturesBundle altogether by merging its command into DoctrineBundle.

---------------------------------------------------------------------------

by stof at 2012-02-11T19:40:17Z

The reason to have a separate bundle for the ORM fixtures was that the ORM is released whereas the DataFixtures library is still in alpha versions. So we wanted to avoid having it in Symfony itself for the 2.0 release. It could maybe change now that we have the bundle in a separate repo.
The other solution could be to put all commands related to fixtures in DoctrineFixturesBundle but IIRC @beberlei rejected a PR trying to make the same command work for ORM and PHPCR.

@beberlei what do you think about these suggestions ? And what is missing in DataFixtures to release it ? It has not changed recently except for the addition of the typehint and an update of the PHPCR purger

---------------------------------------------------------------------------

by fabpot at 2012-02-14T23:30:23Z

The Symfony bridges provide integration between a third-party library and Symfony components. IIUC, this PR is only about Doctrine and as such it is not in the scope of the bridge. It should be done "somewhere" in the Doctrine namespace (what about common for instance?).

---------------------------------------------------------------------------

by stof at 2012-02-14T23:34:19Z

@fabpot no it is not a Doctrine-only code. This extended loader is about integrating the Doctrine DataFixtures library with the DI component to allow fixtures to be container-aware (it does absolutely nothing else fancy btw). So this *is* in the scope of the bridge.

---------------------------------------------------------------------------

by jmikola at 2012-02-15T00:40:12Z

I second @stof's point here. This class is specifically for loading fixtures into application with a service container. Likewise, that is why the base class it inherits is in the common data-fixtures library.

Since this is common to both ORM and ODM, the most logical home for it would be DoctrineCommonBundle, and I believe that's what the bridge is :)

---------------------------------------------------------------------------

by stof at 2012-02-15T01:53:17Z

@jmikola not even a DoctrimeCommonBundle IMO. This is not about integrating things with the fullstack framework but with one component
2012-02-15 11:00:50 +01:00
Drak
388a9c2861 [HttpFoundation] Make SessionHandlerInterface compatible with PHP 5.4's SessionHandlerInterface 2012-02-13 11:35:29 +05:45
Jeremy Mikola
c754f28fcb [DoctrineBridge] Rename data fixtures loader class 2012-02-11 16:48:09 -05:00
Jeremy Mikola
af848051ea [DoctrineBridge] Suggest doctrine/data-fixtures dependency 2012-02-11 16:15:54 -05:00
Jeremy Mikola
e4243a1d32 [DoctrineBridge] Add common data fixtures loader 2012-02-11 14:17:18 -05:00
Fabien Potencier
74ccf7062a reverted 5b7ef11650 (Simplify session
storage class names now we have a separate namespace for sessions)
2012-02-11 12:04:50 +01:00
Drak
dad60efccc [HttpFoundation] Add back get defaults and small clean-up.
Changed read-only method names from get*() to peek*()

Typo
2012-02-11 11:24:39 +05:45
Drak
5b7ef11650 [HttpFoundation] Simplify session storage class names now we have a separate namespace for sessions. 2012-02-11 11:24:35 +05:45
Drak
27530cbb1e [HttpFoundation] Moved session related classes to own sub-namespace. 2012-02-11 11:24:31 +05:45
Drak
468391525a [HttpFoundation] Free bags from session storage and move classes to their own namespaces. 2012-02-11 11:24:26 +05:45
Drak
d64939aeee [DoctrineBridge] Refactored driver for changed interface. 2012-02-11 11:24:22 +05:45
Drak
1ed6ee325c [DoctribeBridge][SecurityBundle][WebProfiler] Refactor code for HttpFoundation changes. 2012-02-11 11:21:30 +05:45
Bernhard Schussek
88ef52d272 [Form] Improved FormType::getDefaultOptions() to see default options defined in parent types
In turn, FormType::getParent() does not see default options anymore.
2012-02-07 10:51:21 +01:00
Henrik Bjørnskov
928e352d09 Change the array access used in UniqueEntityValidator
convert iterator to array if it isnt already (mongodb)

More specific if

Dont do iterator_to_array if object implements \ArrayAccess

CS fix
2012-02-06 14:00:20 +01:00
Bernhard Schussek
49d1464b43 [Form] Implemented MergeCollectionListener which calls addXxx() and removeXxx() in your model if found
The listener is used by the Collection type as well as the Choice and Entity type (with multiple
selection). The effect is that you can have for example this model:

    class Article
    {
        public function addTag($tag) { ... }
        public function removeTag($tag) { ... }
        public function getTags($tag) { ... }
    }

You can create a form for the article with a field "tags" of either type "collection" or "choice"
(or "entity"). The field will correctly use the three methods of the model for displaying and
editing tags.
2012-02-02 11:16:21 +01:00
Fabien Potencier
8245bf13d5 merged branch bschussek/issue2615 (PR #3228)
Commits
-------

2e4ebe4 [Validator] Renamed methods addViolationAtRelativePath() and getAbsolutePropertyPath() in ExecutionContext
9153f0e [Validator] Deprecated ConstraintValidator methods setMessage(), getMessageTemplate() and getMessageParameters()
0417282 [Validator] Fixed typos
a30a679 [Validator] Made ExecutionContext immutable and introduced new class GlobalExecutionContext
fe85bbd [Validator] Simplified ExecutionContext::addViolation(), added ExecutionContext::addViolationAt()
f77fd41 [Form] Fixed typos
1fc615c Fixed string access by curly brace to bracket
a103c28 [Validator] The Collection constraint adds "missing" and "extra" errors to the individual fields now
f904a9e [Validator] Fixed: GraphWalker does not add constraint violation if error message is empty
1dd302c [Validator] Fixed ConstraintViolationList::__toString() to not include dots in the output if the root is empty
1678a3d [Validator] Fixed: Validator::validateValue() propagates empty validation root instead of the provided value

Discussion
----------

[Validator] Improved "missing" and "extra" errors of Collection constraint

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #2615
Todo: -

![Travis Build Status](https://secure.travis-ci.org/bschussek/symfony.png?branch=issue2615)

Instead of a single violation

    Array:
        The fields "foo", "bar" are missing

various violations are now generated.

    Array[foo]:
        This field is missing
    Array[bar]:
        This field is missing

Apart from that, the PR contains various minor fixes to the Validator.

---------------------------------------------------------------------------

by bschussek at 2012-02-02T09:14:52Z

@fabpot Ready for merge.
2012-02-02 10:16:32 +01:00
Bernhard Schussek
2e4ebe444f [Validator] Renamed methods addViolationAtRelativePath() and getAbsolutePropertyPath() in ExecutionContext 2012-02-02 10:13:41 +01:00
Bart van den Burg
b228942ac8 fix for entity choice list when ->loaded is false and the class name is an entity shorthand name
and updated tests to work with refactored choicelist
2012-02-01 19:13:06 +01:00
Bernhard Schussek
9153f0e569 [Validator] Deprecated ConstraintValidator methods setMessage(), getMessageTemplate() and getMessageParameters()
Had to refactor the validation tests at the same time and fixed various small bugs while doing so.
2012-02-01 14:03:13 +01:00
Bernhard Schussek
a30a679135 [Validator] Made ExecutionContext immutable and introduced new class GlobalExecutionContext
A new ExecutionContext is now created everytime that GraphWalker::walkConstraint() is
launched. Because of this, a validator B launched from within a validator A can't break
A anymore by changing the context.

Because we have a new ExecutionContext for every constraint validation, there is no point
in modifying its state anymore. Because of this it is now immutable.
2012-01-31 21:35:48 +01:00
Fabien Potencier
916597eb29 fixed CS, phpdoc, removed unused use statements 2012-01-28 18:02:36 +01:00
Bernhard Schussek
5f6f75c026 [Form] Fixed outstanding issues mentioned in the PR 2012-01-24 11:59:07 +01:00
Bernhard Schussek
c26b47af8d [Form] Made query parameter name generated by ORMQueryBuilderLoader unique 2012-01-24 01:13:50 +01:00
Bernhard Schussek
f533ef0e1b [Form] Added ChoiceView class for passing choice-related data to the view 2012-01-24 01:07:33 +01:00
Bernhard Schussek
d72900e613 [Form] Incorporated changes suggested in PR comments 2012-01-23 18:58:56 +01:00
Bernhard Schussek
87b16e7015 [Form] Greatly improved ChoiceListInterface and all of its implementations
Fixes #2869, fixes #3021, fixes #1919, fixes #3153.
2012-01-23 18:28:25 +01:00
Christophe Coevoet
e37783f4f9 [DoctrineBridge] Refactored the query sanitization in the collector
The original parameters are kept whenever possible to allow using them
again to explain the query.
2012-01-23 10:57:46 +01:00
Christophe Coevoet
3b260d268b Refactored the collector to separate the loggers per connection 2012-01-23 09:22:30 +01:00
Fabien Potencier
3c0b9c5b20 [DoctrineBridge] enhanced an error message (closes #3155) 2012-01-22 10:12:26 +01:00
Fabien Potencier
e8f9a55012 fixed CS 2012-01-17 11:23:46 +01:00
Fabien Potencier
8ce034fae0 Revert "merged 2.0"
This reverts commit 7000e944fd, reversing
changes made to 9d9013d662.
2012-01-08 20:43:02 +01:00
Fabien Potencier
7000e944fd merged 2.0 2012-01-05 14:54:04 +01:00
Fabien Potencier
208c2e468c removed the version attribute in all composer.json files 2012-01-05 14:51:20 +01:00
Tyler Stroud
261325d33c Cast $query['params'] to array to ensure it is a valid argument for the foreach.
This prevents errors if $query['params'] is null
2012-01-04 12:23:42 -08:00
Drak
79793e442a Coding standards and removing whitespace. 2011-12-24 15:50:47 +05:45
Fabien Potencier
4404d6f0be merged branch stof/entity_provider_registry (PR #2928)
Commits
-------

373ab4c Fixed tests added from 2.0
9653be6 Moved the EntityFactory to the bridge
caa105f Removed useless use statement
24319bb [DoctrineBridge] Made it possible to change the manager used by the provider

Discussion
----------

[DoctrineBridge] Made it possible to change the manager used by the provider

This improves the support of several entity managers by allowing using a non-default one for the provider.

It is BC for the user as the default value for the name is ``null`` which means using the default one.

I'm preparing the PR for DoctrineBundle too

---------------------------------------------------------------------------

by stof at 2011/12/19 14:16:38 -0800

I'm wondering if the EntityFactory used to integrate the bundles with SecurityBundle should be moved to the bridge or not. Moving it (making the key and the abstract service id configurable) would allow reusing it in all Doctrine bundles instead of copy-pasting it (see the CouchDBBundle pull request linked above).
The bridge was initially meant to integrate third party libraries with the components and this class is about the SecurityBundle, not the component. But on the other hand, we already share the abstract DI extension between the bundles using the bridge.

---------------------------------------------------------------------------

by stof at 2011/12/19 14:17:48 -0800

@fabpot @beberlei thoughts ?

---------------------------------------------------------------------------

by stof at 2011/12/21 04:43:50 -0800

@fabpot @beberlei what do you thing about moving the EntityFactory to the bridge ?

---------------------------------------------------------------------------

by henrikbjorn at 2011/12/21 05:10:56 -0800

Missing mongodb bundle

---------------------------------------------------------------------------

by stof at 2011/12/21 05:52:06 -0800

@henrikbjorn I was planning to send the PR for mongodb too but the namespace change was not merged yet yesterday. And now, you want to wait for the answer to know if I need to copy-paste the factory to the mongodb bundle too or if I move it to the bridge

---------------------------------------------------------------------------

by beberlei at 2011/12/21 15:14:17 -0800

I think moving it to the Bridge makes sense if we can re-use across all the bundles then. Also it is really about integrating security with doctrine, so its a bridge topic.

---------------------------------------------------------------------------

by stof at 2011/12/22 08:39:52 -0800

I updated the PR to move the factory to the bridge. The DoctrineBundle and DoctrineCouchDBBundle PRs are updated too.

@fabpot the PR should be ready to be merged

---------------------------------------------------------------------------

by fabpot at 2011/12/22 08:53:02 -0800

Tests do not pass for me:

    ...E

    Time: 0 seconds, Memory: 14.75Mb

    There was 1 error:

    1) Symfony\Tests\Bridge\Doctrine\Security\User\EntityUserProviderTest::testSupportProxy
    Argument 1 passed to Symfony\Bridge\Doctrine\Security\User\EntityUserProvider::__construct() must implement interface Doctrine\Common\Persistence\ManagerRegistry, instance of Doctrine\ORM\EntityManager given, called in tests/Symfony/Tests/Bridge/Doctrine/Security/User/EntityUserProviderTest.php on line 89 and defined

    src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php:35
    tests/Symfony/Tests/Bridge/Doctrine/Security/User/EntityUserProviderTest.php:89

---------------------------------------------------------------------------

by stof at 2011/12/22 08:56:33 -0800

@fabpot I fixed it before your comment (thanks travis ^^). It was the test added in my other PR to 2.0 and so not updated in the original commit. I forgot it when rebasing
2011-12-22 17:59:27 +01:00
Christophe Coevoet
9653be618a Moved the EntityFactory to the bridge 2011-12-22 16:54:29 +01:00
Bart van den Burg
0a9ea2614c fixed the display of the current value in a doctrine entity type, when the current value is for example an instance of Doctrine\Orm\Proxy\Proxy and is not yet initialized 2011-12-22 16:37:13 +01:00
Christophe Coevoet
caa105fef9 Removed useless use statement 2011-12-22 16:14:18 +01:00
Christophe Coevoet
24319bb0f4 [DoctrineBridge] Made it possible to change the manager used by the provider 2011-12-22 16:14:12 +01:00
Bart van den Burg
231e79ce0f fixed entity choice list BC break 2011-12-22 10:49:27 +01:00
Fabien Potencier
5803146a9e merged 2.0 2011-12-20 20:16:39 +01:00
Fabien Potencier
ce41b8eafa merged branch stof/entity_provider (PR #2923)
Commits
-------

f1199c0 [DoctrineBridge] Decoupled the EntityUserProvider from the ORM

Discussion
----------

[DoctrineBridge] Decoupled the EntityUserProvider from the ORM

Bug fix: no
Feature addition: yes
Backwards compatibility break: yes
Symfony2 tests pass: yes

The entity provider can now be used by any Doctrine project implementing the interfaces from Doctrine Common 2.2.
2011-12-19 19:48:33 +01:00
Christophe Coevoet
649fa5219f [DoctrineBridge] Fixed the entity provider to support proxies 2011-12-19 18:32:21 +01:00
Christophe Coevoet
f1199c0c68 [DoctrineBridge] Decoupled the EntityUserProvider from the ORM
It can now be used by any Doctrine project implementing the interfaces
from Doctrine Common 2.2.
2011-12-19 18:20:00 +01:00
Christophe Coevoet
200ed5490b [DoctrineBridge] Extracted the common type and made the choice list generic 2011-12-19 17:53:23 +01:00
Benjamin Eberlei
3c81b62955 [Doctrine] Cleanup and move loader into its own method 2011-12-19 17:46:18 +01:00
Benjamin Eberlei
7646a5bc6d [Doctrine] Dont allow null in ORMQueryBuilderLoader 2011-12-19 17:46:09 +01:00
Benjamin Eberlei
988c2a525e Adjust check 2011-12-19 17:46:04 +01:00
Benjamin Eberlei
3b5c617ad0 [DoctrineBridge] Remove large parts of the EntityChoiceList code that were completly unnecessary (code was unreachable). 2011-12-19 17:45:59 +01:00
Benjamin Eberlei
b919d92b52 [DoctrineBridge] Optimize fetching of entities to use WHERE IN and fix other inefficencies. 2011-12-19 17:45:50 +01:00
Benjamin Eberlei
517eebcb31 [DoctrineBridge] Refactor entity choice list to be ORM independant using an EntityLoader interface. 2011-12-19 17:32:04 +01:00
Fabien Potencier
5d6a7d35b0 merged 2.0 2011-12-18 14:48:17 +01:00
Fabien Potencier
4316595dbb fixed CS 2011-12-18 14:42:59 +01:00
Fabien Potencier
997f354d53 tweaked the README files 2011-12-18 14:22:28 +01:00
Fabien Potencier
0f2caf1106 merged branch lsmith77/component_readmes (PR #2561)
Commits
-------

1e370d7 typo fix
93d8d44 added some more infos about Config
27efd59 added READMEs for the bridges
34fc866 cosmetic tweaks
d6af3f1 fixed README for Console
6a72b8c added basic README files for all components

Discussion
----------

added basic README files for all components and bridges

heavily based on http://fabien.potencier.org/article/49/what-is-symfony2 and the official Symfony2 documentation

---------------------------------------------------------------------------

by jmikola at 2011/11/03 13:36:07 -0700

Great work. For syntax highlighting on the PHP snippets, you could add "php" after the three backticks.

---------------------------------------------------------------------------

by lsmith77 at 2011/11/03 13:41:29 -0700

done

---------------------------------------------------------------------------

by stealth35 at 2011/11/03 13:49:31 -0700

Nice job, but you also need to add `<?php`

ex :

``` php
<?php
use Symfony\Component\DomCrawler\Crawler;

$crawler = new Crawler();
$crawler->addContent('<html><body><p>Hello World!</p></body></html>');

print $crawler->filter('body > p')->text();
```

---------------------------------------------------------------------------

by lsmith77 at 2011/11/03 13:56:57 -0700

done

---------------------------------------------------------------------------

by ericclemmons at 2011/11/03 19:57:57 -0700

@lsmith77 Well done!  This makes consumption of individual components that much easier, *especially* now that `composer.json` files have been added.

---------------------------------------------------------------------------

by lsmith77 at 2011/11/04 01:18:23 -0700

ok .. fixed the issues you mentioned @fabpot

---------------------------------------------------------------------------

by lsmith77 at 2011/11/11 15:00:27 -0800

@fabpot anything else left? seems like an easy merge .. and imho there is considerable benefit for our efforts to spread the word about the components with this PR merged.

---------------------------------------------------------------------------

by drak at 2011/11/11 18:54:13 -0800

You know, it might be a nice idea to put a link to the documentation for each component if there is some at symfony.com

---------------------------------------------------------------------------

by lsmith77 at 2011/11/12 00:59:14 -0800

i did that in some. but i might have missed a few places.
On 12.11.2011, at 03:54, Drak <reply@reply.github.com> wrote:

> You know, it might be a nice idea to put a link to the documentation for each component if there is some at symfony.com
>
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/symfony/symfony/pull/2561#issuecomment-2715762

---------------------------------------------------------------------------

by breerly at 2011/11/21 10:28:36 -0800

Pretty excited with this.

---------------------------------------------------------------------------

by dbu at 2011/11/24 00:02:50 -0800

is there anything we can help with to make this ready to be merged?

---------------------------------------------------------------------------

by lsmith77 at 2011/12/18 02:39:23 -0800

@fabpot: seriously .. if you are not going to deliver something "better" and don't provide a reason what is wrong with this .. then its beyond frustrating. i obviously do not claim that these README's are perfect (and certainly still no replacement for proper documentation), but I do claim that in their current form they are a radical step forward to potential users of the Symfony2 components.
2011-12-18 12:42:02 +01:00
Christophe Coevoet
8713c2d540 [DoctrineBridge][DoctrineBundle] Refactored the DBAL logging
This allows enabling the logging and the profiling separately for instance
when doing batch processing leading to memory issue due to the profiling.
2011-12-16 14:57:00 +01:00
Fabien Potencier
a6cdddd716 merged 2.0 2011-12-14 19:13:35 +01:00
Fabien Potencier
9641c55d16 merged branch RapotOR/2.0-PR2504-squashed (PR #2868)
Commits
-------

4d64d90 Allow empty result; change default *choices* value to **null** instead of **array()**. - added *testEmptyChoicesAreManaged* test - `null` as default value for choices. - is_array() used to test if choices are user-defined. - `null` as default value in __construct too. - `null` as default value for choices in EntityType.

Discussion
----------

[Doctrine][Bridge] EntityType: Allow empty result; default `choices` value changed to null

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
References the following tickets: #2504

- added *testEmptyChoicesAreManaged* test
- `null` as default value for choices.
-  is_array() used to test if choices are user-defined.
- `null` as default value in __construct too.
- `null` as default value for choices in EntityType.

I squashed commits from PR #2504 as requested.
2011-12-13 22:28:46 +01:00
Cédric Lahouste
4d64d90f13 Allow empty result; change default *choices* value to **null** instead of **array()**.
- added *testEmptyChoicesAreManaged* test
- `null` as default value for choices.
- is_array() used to test if choices are user-defined.
- `null` as default value in __construct too.
- `null` as default value for choices in EntityType.
2011-12-13 18:12:20 +01:00
Fabien Potencier
142cef21bb merged 2.0 2011-12-13 16:12:53 +01:00
Fabien Potencier
e3421a0b1d [DoctrineBridge] fixed some CS 2011-12-13 10:22:12 +01:00
Christophe Coevoet
9c1fbb884f [DoctrineBridge] fixed the refreshing of the user for invalid users 2011-12-12 13:36:19 +01:00
Fabien Potencier
fd12796673 merged 2.0 2011-12-11 18:50:50 +01:00
Fabien Potencier
c22652f5d7 merged branch aboks/doctrine_data_collector (PR #2733)
Commits
-------

bb0d202 Switched sanitizeParameter() for existing varToString()-method; now always stores a string representation of each parameter
4fe4dfd Fixed vendor version mismatch in tests
28730e9 [DoctrineBridge] Added unit tests
4535abe [DoctrineBridge] Fixed attempt to serialize non-serializable values

Discussion
----------

[DoctrineBridge] Fixed attempt to serialize non-serializable values

Bug fix: yes
Feature addition: no
Backwards compatibility break: no (99%)
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -

The Doctrine DBAL type system does not pose any restrictions on the php-types of parameters in queries. Hence one could write a doctrine-type that uses a resource or an `\SplFileInfo` as its corresponding php-type. Parameters of these types are logged in the `DoctrineDataCollector` however, which is then serialized in the profiler. Since resources or `\SplFileInfo` variables cannot be serialized this throws an exception.

This PR fixes this problem (for known cases) by sanitizing the query parameters to only contain serializable types. The `isNotSerializable`-check surely is not complete yet, but more non-serializable classes can be added on a case-by-case basis.

---------------------------------------------------------------------------

by fabpot at 2011/12/07 07:04:43 -0800

Tests do not pass for me.

Furthermore, let's reuse what we already have in the framework (see https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/HttpKernel.php#L187 -- yes you can just copy/paster the existing code).

---------------------------------------------------------------------------

by aboks at 2011/12/09 01:41:14 -0800

@fabpot I fixed the tests (seems I had the wrong vendor versions in my copy) and reused the `varToString()`-code. This introduces a tiny BC break in the rare case that someone writes his own templates for the web profiler (the parameters returned by the data collector are now always a string; could be any type before).

After merging this PR, merging 2.0 into master would give a merge conflict and failing tests (because of the changes related to the introduction of the `ManagerRegistry` interface). To prevent this, please merge #2820 into master directly after merging this PR (so before merging 2.0 into master). After that 2.0 can be cleanly merged into master.

---------------------------------------------------------------------------

by stof at 2011/12/09 03:43:38 -0800

it is not a BC break. Using ``yaml_encode`` on a string will not break the template
2011-12-09 16:12:04 +01:00
Arnout Boks
bb0d202250 Switched sanitizeParameter() for existing varToString()-method; now always stores a string representation of each parameter 2011-12-08 18:14:27 +01:00
Fabien Potencier
2134909468 fixed doctrine/common requirements 2011-12-08 15:17:21 +01:00
Jordi Boggiano
18821612bf Adjust doctrine requirements 2011-12-08 15:17:20 +01:00
Fabien Potencier
7e9d53bc93 merged branch beberlei/DoctrineUniqueValidator (PR #2724)
Commits
-------

59397cf [DoctrineBridge] Generalize EntityValidator to work with any validation service and against any Common ClassMetadata provider

Discussion
----------

[DoctrineBridge] Generalize EntityValidator to work with any validation ...

...service and against any Common ClassMetadata provider. Also decoupled the Bridge from its implicit dependency on the "doctrine.orm.vaildator.unique" service.

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: no
2011-12-07 16:09:48 +01:00
Fabien Potencier
30262878f0 merged branch jmikola/2.0-LoaderResolverInterface (PR #2785)
Commits
-------

7c1cbb9 [Config] Use LoaderResolverInterface for type-hinting
48b084e fixed typo
8ad94fb merged branch hhamon/doctrine_bridge_cs (PR #2775)
240796e [Bridge] [Doctrine] fixed coding conventions.
7cfc392 check for session before trying to authentication details
648fae7 merged branch proofek/domcrawlerform-radiodisabled (PR #2768)
3976b7a [DoctrineBridge] fixed CS
9a04783 merged branch beberlei/SecurityEntityRepositoryIdentifierFix (PR #2765)
3c83b89 [DoctrineBridge] Catch user-error when the identifier is not serialized with the User entity.
36c7d03 Fixed GH-2720 - Fix disabled atrribute handling for radio form elements

Discussion
----------

[Config] Use LoaderResolverInterface for type-hinting

```
Bug fix: no
Feature addition: no
Backwards compatibility break: yes
Symfony2 tests pass: yes
Fixes the following tickets: -
```

I've listed this as a BC break because we're changing the argument type-hint, but I think it's unlikely to affect anyone.
2011-12-05 10:21:19 +01:00
Fabien Potencier
48b084eb85 fixed typo 2011-12-03 09:00:15 +01:00
Hugo Hamon
240796e9f3 [Bridge] [Doctrine] fixed coding conventions. 2011-12-02 23:11:12 +01:00
Fabien Potencier
3976b7a5ee [DoctrineBridge] fixed CS 2011-12-02 13:16:59 +01:00
Benjamin Eberlei
3c83b89c5e [DoctrineBridge] Catch user-error when the identifier is not serialized with the User entity. 2011-12-01 20:17:08 +01:00
Arnout Boks
4535abecee [DoctrineBridge] Fixed attempt to serialize non-serializable values 2011-11-27 13:32:13 +01:00
Benjamin Eberlei
59397cf42b [DoctrineBridge] Generalize EntityValidator to work with any validation service and against any Common ClassMetadata provider 2011-11-26 11:36:09 +01:00
Jordi Boggiano
6d5b296787 Adjust doctrine requirements 2011-11-25 16:11:08 +01:00
Fabien Potencier
a7f7be2309 merged 2.0 2011-11-23 23:28:22 +01:00
Jordi Boggiano
c76487ee04 Fix composer.json files to be stricter 2011-11-23 17:51:23 +01:00
Jordi Boggiano
e7215aeb40 Fix composer.json 2011-11-23 16:10:32 +01:00
Fabien Potencier
194f8c0739 merged branch beberlei/DoctrineValidation (PR #2535)
Commits
-------

47ebf08 Fix some bugs
fad825e Add DoctrineValidationPass to DoctrineBundle#buildContainer
a064acd Implement feature to add validations based on the Manager-Type (ORM, MongoDB, CouchDB)

Discussion
----------

[WIP] Validation on a Doctrine Manager Basis

Hello,

we have had problems before with validation that is "persistence" related. Unique-validators or any other validation that is based on services that depend on persistence.

The problem is two-fold:

1. In annotations you cannot define validators for all persistence layers you support, because then users need them all installed.
2. In XML/YAML the same is true, since there is only one validation.xml or validation.yml file looked for.

Now one solution is to have three model classes that extend from a base class to get around this (like FOSUserBundle does) but that is cumbersome. This PR provides a new solution that is Doctrine specific (and takes the responsibility out of the Core).

Each Doctrine Bundle (ORM, CouchDB, MongoDB, PHPCR) can add this compiler pass with a manager type name:

    $container->addCompilerPass(new DoctrineValidationPass('orm'));

This leads to the compiler pass searching for additional validation files "Resources/config/validation.orm.yml" and "Resources/configvalidation.orm.xml".

My first idea was to put this into the Resources/config/doctrine folder as well, but then it is detected as mapping file of course.

Regarding tests, this is not easily testable without a full fledged bundle setup, i tested this inside Acme Demo Bundle, however for a good unit-test we probably need a filesystem abstraction testing layer. Has anyone a good idea how to test this without having to setup another test-bundle? I can't use the one from DoctrineBundle since this code is in the Bridge.

---------------------------------------------------------------------------

by fabpot at 2011/11/13 23:12:06 -0800

@beberlei: Is it still WIP?

---------------------------------------------------------------------------

by beberlei at 2011/11/15 10:47:49 -0800

@fabpot it is complete, but it has no tests, that was the WIP part. :-)

---------------------------------------------------------------------------

by mvrhov at 2011/11/15 23:56:11 -0800

I wanted to refactor how validation is managed today, so it could do one validation file per class, same as with Doctrine but @stof pointed me to this PR. I still find this a great idea as the validation is easier to find.

```php
        foreach ($container->getParameter('kernel.bundles') as $bundle) {
            $reflection = new \ReflectionClass($bundle);
            $bundleDir = dirname($reflection->getFilename());

            //check for per class validation files
            if (is_dir($dir = $bundleDir . '/Resources/config/validation')) {
                $finder = new Finder();
                $finder
                    ->name('*'.$extension)
                    ->in($dir);

                foreach ($finder as $file) {
                    $files[] = realpath($file);
                    $container->addResource(new FileResource($file));
                }
            }

            //global validation file?
            if (is_file($file = $bundleDir . '/Resources/config/validation'.$extension)) {
                $files[] = realpath($file);
                $container->addResource(new FileResource($file));
            }
        }
```
2011-11-22 09:43:50 +01:00
Fabien Potencier
d1ae6c7cb6 bumped Symfony version in composer.json files to 2.0.7 2011-11-17 06:58:47 +01:00
Fabien Potencier
290734353c merged 2.0 2011-11-08 08:38:14 +01:00
Fabien Potencier
9d2ab9ca9c [Doctrine] fixed security user reloading when the user has been changed via a form with validation errors (closes #2033) 2011-11-08 08:33:49 +01:00
Lukas Kahwe Smith
27efd59070 added READMEs for the bridges 2011-11-03 21:29:55 +01:00
Fabien Potencier
f8f622b39c bumped Symfony version to 2.0.6-DEV 2011-11-02 14:18:45 +01:00
Fabien Potencier
7f21a5e979 bumped Symfony version in composer.json files to 2.0.5 2011-11-02 12:42:41 +01:00
Henrik Westphal
316eacb83b Fixed merge conflict. 2011-11-02 09:29:19 +01:00
Fabien Potencier
fd380e37a9 merged 2.0 2011-11-01 20:19:25 +01:00
Fabien Potencier
fc97472f64 updated composer.json files to contain information about autoloading and target dirs 2011-11-01 20:17:57 +01:00
Benjamin Eberlei
47ebf085fd Fix some bugs 2011-11-01 18:09:09 +01:00
Benjamin Eberlei
a064acdcc7 Implement feature to add validations based on the Manager-Type (ORM, MongoDB, CouchDB) 2011-11-01 17:11:28 +01:00
Fabien Potencier
3f38b9c537 merged branch ericclemmons/1735-entity_choice_list_group_by (PR #2464)
Commits
-------

6cb7acf CS - camelCase & curly braces
d9b7abb Added EntityChoiceList test for `group_by` and invalid, deep property paths
e6554d6 Removed Closure support from group_by (PropertyPath strings only)
037933a CS - (String) renamed to (string)
7ad0f05 Added group_by test for EntityType
882482a Added group_by tests for EntityChoiceList
040e988 `EntityChoiceList` now supports grouping of entities by property path or closure
b171a6a Added `group_by` to EntityType

Discussion
----------

[Doctrine] [Form] EntityType+EntityChoiceList supports grouping choices

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #1735

Per the discussion in #1735, `EntityType` does not immediately support grouping options, though I updated support for it in `EntityChoiceList` in fb9d951b1d.

This PR accomplishes the following:

* Adds optional `group_by` property to `EntityType` that supports either a `PropertyPath` or a `\Closure` that is evaluated on the entity choices
* Support for groups is added via the constructor in `EntityChoiceList`
* Groups are created prior to `EntityChoiceList#loadEntities` via a new `groupEntities` function
* Added tests for `EntityChoiceList`
* Added test for `EntityType` `group_by` support

*There is an alternative version that only modifies `EntityType`, but that requires the addition of `EntityType#buildView(...)`, which is messy, IMO: https://github.com/ericclemmons/symfony/compare/master...1735-entity_type_group_by*

---------------------------------------------------------------------------

by fabpot at 2011/10/25 01:48:23 -0700

ping @beberlei

---------------------------------------------------------------------------

by beberlei at 2011/10/25 03:06:05 -0700

I didnt run the tests, but generally this looks very good and is a good extension.

---------------------------------------------------------------------------

by beberlei at 2011/11/01 06:25:09 -0700

@fabpot i revewied this and it looks very good, tests all pass, i think this is a very nice addition.
2011-11-01 15:23:39 +01:00
Fabien Potencier
d633d60672 merged branch beberlei/RemoveAbtractDoctrineBundle (PR #2484)
Commits
-------

661421f [Doctrine] Remove AbstractDoctrineBundle and move code into Doctrine Bridge

Discussion
----------

[WIP] [Doctrine] Remove abtract doctrine bundle

Remove AbstractDoctrineBundle and move code into Doctrine Bridge. It is a BC break because all the "other" Doctrine Bundles MongoDB ODM, CouchDB ODM and PHPCR need to be updated to cope with this.

I will prepare PRs for them aswell and then remove the [WIP] here.

Bug fix: no
Feature addition: no
Backwards compatibility break: yes
Symfony2 tests pass: yes
Fixes the following tickets: #2463

---------------------------------------------------------------------------

by beberlei at 2011/10/26 12:32:51 -0700

Here are all 3 PRs, can we coordinate on merging them somehow?

https://github.com/symfony/DoctrineMongoDBBundle/pull/50
https://github.com/symfony-cmf/symfony-cmf/pull/118
https://github.com/doctrine/DoctrineCouchDBBundle/pull/4

---------------------------------------------------------------------------

by beberlei at 2011/10/26 12:33:38 -0700

Ping @lsmith77 @jwage

---------------------------------------------------------------------------

by lsmith77 at 2011/10/26 12:35:29 -0700

all good for me ..

---------------------------------------------------------------------------

by stof at 2011/10/26 14:58:01 -0700

Well, this does not fix #2463. A change done in the bridge will still be able to break the service definitions of the other bundles or require tricky stuff to keep different versions of the logic.

---------------------------------------------------------------------------

by beberlei at 2011/10/26 22:49:39 -0700

@stof true, that is what https://github.com/doctrine/common/pull/71 will be about.

---------------------------------------------------------------------------

by stloyd at 2011/10/26 23:51:25 -0700

Comment just for linking cross PRs and for watching ;-) doctrine/common#71

---------------------------------------------------------------------------

by lsmith77 at 2011/10/31 08:18:45 -0700

please add forward compatibly into symfony 2.0 as per #2522

---------------------------------------------------------------------------

by beberlei at 2011/11/01 05:11:34 -0700

This doesn't make sense imho, since the number of people using the doctrine extension is 4 and everybody also prepared their pull request for this.

The problem is really that we need a branch for the MongoDB Bundle

---------------------------------------------------------------------------

by beberlei at 2011/11/01 05:40:49 -0700

@fabpot i created a branch in MongoDBBundle for 2.0 so this is ready to be merged.
2011-11-01 15:21:25 +01:00
Fabien Potencier
d34d50f0b0 fixed CS 2011-10-29 12:05:45 +02:00
Fabien Potencier
8550f372fb removed unused use statements 2011-10-29 12:01:53 +02:00
Fabien Potencier
dec43f5539 merged 2.0 2011-10-29 12:01:39 +02:00
Fabien Potencier
851eb73778 removed unused use statements 2011-10-29 11:56:30 +02:00
Benjamin Eberlei
661421ff7c [Doctrine] Remove AbstractDoctrineBundle and move code into Doctrine Bridge 2011-10-26 20:40:48 +02:00
Eric Clemmons
e6554d6d45 Removed Closure support from group_by (PropertyPath strings only) 2011-10-25 08:55:31 -07:00
Eric Clemmons
037933a2ec CS - (String) renamed to (string) 2011-10-25 08:45:23 -07:00
Fabien Potencier
a4d4d4c1f8 merged branch mvrhov/dbal_sessstorage_fix (PR #2384)
Commits
-------

0907111 session data needs to be encoded because it can contain non binary safe characters e.g null. Fixes #2067

Discussion
----------

session data needs to be encoded because it can contain non binary safe characters e.g null., part 2

Bug fix: yes
Feature addition: no
Backwards compatibility break: yes
Symfony2 tests pass: yes
Fixes the following tickets: #2067

I'm marking this as a compatibility break because session table should be cleared and even if not cleared all currently logged in users will be logged out.

This is the fix for a same issue in DBAL session storage made against master.

---------------------------------------------------------------------------

by schmittjoh at 2011/10/12 02:44:19 -0700

If I understand this correctly, only the PgSqlPlatform is affected by this. What do you think about adding an ``ìnstanceof PgSqlPlatform`` check?

---------------------------------------------------------------------------

by mvrhov at 2011/10/12 03:47:52 -0700

It's the same for sqlite, it just happens that mysql escapes \0, so we can say it's driver dependent.
The Drupal guys had the same issue http://drupal.org/node/690746 , they changed to column type to bytea for pgsql and for mysql to blob, also in Drupal report you can find that storing this into a session hash_file('md5', 'CHANGELOG.txt', TRUE) will trigger the similar problem in mysql.
The other thing to consider is what I mentioned in original bugreport, e.g igbinary as default serializer for session data.
2011-10-25 17:18:25 +02:00
Eric Clemmons
040e988f0c EntityChoiceList now supports grouping of entities by property path or closure 2011-10-24 18:45:26 -07:00
Eric Clemmons
b171a6a8a3 Added group_by to EntityType 2011-10-24 18:45:06 -07:00
Fabien Potencier
842ac36f33 added Stopwatch support in debug mode, added a timeline representing the stopwatch events in the web profiler
Enjoy!
2011-10-21 07:45:12 +02:00
Fabien Potencier
de9cf88676 merged 2.0 2011-10-17 02:33:13 +02:00
Fabien Potencier
b8360d83f0 merged branch stof/doctrine_registry (PR #2410)
Commits
-------

9546ee6 Removed the IndexedReader
ea2cf73 Refactored the validator initializer
c6063ec [DoctrineBundle] Updated the code to use the new registry
a1784c2 [DoctrineBridge] Updated the code to use the new registry

Discussion
----------

Doctrine registry

This updates the Doctrine bridge and DoctrineBundle to use the new ManagerRegistry interface and its methods instead of using the old methods which are marked as deprecated.
2011-10-16 22:40:57 +02:00
Christophe Coevoet
9546ee6d29 Removed the IndexedReader
The ORM now supports using a standard reader and does the needed logic
internally.
The IndexedReader is also available in Common for people needing it.
2011-10-16 17:59:31 +02:00
Christophe Coevoet
ea2cf73715 Refactored the validator initializer
It can now be reused for all Doctrine projects, not only for the ORM.
2011-10-16 17:13:11 +02:00
Christophe Coevoet
a1784c2b97 [DoctrineBridge] Updated the code to use the new registry 2011-10-16 14:57:14 +02:00
Lukas Kahwe Smith
18cca22b3f cleaned up the use statements in the Registry class and RegistryInterface 2011-10-16 13:51:14 +02:00
Tobias Schultze
2009249128 fixed language 2011-10-16 07:51:23 +03:00
Fabien Potencier
f1e9709742 updated composer.json files 2011-10-16 03:38:02 +02:00
Fabien Potencier
ae8efc4da9 merged 2.0 2011-10-16 03:34:55 +02:00
Igor Wiedler
225b512b67 [composer] make doctrine dbal and orm recommended by doctrine-bridge 2011-10-15 16:56:23 +02:00
Igor Wiedler
575771380b [composer] add doctrine and twig dependencies 2011-10-15 16:55:54 +02:00
Fabien Potencier
fe04e7fbc4 merged branch lsmith77/registry_interface_tweak (PR #2397)
Commits
-------

41ab1f7 updated RegistryInterface for https://github.com/doctrine/common/pull/68

Discussion
----------

[Doctrine] updated RegistryInterface

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -

We tweaked the ManagerRegistry interface in https://github.com/doctrine/common/pull/68
So this PR just fixes the RegistryInterface as the PR was merged
2011-10-15 12:28:44 +02:00
Lukas Kahwe Smith
41ab1f78f7 updated RegistryInterface for https://github.com/doctrine/common/pull/68 2011-10-15 11:26:58 +02:00
Fabien Potencier
6b3c7ac62d Merge branch '2.0'
* 2.0:
  [Doctrine] GH-1635 - UniqueValidator now works with associations
2011-10-15 11:07:39 +02:00
Benjamin Eberlei
9d8046e407 [Doctrine] GH-1635 - UniqueValidator now works with associations 2011-10-15 09:20:06 +02:00
Fabien Potencier
3ca1ccbf67 [DoctrineBridge] removed the Xml and Yaml driver as they are now part of Doctrine 2011-10-15 04:25:55 +02:00
Fabien Potencier
ec45893c2d merged branch lsmith77/ManagerRegistry (PR #2244)
Commits
-------

dc5772d use ORM master
4364463 use doctrine-common master
55b572d fixed getting the alias for a namespace
2b89e15 use getObjectNamespace() in getEntityNamespace()
0217a0e updated base class name
e8f3c21 updated vendors to point to lsmith77's fork of doctrine-common until its merged
6e87d01 fix tests
13c2f33 added a default implementation of the ManagerRegistry integrating the container

Discussion
----------

[Doctrine] added a default implementation of the ManagerRegistry

Bug fix: no
Feature addition: yes
Backwards compatibility break: yes (minor change in the interface see below)
Symfony2 tests pass: yes
Fixes the following tickets: -

added a default implementation of the ManagerRegistry integrating the container

attempted to maintain BC as good as possible, but RegistryInterface::getRepository() had to be dropped from RegistryInterface. Its still part of the ManagerRegistry, so its only a BC break for people using RegistryInterface to create their own implementation as I ran into https://bugs.php.net/bug.php?id=43200

all implementation (ORM/ODM) will need to match the changes to the ClassMetadataFactory interface

ORM, PHPCR, CouchDB have been upgraded already.
The Bundles also need to be updated. ORM is covered with this PR, I have a PR ready for PHPCR:
https://github.com/symfony-cmf/symfony-cmf/pull/108

also note that before merging the change to vendors.php needs to be fixed to point to the right repo again

For MongoDB it currently does not yet have a registry and I can take care of CouchDB once this is all merged.

---------------------------------------------------------------------------

by lsmith77 at 2011/09/23 00:40:07 -0700

still a few failing tests and details still need to be discussed ..

---------------------------------------------------------------------------

by lsmith77 at 2011/09/23 00:53:23 -0700

ok .. tests are passing now

---------------------------------------------------------------------------

by lsmith77 at 2011/10/11 10:27:52 -0700

ok Doctrine/ORM updates are done .. PR updated .. ready to be merged.
2011-10-15 03:38:50 +02:00
Fabien Potencier
4dc5953100 merged 2.0 2011-10-15 00:56:57 +02:00
Miha Vrhovnik
090711183d session data needs to be encoded because it can contain non binary safe
characters e.g null. Fixes #2067
2011-10-12 10:35:39 +02:00
Ryan Weaver
2270a4da5a [Bridge][Doctrine] Adding a catch for when a developer uses the EntityType with multiple=false but on a "hasMany" relationship
Without this, the exception is eventually thrown in EntityChoiceList::getIdentifierValues() with a very a message that doesn't really suit the real error: "Entities passed to the choice field must be managed"
2011-10-10 08:26:22 -05:00
Fabien Potencier
b25a8767ad merged branch schmittjoh/dbalSessionStorage (PR #2182)
Commits
-------

3f8e8c9 fixes a session max lifetime handling
3abb7f3 fixed some conflicts with garbage collection
a1888b2 added a dbal session storage

Discussion
----------

Dbal session storage

Adds a session storage based on Doctrine DBAL.

---------------------------------------------------------------------------

by lsmith77 at 2011/09/14 13:39:28 -0700

guess it would be nice to then provide a service inside the DoctrineBundle that reuses a global DoctrineDBAL connection, guess the connection to use would then need to be configured via the doctrine app config.

---------------------------------------------------------------------------

by schmittjoh at 2011/09/14 13:42:34 -0700

I haven't found a sane way to provide automatic configuration that's why I left this to the user to implement. It's also relatively easy:

```yml
services:
    dbal_session_storage:
        class: Symfony\Bridge\Doctrine\HttpFoundation\DbalSessionStorage
        arguments: [@database_connection]

framework:
    session: { storage_id: dbal_session_storage }

---------------------------------------------------------------------------

by stof at 2011/09/14 13:57:48 -0700

@lsmith77 There is an issue about reusing another DBAL connection: if the transaction is aborted by the ORM, the session could be aborted too as you cannot have 2 independent transactions AFAIK

---------------------------------------------------------------------------

by lsmith77 at 2011/09/14 13:59:57 -0700

not sure how this is relevant. i mean why does the transaction need to be left open? just begin, write, commit ..

---------------------------------------------------------------------------

by stof at 2011/09/14 14:02:39 -0700

and what if the transaction of the ORM is still opened (let's say you use SimpleThingsTransactionalBundle) ?

---------------------------------------------------------------------------

by lsmith77 at 2011/09/14 14:06:12 -0700

well thats a bit of an edge case imho. also i wonder if SimpleThingsTransactionalBundle shouldn't make sure that its transaction is closed before the session is written.

---------------------------------------------------------------------------

by schmittjoh at 2011/09/14 14:06:56 -0700

It closes them.

On Wed, Sep 14, 2011 at 11:06 PM, Lukas Kahwe Smith <
reply@reply.github.com>wrote:

> well thats a bit of an edge case imho. also i wonder if
> SimpleThingsTransactionalBundle shouldn't make sure that its transaction is
> closed before the session is written.
>
> --
> Reply to this email directly or view it on GitHub:
> https://github.com/symfony/symfony/pull/2182#issuecomment-2098100
>

---------------------------------------------------------------------------

by stof at 2011/09/14 14:15:02 -0700

@schmittjoh Does it close them **before** writing the session ?

---------------------------------------------------------------------------

by schmittjoh at 2011/09/14 14:44:15 -0700

I think either commit, or rollback is called, but @beberlei can probably answer that better.

Anyway, it is not really related to this PR because it is up to the user which connection is used.

---------------------------------------------------------------------------

by stof at 2011/09/14 14:58:48 -0700

I know that one of them is called. But if they are called after the session is persisted to the DB, a rollback is an issue as it will rollback the session persistence as well.
The PR is indeed fine. What need to be changed is the doc about how to use it, to advocate using a separate connection instead of the default one (which is used in your example)

---------------------------------------------------------------------------

by schmittjoh at 2011/09/15 02:57:34 -0700

There is no doc yet, but lets see what @fabpot thinks of all of this first.

---------------------------------------------------------------------------

by fabpot at 2011/09/15 04:57:57 -0700

Any benefits over using the PDO session storage?

---------------------------------------------------------------------------

by lsmith77 at 2011/09/15 05:00:50 -0700

cleaner code, potentially better support for niche RDBMS, centralized logging and finally afaik DoctrineDBAL has emulation for nested transactions.

---------------------------------------------------------------------------

by schmittjoh at 2011/09/15 05:11:00 -0700

The benefits (for me) are:

- logging queries
- better interoperability with existing build processes (migrations)
- better database interoperability
- re-using existing connection (I don't have the problem that Stof mentioned above)

---------------------------------------------------------------------------

by beberlei at 2011/09/15 06:18:22 -0700

The nested transactions is the problem here as @stof already said. If you reuse the default connection and use nested transactions that fail then this will make your session not save. That is why the docs should recommend you create a second connection for a dbal based session storage, even if it is using the same database. The PDO session storage would be a second connection besides DBAL aswell.

I like the migrations/schema hook though to create the table automatically through schema commands.

---------------------------------------------------------------------------

by fabpot at 2011/09/15 10:45:31 -0700

ok, looks good to me. Can you add some documentation about its usage (like the possible keys for options)? Is it possible to add some tests too?

---------------------------------------------------------------------------

by jdreesen at 2011/09/22 06:34:11 -0700

why did you close this?

---------------------------------------------------------------------------

by schmittjoh at 2011/09/30 06:26:12 -0700

I can't put more time into this PR, however I'm using it for some time already, and there shouldn't be any major issues as it is basically copy/paste from the PDO session.
2011-10-07 14:11:24 +02:00
Fabien Potencier
fbe9aa526e merged 2.0 2011-10-04 09:32:13 +02:00
Fabien Potencier
8d6add638b [DoctrineBridge] fixed directory reference when the directory cannot be created 2011-10-03 08:58:15 +02:00
Fabien Potencier
245ff6d7a8 updated composer.json for 2.1 2011-09-29 17:40:43 +02:00
Fabien Potencier
f5ab6ec934 Merge branch '2.0'
* 2.0:
  [composer] add missing deps for FrameworkBundle
  [composer] change ext/intl to the new ext-intl syntax
  [composer] fix monolog-bridge composer.json, add more inter-component deps
  [composer] add composer.json
2011-09-29 17:29:32 +02:00
Igor Wiedler
9ade639bb4 [composer] add composer.json 2011-09-27 00:55:43 +02:00
Lukas Kahwe Smith
55b572d4f1 fixed getting the alias for a namespace 2011-09-25 14:23:16 +02:00
Lukas Kahwe Smith
0217a0ee41 updated base class name 2011-09-25 13:49:39 +02:00
Lukas Kahwe Smith
13c2f33af8 added a default implementation of the ManagerRegistry integrating the container
attempted to maintain BC as good as possible, but RegistryInterface::getRepository() had to be dropped from RegistryInterface. Its still part of the ManagerRegistry, so its only a BC break for people using RegistryInterface to create their own implementation
2011-09-23 09:26:24 +02:00
Johannes Schmitt
3f8e8c9fbd fixes a session max lifetime handling 2011-09-19 23:18:09 +02:00
Marek Kalnik
4ca09a931d [Validator] Validate object with it's own entity manager by default 2011-09-15 11:16:53 +02:00
Johannes Schmitt
3abb7f3a69 fixed some conflicts with garbage collection 2011-09-14 22:26:10 +02:00
Johannes Schmitt
a1888b2f01 added a dbal session storage 2011-09-14 22:26:09 +02:00
Fabien Potencier
e7b2d2d659 merged 2.0 branch 2011-09-04 09:28:37 +02:00
Fabien Potencier
6677dabda5 merged branch jmikola/entity-validator (PR #2076)
Commits
-------

d19f1d7 [Doctrine] Fix UniqueEntityValidator reporting a false positive by ignoring multiple query results

Discussion
----------

[Doctrine] Fix UniqueEntityValidator reporting a false positive by ignoring multiple query results

An entity should only be considered unique if its search criteria returns no matches or a single, identical entity. Multiple results indicates that conflicting entities exist.

Note: the DoctrineMongoDBBundle's unique validator checks identifier values if the object strict-equality check is false. This may be a worthwhile improvement, as it would prevent reporting a validation error for an enttiy which is going to overwrite its conflicting counter-part in the database.

---------------------------------------------------------------------------

by jmikola at 2011/09/01 14:23:27 -0700

This is the Doctrine bridge equivalent for my fix to DoctrineMongoDBBundle: https://github.com/symfony/DoctrineMongoDBBundle/pull/42

---------------------------------------------------------------------------

by fabpot at 2011/09/02 00:13:52 -0700

As this is a bug fix, can you base your PR on the symfony/2.0 branch? Thanks.
2011-09-02 09:43:19 +02:00
Jeremy Mikola
d19f1d7621 [Doctrine] Fix UniqueEntityValidator reporting a false positive by ignoring multiple query results
An entity should only be considered unique if its search criteria returns no matches or a single, identical entity. Multiple results indicates that conflicting entities exist.
2011-09-01 17:20:30 -04:00
Fabien Potencier
78346ae43b merged branch elnur/entities-to-array-transformer (PR #2053)
Commits
-------

6bd1749 Fixed a bug when multiple expanded choices would render unchecked because of the Form Framework's strict type checking.

Discussion
----------

[DoctrineBridge] Entities to array transformer

Fixed a bug when multiple expanded choices would render unchecked because of the Form Framework's strict type checking.

---------------------------------------------------------------------------

by fabpot at 2011/08/31 09:01:47 -0700

Looks good to me. Can you squash your commits before I merge? Thanks.
2011-09-01 11:00:54 +02:00
Elnur Abdurrakhimov
6bd1749553 Fixed a bug when multiple expanded choices would render unchecked because of the Form Framework's strict type checking. 2011-08-31 20:27:38 +04:00
Brikou CARRE
f4c133efbb removed trailing dot to make it consistent with other validator messages 2011-08-31 08:56:13 +02:00
Fabien Potencier
0eae562cb2 converted file_exists calls to either is_file or is_dir where it makes sense 2011-08-29 15:28:26 +02:00
Fabien Potencier
d3a69e3531 [DoctrineBundle] renamed RegistryInterface::getEntityManagerForObject() to getEntityManagerForClass() 2011-07-19 19:24:57 +02:00
Christophe Coevoet
5d17b9207c [DoctrineBridge] Optimized the mapping drivers 2011-07-18 18:58:02 +02:00
Jan Behrens
86b96f4f81 Added missing import of UserInterface. 2011-07-13 04:30:07 -07:00
Jan Behrens
88fd076133 Added missing import of UserProviderInterface. 2011-07-13 04:16:24 -07:00
marc.weistroff
26e96c4ab0 [DoctrineBridge] Changed namespace of EntityUserProvider[B 2011-07-13 08:44:37 +02:00
marc.weistroff
1633cb30bd [Security] Moved EntityUserProvider to Doctrine Bridge 2011-07-13 08:41:17 +02:00
Benjamin Eberlei
08b4219347 [DoctrineBridge] Issue #1376 - Unique Validator does not work with null values 2011-07-10 11:06:21 +02:00
Fabien Potencier
c12676b0a1 [Doctrine] added a better error message when an Entity has no __toString method defined 2011-07-06 18:10:55 +02:00
Fabien Potencier
082473659e fixed validation of Doctrine proxy objects 2011-07-06 13:03:38 +02:00
Fabien Potencier
090a51a0fe added Registry::getEntityManagerForObject() to conveniently get the entity manager associated with a given Entity 2011-07-06 12:33:49 +02:00
Fabien Potencier
d3b78075f0 [Doctrine] fixed Doctrine guesser when the object is a proxy and not an original entity instance
After this patch, the guesser is run for regular entity instances and proxy instances.
2011-07-06 08:53:29 +02:00
Johannes Schmitt
1cc102788b added @Annotation to UniqueEntity 2011-06-30 12:36:37 +02:00
Fabien Potencier
f57e1d3e10 fixed CS 2011-06-23 14:07:53 +02:00
Christian Raue
c17a836985 typo 2011-06-20 23:14:48 -07:00
Fabien Potencier
fb24b95bd5 made some tweaks to error levels 2011-06-15 13:04:19 +02:00
Fabien Potencier
a232c148eb fixed CS 2011-06-14 12:54:32 +02:00
Fabien Potencier
0ec604cb1e Merge remote branch 'mschneid/master'
* mschneid/master:
  Fix array access
2011-06-13 11:12:46 +02:00
Michael Schneider
fdab1955f8 Fix array access
If you provide only one field as string you're not able to access the $constraint->fields as an array. Use $fields instead.
2011-06-12 23:48:17 +02:00
Christian Raue
99eb3a120d typo 2011-06-12 11:59:47 -07:00
Fabien Potencier
293ba3426a [DoctrineBridge] fixed guesser 2011-06-10 19:41:49 +02:00
Fabien Potencier
e685b5fc21 Merge remote branch 'yethee/doctrine_bridge'
* yethee/doctrine_bridge:
  [DoctrineBridge] Removed all options of the parent type
  [DoctrineBridge] Removed unneeded use statement
  [DoctrineBridge] Fixed typo
  [DoctrineBridge] Removed duplicating options in EntityType
2011-06-08 19:51:57 +02:00
Fabien Potencier
e0b768bfc0 [DoctrineBridge] fixed typo 2011-06-08 19:34:26 +02:00
Deni
70477c4995 [DoctrineBridge] Removed all options of the parent type 2011-06-08 20:39:16 +04:00
Deni
40d358e7cb [DoctrineBridge] Removed unneeded use statement 2011-06-08 19:01:33 +04:00
Deni
1a75b7c8ca [DoctrineBridge] Fixed typo 2011-06-08 18:52:54 +04:00
Deni
3bbec2e6a7 [DoctrineBridge] Removed duplicating options in EntityType 2011-06-08 18:46:38 +04:00
Fabien Potencier
1aabc5da64 fixed CS 2011-06-08 12:16:48 +02:00
Fabien Potencier
62e4342a86 fixed CS 2011-06-08 12:12:55 +02:00
Fabien Potencier
2d91183d86 [DoctrineBridge] fixed field guesser 2011-06-08 09:45:44 +02:00
Fabien Potencier
879242cdf5 moved some Doctrine classes from the bundle to the bridge 2011-06-08 08:41:44 +02:00
Fabien Potencier
fbf36957e6 refactored Doctrine Bridge
* added a RegistryInterface

 * changed all classes to depend on the Registry instead of a specific EntityManager

This is more consistent as the validator already took the registry and this allows
to use any entity manager in Forms.
2011-06-08 08:35:48 +02:00
Pascal Borreli
404c452c0b [Various] Phpdoc & typos 2011-06-04 15:30:56 +00:00
Fabien Potencier
79e709cdc9 removed the ON_ prefix for Form event names 2011-05-31 07:19:18 +02:00
Fabien Potencier
4753bb2e91 - 2011-05-30 13:53:46 +02:00
Fabien Potencier
9b7e14dd10 [Form] converted code to the new event dispatcher 2011-05-30 09:37:42 +02:00
Pascal Borreli
46cdf02750 [Various] Fixed typo 2011-05-29 14:19:02 +00:00
Fabien Potencier
610583899d Merge remote branch 'CodeMeme/889-EntityChoiceField-grouped-choices'
* CodeMeme/889-EntityChoiceField-grouped-choices:
  Whitespace cleanup
  Fixed EntityChoiceList to support grouped entities Refs #889
  Added test for grouped entity choice list Refs #889
2011-05-27 07:44:35 +02:00
Eric Clemmons
fb9d951b1d Fixed EntityChoiceList to support grouped entities
Refs #889
2011-05-26 18:59:21 -07:00
jdhoek
cc5a100418 Add missing {} around @inheritDoc to fix this class in SF beta2. 2011-05-24 00:41:35 -07:00
Fabien Potencier
9fe1c3ae0e Merge remote branch 'bschussek/form'
* bschussek/form: (22 commits)
  Fix merge error (function "guess" was in there twice)
  [Form] Added test case for bf2f9d2a02
  [Form] Form::isBound() and Form::isValid() work correctly now for read-only forms
  [Locale] Improved error reporting and added stubs for intl_is_failure(), intl_get_error_code() and intl_get_error_message()
  [Form] Implemented fix for 361c67f54f
  [Form] Add test for the handling of array values in the constraint violation
  [Form] Further simplified PropertyPath code
  [Form] Added test for 6c337d1cc0
  [Form] Removed unused option "pattern" of date and time type
  [Form] Renamed view variable "name" to "full_name"
  [Form] Renamed collection option "type_options" to "options" to be consistent with the repeated type
  [Form] CSRF documentation and a few CS changes
  [Form] Move CSRF options from types to the CSRF extension
  [Form] Added a search form field type
  [Form] Optimization of PropertyPath
  [Form] replace assertEquals by assertFalse, assertTrue, assertNull
  [Form] fix file permissions to 644 again ;)
  [Form] add tests for type_options in collectionType
  fix file permissions to 644
  [Form] add type_options for CollectionType to be abble to set options to type
  ...
2011-05-19 16:25:30 +02:00
Benjamin Eberlei
a4f1b8a0c1 [Doctrine] Fix default value to null for entity manager to make fluent integration with Doctrine Registry work 2011-05-18 23:26:20 +02:00
Benjamin Eberlei
23cf63d767 [Doctrine] Add fields as default option and allow strings to be passed. 2011-05-18 23:25:16 +02:00
Benjamin Eberlei
8ff1d09d36 [Doctrine] Implement suggested changes by Stof, added functional test to verify unique validator works. 2011-05-18 22:57:25 +02:00
Bernhard Schussek
216d7e415d Merge remote branch 'mweimerskirch/form_pattern_attribute' into mweimerskirch_merge
Conflicts:
	src/Symfony/Bundle/TwigBundle/Resources/views/Form/div_layout.html.twig
	src/Symfony/Component/Form/Extension/Core/Type/FieldType.php
	src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php
2011-05-18 22:49:27 +02:00
Benjamin Eberlei
cfc2471109 [Doctrine] Add Unique Validator 2011-05-17 23:04:13 +02:00
Victor Berchet
42698608cb [Form] CS related changes 2011-05-15 21:39:22 +02:00
Bernhard Schussek
486a01bfe2 [Form] Removed unused option 2011-05-13 18:56:09 +02:00
Michel Weimerskirch
476644a92c [Form] Support for the HTML5 "pattern" attribute, see http://www.whatwg.org/specs/web-apps/current-work/multipage/common-input-element-attributes.html#the-pattern-attribute
If you use the MinLength validator with your entities, the ValidatorTypeGuesser gets the value, stored as "minlength". Then, the FormFactory generates a "pattern" attribute out of minlength and maxlength.
Modern browsers such as Chrome use this attribute to validate the form before submitting.
a "pattern" attribute is generated that validates the
2011-05-04 23:16:41 +02:00
Daniel Holmes
dd692c0203 [Form] fixed transformation failed exception 2011-05-04 05:51:03 -07:00
Pascal Borreli
391744719a Various typos 2011-04-30 19:40:15 +00:00
Fabien Potencier
4fb1035578 fixed Doctrine EntityType when the identifier is a string 2011-04-28 08:39:14 +02:00
Eriksen Costa
164ce5210d capitalized 'boolean' 2011-04-27 02:35:10 -03:00
Fabien Potencier
08bf2af455 fixed email 2011-04-24 13:59:46 +02:00
Pascal Borreli
8c0beea677 [Phpdoc] Cleaning/fixing 2011-04-23 15:18:47 +00:00
Fabien Potencier
9a4da005a2 Merge remote branch 'bschussek/form-extensions'
* bschussek/form-extensions:
  [Form] Refactored code from CoreExtension to new ValidatorExtension
  [Form] Added FormTypeExtensionInterface
  [Form] Reorganized code into "form extensions"
2011-04-23 09:11:25 +02:00
Pascal Borreli
b5769c52d6 Fixed various typo 2011-04-22 23:12:50 +00:00
Bernhard Schussek
54e66c518f [Form] Reorganized code into "form extensions"
The extension classes are now the only constructor argument of the FormFactory class. They replace the existing "type loader" classes.

    new FormFactory(array(
        new CoreExtension($validator, $storage),
        new CsrfExtension($csrfProvider),
        new DoctrineOrmExtension($em),
    ));

Together with a few upcoming commits this mechanism will make

 * extension of the form framework in bundles and
 * usage of the forms outside of Symfony2

much easier.
2011-04-22 17:41:21 +02:00
Fabien Potencier
4bb823fda4 [Form] added missing interfaces 2011-04-18 10:54:34 +02:00
Fabien Potencier
3a2ca3dd92 moved Doctrine2 Entity Type guesser to the Doctrine bridge 2011-04-18 08:44:37 +02:00
Bernhard Schussek
fa457b1cc4 [Form] Renamed 'filter' listeners to 'on' to match naming conventions across the framework 2011-04-15 10:57:32 +02:00
Bernhard Schussek
a5d0b3aea6 [Form] Changed FormBuilder::set(Client|Norm)Transformer to FormBuilder::prepend(Client|Norm)Transformer and FormBuilder::append(Client|Norm)Transformer to facilitate extension of types 2011-04-02 16:39:19 +02:00
Bernhard Schussek
be9ef42af9 [Form] Renamed choice transformers for better clarity 2011-04-02 16:11:20 +02:00
Bernhard Schussek
a4bbc40ac6 [Form] Cleaned up ChoiceListInterface 2011-04-02 15:41:43 +02:00
Bernhard Schussek
d3c8647f49 [Form] Fixed EntitiesToArrayTransformer::reverseTransform() to accept NULL values 2011-04-02 14:13:16 +02:00
Bernhard Schussek
edfae73cd4 [Form] Moved PropertyPath, PropertyPathIterator and VirtualFormAwareIterator to subnamespace Util 2011-03-27 15:37:13 +02:00
Bernhard Schussek
89361d036f [Form] Renamed FormType::configure() to FormType::buildForm() 2011-03-26 18:52:24 +01:00
Bernhard Schussek
40ee22c8b4 [Form] Fixed call to DataEvent::getForm() in Doctrine bridge 2011-03-25 02:17:40 +01:00
Benjamin Eberlei
ee96ad0e81 [Form] [DoctrineBridge] Move EntityType and DoctrineTypeLoader into Doctrine Bridge 2011-03-24 22:43:00 +01:00