symfony-2.1

Having a custom repository with DBAL connection in Symfony 2 / Doctrine 2?

↘锁芯ラ 提交于 2019-12-08 07:53:15
问题 I'm trying to inject default DBAL connection into a custom repository associated with a entity so I can do some raw sql query. In services.mxl <service id="acme.repository.document" class="Acme\Bundle\Repository\DocumentRepository"> <argument type="service" id="doctrine.orm.entity_manager" /> <argument>Acme\Bundle\Entity\Document</argument> <argument type="service" id="database_connection" /> </service> In my repository class DocumentRepository.php class DocumentRepository extends

Option groups in symfony2 entity form type

て烟熏妆下的殇ゞ 提交于 2019-12-08 07:08:45
问题 Is there any way an entity field can be shown grouped in option groups in symfony2 (v.2.1), for example I have something like this in my form class: $builder->add('account', 'entity', array( 'class' => 'MyBundle\Entity\Account', 'query_builder' => function(EntityRepository $repo){ return $repo->findAllAccounts(); }, 'required' => true, 'empty_value' => 'Choose_an_account', ); But (of course) they are displayed as the repository class reads it from the db and I would like to display them

Container Dependecy Injection not working in Fixtures after upgrading symfony 2.0 to 2.1/2.2

别来无恙 提交于 2019-12-08 04:18:36
问题 I upgraded a project from Symfony 2.0 to 2.1. After that my tests stopped working. The problem is that I use fixtures which implement the ContainerAware interface. Now after the upgrade the setContainer() method does not get called anymore. I tried upgrading further to 2.2. The problem still persists. composer.json: { "name": "symfony/framework-standard-edition", "license": "MIT", "type": "project", "description": "The \"Symfony Standard Edition\" distribution", "autoload": { "psr-0": { "":

Symfony 2.1 Extending Core Classes

不问归期 提交于 2019-12-08 00:13:50
问题 I am trying to override the core Symfony components with my own. The method I am using is: "autoload": { "psr-0": { "": "src/", "Symfony": "src/vendor/symfony/src/" } } However when I run composer update and install it never seems to take this into account. Is this not the correct method to force the autoloader to look into another directory first before the Symfony core? Any pointers appreciated! EDIT: Paths to files src/vendor/symfony/src/Symfony/Bridge/Twig/Extension/TranslationExtension

Symfony2 remove and save many to many relations

折月煮酒 提交于 2019-12-07 15:44:53
问题 I need your help today. I'm working on a small application using symphony 2.1 but I have a base problem, I have to tables with a many to many relation which creates a third table: class Usuario implements UserInterface { /** * @ORM\ManyToMany(targetEntity="Alood\BackBundle\Entity\Alergeno", inversedBy="usuarios") * @ORM\JoinTable(name="UsuariosProductos", * joinColumns={@ORM\JoinColumn(name="usuario_user", referencedColumnName="user")}, * inverseJoinColumns={@ORM\JoinColumn(name="alergeno_id"

Overriding symfony radio widget

社会主义新天地 提交于 2019-12-07 15:15:33
问题 Default radio widget creates a following structure: <label>...</label> <div id="..."> <div class="clearfix prettyradio labelright blue"> <input type="radio" id="..._0" name="..." value="..." style="display: none;"> <a href="#" class=""></a> ... </div> I found the radio_widget block, but it contains only an input itself. So I can customize there only this part: <input type="radio" id="..._0" name="..." value="1" style="display: none;"> But I can't understand how to change whole the structure

Container Dependecy Injection not working in Fixtures after upgrading symfony 2.0 to 2.1/2.2

爱⌒轻易说出口 提交于 2019-12-07 12:34:24
I upgraded a project from Symfony 2.0 to 2.1. After that my tests stopped working. The problem is that I use fixtures which implement the ContainerAware interface. Now after the upgrade the setContainer() method does not get called anymore. I tried upgrading further to 2.2. The problem still persists. composer.json: { "name": "symfony/framework-standard-edition", "license": "MIT", "type": "project", "description": "The \"Symfony Standard Edition\" distribution", "autoload": { "psr-0": { "": "src/" } }, "require": { "php": ">=5.3.3", "symfony/symfony": "2.2.*", "doctrine/orm": ">=2.2.3,<2.5-dev

How to administratively invalidate a session that used “Remember Me” option?

本秂侑毒 提交于 2019-12-07 10:54:21
问题 I'm using Symfony 2.1.6 and PdoSessionStorage. I'm trying to add the same functionality that Facebook has to my application where you can show a user all the active sessions they have with the website (showing device type and location based on IP) and allow them to end any session if it looks suspicious. Deleting the record from the PdoSessionStorage table doesn't work as the record is re-created automatically by Symfony again as soon as I perform activity again in that session (instead of

Symfony 2.1 Security Cross Subdomain

最后都变了- 提交于 2019-12-07 09:09:06
问题 Running Symfony 2.1 on an application and we have different sandboxes of the code. Eg. aequasi.someurl.com dev.someurl.com hotcarl.someurl.com I cant seem to figure out why, but when im logged into aequasi , and i go to hotcarl , i need to log in again. When i do, it logs me out of aequasi . All sandboxes are using the same database for auth i have this in my config.yml : framework: session: cookie_domain: .someurl.com domain: .someurl.com ive got the php.ini set up to use the same url too

Symfony 2.1 Doctrine filters (enable/disable)

懵懂的女人 提交于 2019-12-07 08:20:32
问题 I'm currently implementing Doctrine filters in my Symfony2.1 project with the following setup: <?php namespace Acme\Bundle\Entity; class Article { /** * @ORM\Column(type="string") */ private $status; ... } //app/config/config.yml doctrine: orm: filters: status: class: Acme\Bundle\Filter\StatusFilter enabled: false .... //src/Acme/Bundle/Filter/StatusFilter.php namespace Acme\Bundle\Filter; use Acme\Bundle\Entity\Status; class StatusFilter extends SQLFilter { public function