Commit Graph

2678 Commits

Author SHA1 Message Date
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
70e0dba77c moved the Swiftmailer data collector to the Swifmailer bridge 2011-10-24 17:10:29 +02:00
Jordi Boggiano
27d080984c [MonologBridge] Adjust for Monolog 1.0.2 2011-10-24 12:01:46 +02: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
Christophe Coevoet
3aa75828b0 [TwigBridge] Added the translation domain 2011-10-10 18:08:37 +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
Danny Berger
e70c884f49 [Bridge/Monolog] Fix WebProcessor to accept a Request object. 2011-09-30 01:58:45 -04: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
Fabien Potencier
5c760b0d40 merged branch igorw/composer (PR #2275)
Commits
-------

731b28b [composer] add missing deps for FrameworkBundle
9c8f100 [composer] change ext/intl to the new ext-intl syntax
d535afe [composer] fix monolog-bridge composer.json, add more inter-component deps
9ade639 [composer] add composer.json

Discussion
----------

Composer

This PR adds a composer.json file for [composer](https://github.com/composer/composer) ([more info](packagist.org/about-composer)).

For discussion you can also go into #composer-dev on freenode and argue with naderman, seldaek and everzet.

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

by naderman at 2011/09/26 15:51:51 -0700

You haven't entered any keywords, they might come in handy when searching for packages on packagist.

But really this is just a +1 ;-)

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

by stof at 2011/09/26 16:12:21 -0700

See my comments on your previous (non-rebased) commit: f1c0242b5a

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

by igorw at 2011/09/27 00:04:36 -0700

Following dependencies do not have a composer.json yet: Twig, Doctrine (orm, dbal, common), swiftmailer.

Also missing from the standard edition: assetic, twig-extensions, jsm-metadata, SensioFrameworkExtraBundle, JMSSecurityExtraBundle, SensioDistributionBundle, SensioGeneratorBundle, AsseticBundle.

The point is, those can be added later on. Having the components composerized is already a leap forward. Also, doctrine depends on some symfony components, we've got to start somewhere.

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

by Seldaek at 2011/09/27 00:36:41 -0700

Also, just for information, the plan is to have `symfony/framework-bundle` be the "framework", with all dependencies to doctrine etc, though we should really only have strict requirements in there, and then in symfony-standard we ship a composer.json that requires the framework-bundle, doctrine-orm and things like that that are not essential to core. Otherwise people don't have a choice about what they use anymore.

Just a comment btw, the json is invalid, all / should be escaped. However json_decode is nice enough to parse those without complaining, browsers do too, even Crockford's json2.js does, so I'm not sure if we should privilege readability over strictness, since it seems nobody really cares about this escaping.

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

by igorw at 2011/09/27 00:41:39 -0700

So, I've implemented all of @stof's suggestions, except (for reasons stated above):

* doctrine to DoctrineBundle
* swiftmailer to SwiftmailerBundle
* twig to TwigBundle
* doctrine-common to Validator
* FrameworkBundle (what exactly does it depend on?)

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

by stof at 2011/09/27 00:52:31 -0700

@igorw at least HttpKernel, Routing, Templating, EventDispatcher, Doctrine Common (annotations cannot be disabled), Translator, Form (optional), Validator (optional), Console (optional). See the service definitions to see the others

@Seldaek FrameworkBundle does not depend on Doctrine, except for Common

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

by beberlei at 2011/09/27 03:15:34 -0700

What does the symfony/ or ext/ prefix control in composer?

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

by Seldaek at 2011/09/27 03:33:52 -0700

symfony/ is just the (mandatory) vendor namespace. Also ext/ has been renamed to ext- now, so it's not in any vendor, and should avoid potential issues.

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

by beberlei at 2011/09/27 05:07:03 -0700

@Seldaek Mandatory? So every package name is "vendor/package"? I like that because previously i thought package names are not namespaced, and thus clashes could occur between different communities easily.

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

by Seldaek at 2011/09/27 05:16:20 -0700

@beberlei: Mandatory. As of yesterday http://packagist.org/ will tell you you have an invalid package name if there's no slash in it. See 1306d1ca82 (diff-3)
2011-09-29 17:27:38 +02:00
Fabien Potencier
41a55ba8d7 Merge branch '2.0'
* 2.0:
  [Validator] added support for grapheme_strlen when mbstring is not installed but intl is installed
  removed separator of choice widget when the separator is null
2011-09-29 16:17:23 +02:00
Fabien Potencier
d429594afb removed separator of choice widget when the separator is null 2011-09-29 10:14:34 +02:00
Igor Wiedler
d535afeb98 [composer] fix monolog-bridge composer.json, add more inter-component deps 2011-09-27 09:33:21 +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
Fabien Potencier
ee12b67e4e [TwigBridge] rewrote the Twig translation extractor
* The extractor is now reusable as this is a proper Twig node visitor
* The new extractor covers more cases
2011-09-23 09:38:20 +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
Fabien Potencier
b6c8f639f0 [TwigBridge] fixed message keys extraction when no domain is defined in the template 2011-09-23 08:39:02 +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
H. Westphal
3e2f1a4b13 Removed executable bits from all php files 2011-09-09 15:16:17 +02:00
Fabien Potencier
18d3dfe0bf merged branch snc/chmod-fixes (PR #2130)
Commits
-------

a0a97c6 Removed executable bits from all php files

Discussion
----------

Removed executable bits from all PHP files

Some files had a file mode of 755 and this PR changes them to 644. The reason behind this is that git always thinks that those files are changed when accessing the repository via a samba share on windows (tested with PhpStorm).

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

by fabpot at 2011/09/09 05:51:30 -0700

That was on my radar too. Can you do the same for the 2.0 branch?
2011-09-09 14:51:44 +02:00
Michel Salib
ef322f680d -- add command that extracts translation messages from templates
-- add missing files

-- tweak translation command files

-- dumpers are now responsive for writting the files

-- moved the twig extractor the bridge

-- clear temp files after unit tests
-- check the presence of dumper in translation writer

-- General cleaning of the code

-- clean phpDoc

-- fix PHPDoc

-- fixing class name in configuration

-- add unit tests for extractors (php and twig)

-- moved test to correct location

-- polish the code

-- polish the code
2011-09-09 10:23:54 +02:00
H. Westphal
a0a97c6a22 Removed executable bits from all php files 2011-09-07 22:51:20 +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
8700cd6154 fixed CS 2011-07-27 08:27:46 +02:00
Fabien Potencier
c248f8123d merged branch craue/patch-9 (PR #1787)
Commits
-------

c558b78 avoid rendering the `ChoiceType` separator if all `choices` are `preferred_choices`

Discussion
----------

avoid rendering the `ChoiceType` separator if all `choices` are `preferred_choices`

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

by fabpot at 2011/07/24 00:51:21 -0700

The same change should be made to the PHP template.

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

by fabpot at 2011/07/25 00:31:39 -0700

I forgot to ask you to add some unit tests too. Thanks.

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

by craue at 2011/07/25 10:23:34 -0700

Are you asking for PHPUnit tests? If so, unfortunately, I'm not able to add those because I haven't used PHPUnit yet. ;)

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

by lenar at 2011/07/25 12:47:51 -0700

I would prefer ```choises | length``` without spaces as everywhere else.

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

by lenar at 2011/07/25 12:50:32 -0700

@fabpot: Since <option disabled> is unclickable in browser (by HTML spec) this really doesn't change anything (something not there is as unclickable) except the the look when rendered. I have hard time to imagine what could become unit-testable here by this change.

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

by stof at 2011/07/25 13:03:47 -0700

@lenar unit testing is not about what the browser could do. What should be unit-tested is that an example will only preferred choices does not output the separator, which is exactly what this PR is about

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

by stof at 2011/07/25 13:04:03 -0700

@lenar unit testing is not about what the browser could do. What should be unit-tested is that an example will only preferred choices does not output the separator, which is exactly what this PR is about

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

by lenar at 2011/07/25 13:08:33 -0700

@stof: ok, put this way you are definitely right.

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

by craue at 2011/07/25 13:37:50 -0700

@lenar: You're right about the spaces. I'm using them in my projects but will remove them here for the sake of consistency.

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

by stloyd at 2011/07/25 13:40:40 -0700

@craue I will write today/tomorrow test to cover your code and send you PR.

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

by craue at 2011/07/25 14:00:26 -0700

@stloyd: That would be nice. But I'm still not that familiar with Git(Hub). Is there anything I have to take care of?

Also, I'd like to squash my three commits into one ... if this is possible for an open PR and if I find out how to do that easily. :D

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

by fabpot at 2011/07/26 00:18:22 -0700

@craue: yes, you should squash your commits into one and use `--force` when you push (the PR will automatically be updated accordingly).
2011-07-27 07:59:53 +02:00
Fabien Potencier
c6308a5daf merged branch stof/trans_locale (PR #1808)
Commits
-------

85c0087 [TwigBridge] Made the locale configurable for the trans and transchoice tags
3ea31a0 [TwigBridge] Made the locale configurable for the trans and transchoice filters

Discussion
----------

Trans locale

This allows setting the locale when translating in a Twig template. This was already allowed in the Translator and in the PHP templates
2011-07-27 07:44:42 +02:00
Christian Raue
c558b78bc6 avoid rendering the ChoiceType separator if all choices are preferred_choices 2011-07-26 12:55:46 +02:00
Fabien Potencier
04ac1fdba2 [Routing] changed UrlGeneratorInterface::generate() signature to allow passing objects instead of arrays 2011-07-26 08:00:41 +02:00
Christophe Coevoet
85c0087825 [TwigBridge] Made the locale configurable for the trans and transchoice tags 2011-07-26 01:27:09 +02:00
Christophe Coevoet
3ea31a0263 [TwigBridge] Made the locale configurable for the trans and transchoice filters 2011-07-26 01:25:25 +02:00
marc.weistroff
2b4cc9bd06 [Form] Changed collection prototype rendering.
Based on PR 1500. It is now rendered inside an attribute of collection
tag.
2011-07-22 11:01:55 +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
Fabien Potencier
634131bc77 [Twig] made a small optimization to avoid problems with XDebug when rendering forms with deep nested collections 2011-07-16 20:40:19 +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
Christian Raue
d34caeea3a merged and unified blocks field_label and form_label into generic_label 2011-07-11 12:06:28 -07:00
Fabien Potencier
9a6aafa83f added missing required classes on form label 2011-07-11 18:37:09 +02:00
Fabien Potencier
4e605aa761 merged branch Seldaek/form_tpl (PR #1519)
Commits
-------

52fdd53 [Bridge/Twig] Add required class to labels that match required fields

Discussion
----------

[Bridge/Twig] Add required class to labels that match required fields

I have used this to simply style labels that are required with a red star behind them using this CSS:

``` css
label.required::after {
	content: " *";
	color: #c00;
}
```

The problem is that you can't use `input[required] + label::after` as a selector since the label is typically rendered before the input. There is no way to check for an element that is *followed by* another, only elements *following*.

Of course this CSS in particular won't work except in the latest browsers, but you could still use the `label.required` selector to add a background image and so on. I think this is a very common use case and therefore I think it'd benefit the core framework.

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

by fabpot at 2011/07/05 01:27:49 -0700

Can you also update the PHP templates?

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

by schmittjoh at 2011/07/05 01:43:33 -0700

How about namespacing these css classes, like for example "sf-form-required"?

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

by stloyd at 2011/07/05 01:50:58 -0700

I would prefer an @schmittjoh naming, or even adding ability to setup it thought options.

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

by fabpot at 2011/07/05 01:54:36 -0700

Please, do not add more options. Prefix with `sf` is actually a good idea but people will argue that this is not a good idea because it gives too much information about the technology used to create the website (that's one of the things that came up pretty often in symfony1).

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

by schmittjoh at 2011/07/05 02:00:11 -0700

An option is not such a good idea imo since you likely want to have a uniform naming strategy across your entire site. How about adding a new service CssNamingStrategy?

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

by stloyd at 2011/07/05 02:01:19 -0700

Then this can be some simpler one not giving such informations i.e.: `form-label-required`, `label-required`, `framework-form-required`, `form-required` or whatever else ;-)

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

by fabpot at 2011/07/05 02:16:41 -0700

It cannot be configurable as it would potentially break bundles that come with stylesheets.

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

by stloyd at 2011/07/05 02:21:10 -0700

IMO if we decide to add this one, we could add same to `inputs/selects/etc` with `required` option.

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

by schmittjoh at 2011/07/05 02:21:59 -0700

I think it can, consider an interface like this:

```php
interface CssNamingStrategyInterface
{
    function getCssName($class);
}
```

This will give people a lot of flexibility, and it also does allow them to exclude classes which for example are provided by third-party bundles.

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

by Seldaek at 2011/07/05 02:47:54 -0700

Wow guys, if this turns into a full blown class generator solution, I'm happy to close the PR.

"required" is not a name that's commonly used for main page elements, it's typically associated with forms, and therefore I don't see the need to make it unnecessary longer/namespaced. Similarly I don't see the need to add it to the input/select/.., because they already have an attribute, which you can very easily select as: `input[required]` in CSS. That works everywhere except IE6, but we can't build for the future on very old browsers. If you really want support for IE6, you can override the templates imo. But core should be looking forward, as it already is with HTML5, form markup, etc.

As for calling it form-label-required or label-required, again, I don't see the benefit, you can use `label.required` if you want to avoid conflicts with non-label elements having a required class, or a safer `form .required`. There are plenty of options in CSS itself, let's not make this overly complex.

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

by schmittjoh at 2011/07/05 02:52:17 -0700

see
http://code.google.com/intl/de-DE/speed/page-speed/docs/rendering.html#UseEfficientCSSSelectors

On Tue, Jul 5, 2011 at 11:47 AM, Seldaek <
reply@reply.github.com>wrote:

> Wow guys, if this turns into a full blown class generator solution, I'm
> happy to close the PR.
>
> "required" is not a name that's commonly used for main page elements, it's
> typically associated with forms, and therefore I don't see the need to make
> it unnecessary longer/namespaced. Similarly I don't see the need to add it
> to the input/select/.., because they already have an attribute, which you
> can very easily select as: `input[required]` in CSS. That works everywhere
> except IE6, but we can't build for the future on very old browsers. If you
> really want support for IE6, you can override the templates imo. But core
> should be looking forward, as it already is with HTML5, form markup, etc.
>
> As for calling it form-label-required or label-required, again, I don't see
> the benefit, you can use `label.required` if you want to avoid conflicts
> with non-label elements having a required class, or a safer `form
> .required`. There are plenty of options in CSS itself, let's not make this
> overly complex.
>
> --
> Reply to this email directly or view it on GitHub:
> https://github.com/symfony/symfony/pull/1519#issuecomment-1502560
>

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

by Seldaek at 2011/07/05 03:11:50 -0700

Really? Come on, we're talking about forms, it's not like you have billions of form/input tags per page that have to be parsed by the browser when you select that. Also you don't have to select the elements, if you want true performance just use no stylesheet, your users will thank you.

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

by schmittjoh at 2011/07/05 03:30:40 -0700

Your CSS selectors not only affect the performance of form elements, but of all elements that have a "required" class. Likewise, the same applies if we decide to add more classes.

Why close the door for people who care about performance? We can easily avoid this by making the css class more specific as suggested earlier. The idea with the renaming strategy is one step further and allows people to "obfuscate" which tool was used to generate the form, or do additional optimizations like shortening the css name.

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

by lenar at 2011/07/05 03:34:34 -0700

@Seldaek: Just for remark I've seen matrix forms spanning multiple screenfuls horizontally and vertically
containing tens of thousands inputs. Not pretty, but they do exist. Basically "poor" man's/company's excel
emulation or something.

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

by Seldaek at 2011/07/05 04:19:13 -0700

@schmittjoh, @lenar: We're catering to the most common use case, for which this will be more than fast enough. Small/medium scale websites don't have to optimize on CSS rules parsing, they usually have much bigger issues to deal with. If you really care about it, overriding the block to remove the class is just as easy as it was to for me to add it, but IMO this is the edge case.

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

by schmittjoh at 2011/07/05 05:37:19 -0700

IMO Symfony should follow best practices by encouraging to use class selectors, and not tag selectors for the reasons explained on the page I linked.

Anyway, I think everybody made his points. Time for @fabpot to make a decision :)
2011-07-11 11:32:26 +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
Jordi Boggiano
e6da824aa1 [MonologBundle] Added services for core processors 2011-07-04 22:46:15 +02:00
Jordi Boggiano
52fdd53af8 [Bridge/Twig] Add required class to labels that match required fields 2011-07-04 20:04:44 +02:00
Fabien Potencier
1cf3bc4891 merged branch schmittjoh/annotationUpdate (PR #1483)
Commits
-------

1cc1027 added @Annotation to UniqueEntity
ee22c5d added a note to update file
efcb435 updated to doctrine changes

Discussion
----------

updated to doctrine changes

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

by excelwebzone at 2011/06/30 06:29:23 -0700

Should also be implemented to the Route class and to all SensioFrameworkExtraBundle annotation classes
2011-06-30 20:36:10 +02:00
Johannes Schmitt
1cc102788b added @Annotation to UniqueEntity 2011-06-30 12:36:37 +02:00
Fabien Potencier
339ad861bb added missing translator calls in form templates 2011-06-29 19:26:59 +02:00
cyrillej
4e7b16f769 Added "trans" Twig filters to labels in the "widget_choice_options" block 2011-06-29 15:14:45 +02:00
stloyd
7bc19f9675 Added to DateTimeType extension possibility to render form as single_text (similar to DateType option) (issue #1323 it requires fix for #1205) 2011-06-23 17:02:55 +02:00
stloyd
17b41b2c51 Added to TimeType extension possibility to render form as single_text (similar to DateType option) (issue #1205)
Adjusted `DateTimeType` to allow usage of this new feature
2011-06-23 14:36:04 +02:00
Fabien Potencier
59f85b4a6e merged branch stloyd/timetype (PR #1354)
Commits
-------

4e3406d Sync with master and clean up
ad5d2c1 Added to `TimeType` extension possibility to render form as `single_text` (similar to DateType option) (issue #1205) Adjusted `DateTimeType` to allow usage of this new feature

Discussion
----------

[Form][TimeType] Added possibility to render form as "single_text"

Added to `TimeType` extension possibility to render form as `single_text` (similar to `DateType` option) (issue #1205)
Adjusted `DateTimeType` to allow usage of this new feature

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

by ouardisoft at 2011/06/17 03:41:18 -0700

+1

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

by stloyd at 2011/06/21 01:05:51 -0700

@fabpot Any decision about this one ? I'm asking because I also have similar fix for #1323 but it requires this one ;-)

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

by fabpot at 2011/06/22 23:32:08 -0700

@stloyd: Can you rebase to master?

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

by stloyd at 2011/06/23 05:03:44 -0700

@fabpot Done.
2011-06-23 14:19:20 +02:00
Fabien Potencier
f57e1d3e10 fixed CS 2011-06-23 14:07:53 +02:00
stloyd
4e3406d633 Sync with master and clean up 2011-06-23 14:01:11 +02:00
stloyd
ad5d2c13e1 Added to TimeType extension possibility to render form as single_text (similar to DateType option) (issue #1205)
Adjusted `DateTimeType` to allow usage of this new feature
2011-06-23 11:40:24 +02:00
Fabien Potencier
da04075c9d merged branch craue/patch-5 (PR #1384)
Commits
-------

c17a836 typo

Discussion
----------

typo
2011-06-22 16:19:27 +02:00
Fabien Potencier
e717c99f3b merged branch vicb/form/theming (PR #1369)
Commits
-------

2c1108c [Form] Revert the ability to override anything else than the text of the label while rendering a row
da467a6 [Form] Fix the exception message when no block is found while rendering
8670995 [Form] Optimize rendering when the block to render is known
41e07c9 [Form] Optimize rendering
ee5d975 [Form] Remove a test which is no more relevant (after recent FileType refactoring)
f729c6b [Form] Add the ability to override label & widget options when rendering a row
e09ae3f [Form][FrameworkBundle] Make FormHelper::renderSection() recursively callable, introduce FormHelper::renderBlock()
e43fb98 [Form][TwigBridge] Make FormExtension::render() recursively callable to ease theming

Discussion
----------

[Form] Some refactoring of the rendering

# First two commits

## FormExtension::render() can now be called recursively.

The main use case is theming support in for collections. Let's consider that you have a collection of `CustomType`, the type hierarchy while rendering the proto would be `field < form < custom < prototype`. Before this change any theme applied to your custom type (i.e. a `custom_row` block) would not have been taken into account while rendering the prototype because of the structure of the `prototype_row` block:

```html
{% block prototype_row %}
{% spaceless %}
    <script type="text/html" id="{{ proto_id }}">{{ block('field_row') }}</script>
{% endspaceless %}
{% endblock prototype_row %}
```
which skip the `custom_row` block rendering to fallback to the `field_row` block rendering.

With this PR `prototype_row` recursively calls `FormExtension::render()`

```html
{% block prototype_row %}
{% spaceless %}
    <script type="text/html" id="{{ proto_id }}">{{ form_row(form) }}</script>
{% endspaceless %}
{% endblock prototype_row %}
```

this has for effect to render the block for the parent type (i.e. `custom_row`)

## FormHelper

The `FormHelper` has been updated to more closely match the `FormExtension` architecture and the templates have been modified accordingly. `echo $view['form']->renderBlock(<block name>)` is the php equivalent of `{{ block(<block name>) }}`.

The attributes are now rendered using a template rather than by the `FormHelper::attributes()` method.

Several templates have been fixed.

# Third commit

The `$varStack` property was used to forward options to the label and the widget when rendering a row. The implementation was not working as expected. The proposed way to override label and widget options is to pass these options in the `label` and `widget` keys while callinf `render_row`.

That would be:
`{{ form_row(form.field, {"attr": {<row attributes>}, "label" : {"label": <text>, "attr": {<label attr>}}, "widget" : { "attr" : {<widget attributes}} } }}`

So there is now the ability to set attributes for the row (`<div>` or `<tr>`).

This has been discussed on [the mailing list](http://groups.google.com/group/symfony-devs/browse_thread/thread/17754128ba480545). **I would like to find a compromise with @Seldaek before this gets merged**

The `$varStack` property is now only used when recursively calling `FormExtension::render()`

# Notes

I have preferred to submit several commits in order to ease review and to keep some history.

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

by stof at 2011/06/20 05:20:56 -0700

@vicb On a side note, do you think it would be possible to support form theming in PHP templates too ? Currently, the only way to customize the rendering of forms when using PHP templates is to overwrite the FrameworkBundle's templates, and this impacts all forms. This makes the PHP rendering far less powerful than the Twig one.
I don't know the Form rendering and the PHPEngine well enough to know if it is feasible for 2.1 or not.

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

by vicb at 2011/06/20 05:35:11 -0700

@stof I hope to make it possible but I need a little bit more thinking to find the best possible solution which should not look like a hack.

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

by vicb at 2011/06/21 01:13:10 -0700

This should not be merged yet, it might have some issue with the variable stack. I am working on it.

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

by vicb at 2011/06/21 01:41:11 -0700

Sorted out the issue, it was linked to some local _optimization_, the code of this PR is ok.

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

by vicb at 2011/06/21 02:01:24 -0700

I have pushed a [POC of php theming based on this PR](https://github.com/vicb/symfony/commits/form%2Fphp-theme) to my repo - it is lacking a configuration and cache layer.

I have open [a thread on the ml](http://groups.google.com/group/symfony-devs/browse_thread/thread/9b3f131fe116b511) to discuss this.

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

by vicb at 2011/06/21 23:40:21 -0700

@fabpot fixed in the last commit.
2011-06-22 09:12:24 +02:00
Victor Berchet
2c1108ce6b [Form] Revert the ability to override anything else than the text of the label while rendering a row 2011-06-22 08:36:45 +02:00
Jordi Boggiano
7350109f6e Renamed core.* events to kernel.* and CoreEvents to KernelEvents 2011-06-21 16:35:14 +02:00
Christian Raue
c17a836985 typo 2011-06-20 23:14:48 -07:00
Victor Berchet
da467a6b11 [Form] Fix the exception message when no block is found while rendering 2011-06-20 12:29:05 +02:00
Victor Berchet
8670995574 [Form] Optimize rendering when the block to render is known 2011-06-20 12:29:05 +02:00
Victor Berchet
41e07c96e3 [Form] Optimize rendering 2011-06-20 12:29:04 +02:00
Victor Berchet
f729c6ba93 [Form] Add the ability to override label & widget options when rendering a row 2011-06-20 12:29:04 +02:00
Victor Berchet
e43fb989e3 [Form][TwigBridge] Make FormExtension::render() recursively callable to ease theming 2011-06-20 11:39:23 +02:00
Fabien Potencier
a1afb9961b [HttpKernel] sanitized log context in the log data collector 2011-06-19 13:20:00 +02:00
Christophe Coevoet
410b3e06d6 [HttpKernel] Added the context in the LoggerInterface 2011-06-17 12:26:12 +02:00
Fabien Potencier
627a7f7cd4 [TwigBridge] renamed some block names to avoid collisions 2011-06-17 08:39:56 +02:00
Fabien Potencier
a7974ff43c renamed Form Twig templates to be more explicit 2011-06-16 15:20:12 +02:00
Fabien Potencier
02f28b6e5e simplified Form templates as the safeguard is already set in the Form Type 2011-06-15 16:58:41 +02:00
Fabien Potencier
fb24b95bd5 made some tweaks to error levels 2011-06-15 13:04:19 +02:00
Fabien Potencier
73dc8c96af merged branch vicb/form-proto (PR #1315)
Commits
-------

07fa82d [Form] Revert changes impacting perfomance and readability
b709551 [Order] Make Form::types and FormView::types use the same order (Parent > Child)
e56dad6 [Form] simplify the code
bdd755e [Form] Fix the exception message when no block is found
c68c511 [Form] Make theming form prototypes consistent (start by looking for a '_<id>_<section>' block)
9ec9960 [Form] Simplify the code
4e3e276 [Form] Make the prototype view child of the collection view

Discussion
----------

[Form] Make the prototype view child of the collection view

This PR should be a base for discussion.

The [current implementation](https://github.com/symfony/symfony/pull/1188) has some drawbacks because the prototype view is not a child of the collection view:

  * The 'multipart' attribute is not propagated from the prototype to the collection,
  * The prototype view do not use the theme from the collection.

Those 2 points are fixed by the proposed implementation and one more benefit is that the template markup might be easier to work with:

before:

```html
<div id="form_emails">
  <div>
    <label for="form_emails_0">0</label>
    <input type="email" id="form_emails_0" name="form[emails][0]" value="a@b.com">
  </div>
  <script type="text/html" id="form_emails_prototype">
    <div>
      <label for="$$name$$">$$name$$</label>
      <input type="email" id="$$name$$" name="$$name$$" value="" />
    </div>
  </script>
</div>
```
after:

```html
<div id="form_emails">
  <div>
    <label for="form_emails_0">0</label>
    <input type="email" id="form_emails_0" name="form[emails][0]" value="a@b.com">
  </div>
  <script type="text/html" id="form_emails_prototype">
    <div>
      <label for="form_emails_$$name$$">$$name$$</label>
      <input type="email" id="form_emails_$$name$$" name="form[emails][$$name$$]" value="" />
    </div>
  </script>
</div>
```

@kriswallsmith I'd like to get your feedback on this PR. thanks.

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

by stof at 2011/06/14 07:01:01 -0700

@fabpot any ETA about merging it ? Using the prototype currently is a pain to build the name. The change makes it far easier

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

by fabpot at 2011/06/14 07:09:46 -0700

The templates are much better but I'm a bit concerned that we need to add the logic into the Form class directly. That looks quite ugly. If there is no other way, I will merge it.

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

by vicb at 2011/06/14 07:14:32 -0700

I have found no better way... I am testing some minor tweaks I want to submit.

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

by kriswallsmith at 2011/06/14 07:34:25 -0700

I'm not happy with the code in Form.php either... would creating a PrototypeType accomplish the same thing?

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

by vicb at 2011/06/14 07:42:07 -0700

@kriswallsmith tried and dismissed, the id and name are bad & you have to go for `render_widget(form.get('proto'))` in the template. That should be fixeable but not any better.

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

by kriswallsmith at 2011/06/14 07:45:21 -0700

What do you mean the id and name are bad? If we have a distinct type for the prototype, can't we do whatever we want using buildView() and the template?

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

by vicb at 2011/06/14 07:53:31 -0700

@kriswallsmith the id would be smthg like `form_emails_$$name$$_prototype` but yes we should be able to do whatever we want but the code might end up being more complex.

I am done with the tweaks but still open to feedback on this PR.

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

by kriswallsmith at 2011/06/14 08:08:21 -0700

Yes, that is the type of name I would expect.

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

by kriswallsmith at 2011/06/14 08:08:33 -0700

Oops -- I mean id.

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

by kriswallsmith at 2011/06/14 08:09:42 -0700

Maybe I'm confused what id you're referring to. I'll try to spend some time on this today.

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

by vicb at 2011/06/14 08:23:56 -0700

That should be the id of the `<input>`, the id of the script would be `form_emails_$$name$$_prototype_prototype` (if prototype is the name of the nested node).

I am trying to setup a branch with my code (playing with git & netbeans local history)

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

by vicb at 2011/06/14 08:46:25 -0700

@kriswallsmith https://github.com/vicb/symfony/tree/kris/proto if that can help (there are still changes in Form.php)

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

by kriswallsmith at 2011/06/14 08:47:08 -0700

Thanks, I'll take a look.

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

by vicb at 2011/06/15 00:48:38 -0700

I would have expected it to be faster however `array_map` is about twice slower... reverted !
2011-06-15 11:27:12 +02:00
Victor Berchet
b709551252 [Order] Make Form::types and FormView::types use the same order (Parent > Child) 2011-06-15 01:45:26 +02:00
Victor Berchet
bdd755e45b [Form] Fix the exception message when no block is found 2011-06-14 16:45:03 +02:00
Victor Berchet
c68c511388 [Form] Make theming form prototypes consistent (start by looking for a '_<id>_<section>' block) 2011-06-14 16:36:31 +02:00
Fabien Potencier
a232c148eb fixed CS 2011-06-14 12:54:32 +02:00
Victor Berchet
4e3e2768fb [Form] Make the prototype view child of the collection view 2011-06-14 09:33:19 +02:00
Fabien Potencier
2ce3cfad18 [Form] made it possible to translate the empty value of Choice fields 2011-06-14 08:33:48 +02:00
Fabien Potencier
c364008a3b [Form] allowed an empty value to be displayed for choices even when required is true
Rules are as follows:

* If multiple is true, then the empty_value is ignored
* If not, and if the field is not required, the empty_value is set to the empty string by default and displayed
* If the field is required, and if the user explicitely set the empty_value, then it is displayed
2011-06-14 08:27:19 +02:00
Christophe Coevoet
df0039f701 [TwigBridge] fixed the check for the collection prototype in the form theme 2011-06-14 00:15:50 +02:00
Fabien Potencier
d16a708cc8 [Form] simplified file type class
File uploads documentation is here:

https://github.com/symfony/symfony-docs/pull/400
2011-06-13 18:11:18 +02:00
Fabien Potencier
0c29a25d89 Merge remote branch 'kriswallsmith/form/collection-proto'
* kriswallsmith/form/collection-proto:
  added script[type="text/html"] collection prototype to form themes
  [Form] removed collection prototype from form tree
2011-06-13 11:51:18 +02:00
Fabien Potencier
973b323b12 Merge remote branch 'vicb/form-render-fix'
* vicb/form-render-fix:
  [Form][TwigBridge] Improve the cache layer by caching blocks instead of templates
  [Form][TwigBridge] Make the template cache more efficient
  [Form][TwigBridge] Fix rendering
2011-06-13 11:48:44 +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
Victor Berchet
b19052f879 [Form][TwigBridge] Improve the cache layer by caching blocks instead of templates 2011-06-12 12:56:25 +02:00
Victor Berchet
9135f963db [Form][TwigBridge] Make the template cache more efficient 2011-06-12 12:15:48 +02:00
Victor Berchet
8677aa3dce [Form][TwigBridge] Fix rendering 2011-06-12 11:33:17 +02:00
Fabien Potencier
293ba3426a [DoctrineBridge] fixed guesser 2011-06-10 19:41:49 +02:00
Fabien Potencier
852a4c9c6a [Form] removed the file upload temporary storage feature
The current implementation is not ready for inclusion in 2.0. It has several
known problems (security, not possible to disable it, not "cloud-compatible",
...) and it's not a must have feature anyway.

Some references:

 * Security issue in FileType: https://github.com/symfony/symfony/issues/1001
 * Validation fails on file, still stored in TemporaryStorage: https://github.com/symfony/symfony/issues/908
 * Add a size argument & ability to configure TemporaryStorage: https://github.com/symfony/symfony/pull/748

This feature should be reworked and discussed for inclusion in 2.1.
2011-06-09 12:44:36 +02:00
Fabien Potencier
0a7ce63d8f Merge remote branch 'vicb/twig-theme-inheritance'
* vicb/twig-theme-inheritance:
  [Form] Further tweaks of the twig theme inheritance
  [Form] Fix twig theme inheritance
2011-06-09 07:46:50 +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
Kris Wallsmith
0df338fdb1 added script[type="text/html"] collection prototype to form themes 2011-06-08 09:41:12 -04:00
Victor Berchet
5060702669 [Form] Further tweaks of the twig theme inheritance 2011-06-08 14:46:34 +02:00
Victor Berchet
bee505a4bf [Form] Fix twig theme inheritance 2011-06-08 14:21:09 +02:00
Fabien Potencier
566511e9e7 moved some FormView methods to FormUtil where they really belongs 2011-06-08 14:07:04 +02: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
Fabien Potencier
97a745e973 Merge remote branch 'vicb/form-rendering-fix'
* vicb/form-rendering-fix:
  [Form] Fix accessibility for file inputs
  [FrameworkBundle] Fix the FormHelper phpDoc
  [FrameworkBundle][Form] Add some phpDoc for the FormHelper class
  [FrameworkBundle][Form] Fix label rendering
  [FrameworkBundle][Form] Fix rendering search inputs in PHP
  [Form] FormType labels should never have a for attribute
  [Form] Never render a view again
2011-06-07 19:46:20 +02:00
Fabien Potencier
89f544afb6 moved Twig form templates to the Twig bridge 2011-06-07 16:38:23 +02:00
Victor Berchet
b12b11c131 [Form] Never render a view again
If some of the nested views are rendered individually they should not be rendered again when calling form_rest.
A typical would be when some nested file views are rendered, form_rest should not render them again.

It is still possible to render a label once the widget has been rendered. This is for checkboxes and radios
where the widget is typically rendered before the label.
2011-06-06 18:01:03 +02:00
Pascal Borreli
404c452c0b [Various] Phpdoc & typos 2011-06-04 15:30:56 +00:00
Fabien Potencier
2093a45aef merged stloyd/form_label 2011-06-01 11:11:25 +02:00
Fabien Potencier
c8034c04a8 Merge remote branch 'vicb/form-rendering'
* vicb/form-rendering:
  [Form] The variable stack should not persist between section rendering (fixes #1157)
  [Twig][Form] Tweak form extension phpDoc and code
  [Form] Tweak phpDoc
  [FormView] fix phpDoc
  [Form] Some tweaks
2011-06-01 10:32:40 +02:00
stloyd
cb22ccc516 [Form] Added missing feature for adding attributes to an field label 2011-05-31 17:01:28 +02:00
Fabien Potencier
02605f3481 merged origin/master 2011-05-31 08:34:05 +02:00
Fabien Potencier
d1ca577e3f removed Logger::getDebugLogger() as the method is not part of any interface 2011-05-31 08:02:14 +02:00
Fabien Potencier
79e709cdc9 removed the ON_ prefix for Form event names 2011-05-31 07:19:18 +02:00
Victor Berchet
b61929bf4a [Form] The variable stack should not persist between section rendering (fixes #1157) 2011-05-30 19:25:02 +02:00
Victor Berchet
d375379a6a [Twig][Form] Tweak form extension phpDoc and code 2011-05-30 18:24:12 +02:00
Victor Berchet
2b99d45dd3 [FormView] fix phpDoc 2011-05-30 15:21:15 +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
Fabien Potencier
dcd490e03f [Twig] added a way to use % in a trans string (closes #981) 2011-05-25 11:29:23 +02:00
jdhoek
cc5a100418 Add missing {} around @inheritDoc to fix this class in SF beta2. 2011-05-24 00:41:35 -07:00
Victor Berchet
eb10c66a55 [Twig][Form] Optimize form rendering 2011-05-20 16:45:57 +02: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
Martin Hason
b7c417feaa [Bridge][Twig] removed the possibility to pass a message to the transchoice tag 2011-05-17 10:33:48 +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
Christophe Coevoet
c90c79472c [MonologBridge] Removed useless method 2011-05-07 10:38:06 +02:00
Christophe Coevoet
0ed6d04a5f [MonologBundle] Moved the handlers to the Bridge namespace 2011-05-07 10:35:19 +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
Bernhard Schussek
eb50d766da [Form] Fixed variable scope when entering nested form helpers
The consequence of this commit is that variables are accessible that have been passed to a surrounding form helper.

Example template:

{% block my_widget_label %}
    <label>{{ label }}
{% endblock %}

{% block my_widget_row %}
    {# It is not necessary to explicitely pass through the label variable #}
    {{ form_label(form) }}
    {{ form_widget(form) }}
{% endblock %}

Example usage:

{{ form_row(form.mywidget, { 'label': 'My Widget' }) }}
2011-05-04 15:40:15 +02:00
Bernhard Schussek
38098604af [Form] Added tests for blocks/templates in the format _<ID>_(widget|row|label|...) 2011-05-04 15:33:51 +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
a2a8edbabd [Twig] made a small tweak in generated templates 2011-04-29 15:26:56 +02:00
Fabien Potencier
6180b6aeb5 [TwigBundle] removed obsolete code 2011-04-29 10:48:20 +02:00
Fabien Potencier
a204aec08b added the possibility to easily customize the template of just one widget of a form 2011-04-29 00:20:21 +02:00
Fabien Potencier
509f3dd454 removed the possibility to pass a template to render_widget()
This has been removed as the same can be achieved in a cleaner way:

 * Use plain HTML with calls to more granular Twig form functions
 * Create a macro if you really want to reuse the template snippet elsewhere
2011-04-28 12:19:29 +02: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
Artur Kotyrba
d506a55b40 [Bridge][Twig] removed unused argument passed to setRendered() method 2011-04-25 22:58:23 +02: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
Eriksen Costa
589b0ab4ed Merge branch 'master' into form-frameworkbundle-form-guessers-fix
Conflicts:
	src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/AddFormGuessersPass.php
	src/Symfony/Component/Form/MoneyField.php
2011-04-21 23:03:40 -03:00
Fabien Potencier
286c45733e removed the possibility to pass a message to the trans tag
The trans tag should only be used with static texts as automatic output escaping does not occur.
2011-04-21 09:10:47 +02:00
Fabien Potencier
cad6643e77 simplified exceptions as Twig is now smart enough to automatically add line information 2011-04-21 09:03:30 +02:00
Fabien Potencier
54b77d24dd made the %count% variable automatically available when using the transchoice filter (similar to how the tag works) 2011-04-21 09:01:11 +02:00
Bernhard Schussek
273d72ef75 [Form] Changed separator for Twig blocks from double underscore to single underscore to match the PHP template separator 2011-04-18 14:28:01 +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
Brikou CARRE
e898445b94 removed empty lines/trailing spaces 2011-04-15 21:12:02 +02:00
Henrik Bjørnskov
e687685f98 [Form] change FormView::setVar,getVar,getVars,hasVar to set,get,all,has
[Form] Fixed {get,set,has}Var references in templating php

[Form] Added getVars to FormView to ease usage in Twig. Also added some phpdoc and cleaned up the get method by adding a default value

[Form] Fix

[Form] Delete file generated by test
2011-04-15 15:25: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
2ddc85ae5a [Form][Twig] Removed obsolete form_data() helper 2011-04-14 15:14:19 +02:00
Bernhard Schussek
72b17cd67c [Form] Renamed TemplateContext to FormView 2011-04-14 15:02:51 +02:00
Bernhard Schussek
ca6ae09779 [Form] Removed TemplateContext::create() 2011-04-14 14:42:17 +02:00
Bernhard Schussek
ce5f3073bd Fixed test suite and names of accessor methods in TemplateContext 2011-04-14 03:52:52 +02:00
Bernhard Schussek
96f040cec1 [Form] Added extensive test coverage for div_layout.html.twig 2011-04-14 03:15:56 +02:00
Bernhard Schussek
8031ad77c8 Merge remote branch 'fabpot/form' into fabpot_merge 2011-04-13 15:58:15 +02:00
Bernhard Schussek
2a18be1c9f Merge remote branch 'symfony/master' into experimental 2011-04-13 13:53:20 +02:00
Martin Hason
d39ea6ae79 [Bridge][Twig] improved behaviour of the transchoice tag (support for variables) 2011-04-12 11:15:19 +02:00
Martin Hason
d300b94745 [Bridge][Twig] added transchoice filter 2011-04-12 11:10:55 +02:00
Fabien Potencier
7f2294395c [Form] reverted the templating part to be similar to what we have today 2011-04-11 16:42:51 +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
53838abf3f Merge remote branch 'symfony/master' into experimental
Conflicts:
	src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/money_field.html.php
	src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/percent_field.html.php
	src/Symfony/Component/Form/Resources/config/validation.xml
2011-03-28 22:52:15 +02:00
Fabien Potencier
faf9782e6f renamed Twig TransExtension to TranslationExtension 2011-03-28 16:16:54 +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
Fabien Potencier
9595963c2b [Routing] changed interface of the router twig extension as we don't need a full router 2011-03-23 16:27:08 +01:00
Fabien Potencier
82dec51b30 moved integration between the Yaml component and Twig to a Symfony Bridge 2011-03-23 15:50:55 +01:00
Fabien Potencier
e912b347f0 moved integration between the Translation component and Twig to a Symfony Bridge 2011-03-23 15:23:52 +01:00
Fabien Potencier
3e5bd67dac moved integration between Routing and Twig to a Symfony Bridge 2011-03-23 15:16:57 +01:00