symfony-1.4

Symfony 1.4 compatible I18N translation system?

我的梦境 提交于 2019-12-08 08:32:12
问题 I am migrating a small app from Symfony into a separate project, and the only Symfony component that it depends on is I18N string translation. By example: action.class.php : $this->culture = 'pt_BR'; templates/search_box.php : <h1><?php echo __('Destination') ?></h1> i18n/pt_BR/messages.xml : <?xml version="1.0" encoding="UTF-8"?> <xliff version="1.0"> <file datatype="plaintext" source-language="en" target-language="pt_BR" original="messages"> <body> <note> SEARCH BOX </note> <trans-unit id=

symfony : Form with one parameter

∥☆過路亽.° 提交于 2019-12-08 08:03:59
问题 I have a form, and I want to pass it one parameter which must use to fill a widget. I pass the parameter in my url : url_for('myModule/new?parameter='.$myParam) I have tried to take the parameter in my action and display it in my tamplate, but it doesn't work. Action : $this->param = $request->getParameter('parameter'); Template : echo param; But I can't recover it in my form. How can I do this ? 回答1: If this parameter is needed for initializing your form then you could do it like this (keep

Symfony 1.4 embedded form fields at the same indent

◇◆丶佛笑我妖孽 提交于 2019-12-08 06:44:17
问题 I have two models in my Symfony application. First one is Blog: Blog: columns: name: { type: string(20), notnull: true, unique: true } title: { type: string(255), notnull: true } description: { type: string(255), notnull: true } admin_id: { type: bigint, notnull: true } relations: User: class: sfGuardUser local: admin_id ... As you can see this model has a one-to-one relationship with sfGuardUser. I want the registration of these two take place in one form. So I changed the BlogForm class and

Symfony 1.4 with AJAX jQuery. How can I improve the AJAX's function that contains a select box which depends on another select box?

不问归期 提交于 2019-12-08 06:33:48
问题 I use Symfony 1.4. I have three tables related to one another as shown below. Table 1: Conflictos1: connection: doctrine tableName: conflictos_1 columns: id: type: integer(4) fixed: false unsigned: false primary: true autoincrement: true id_sector_actividad: type: integer(4) fixed: false unsigned: false primary: false notnull: true autoincrement: false id_subsector_actividad: type: integer(4) fixed: false unsigned: false primary: false notnull: false autoincrement: false relations:

Symfony sfDoctrineGuardPlugin custom login query

时光毁灭记忆、已成空白 提交于 2019-12-07 19:18:29
问题 I use symfony sfDoctrineGuardPlugin to manage authentication for both frontend users and backend users. It's fine, except that I don't want frontend users to be able to login to the backend app. I can setup credentials, but credentials are checked after a user gets authenticated. What I want is to have sigin in form to never validate for a user, that is not in a backend group. How can I do this? 回答1: I think I found a better solution. sfDoctrineGuard plugin has its own post validator that

How to simulate an error 500 in Symfony 1.4?

大城市里の小女人 提交于 2019-12-06 12:29:21
I created an error500.php file in web/errors/ and would now like to test it. I tried to put this line in one of my actions: $this->getResponse()->setStatusCode(500); Unfortunately it looks like it's ignored. Do you guys have any idea of what's happening here? I'm using Symfony 1.4. Edit: Firebug is telling me that the error is actually fired but the page is still loading afterwards. And I'm in the prod env. I'm pretty sure throwing any exception should trigger the error page: throw new sfException('Testing the 500 error'); However, the location of the error page is different in symfony 1.2+:

Symfony 1.4 doctrine - many-to-many relationship with extra field in intermediate table

爱⌒轻易说出口 提交于 2019-12-06 11:02:18
There are 3 tables: shelf, section and shelf_has_section intermediate table to support n-m relation. The schema build from symfony doctrine:build-schema looks as following. Simply, shelf(id, position) section(id, name) shelf_has_section(shelf_id, section_id, number_of_books) The schema. Shelf: connection: doctrine tableName: shelf columns: id: type: integer(4) fixed: false unsigned: true primary: true autoincrement: true position: type: string(255) primary: false notnull: true autoincrement: false relations: ShelfHasSection: local: id foreign: shelf_id type: many Section: connection: doctrine

How do you override your team's default databases.yml in Doctrine for using your local settings?

两盒软妹~` 提交于 2019-12-06 08:28:48
Looking for a way to cleanly override the values of databases.yml in Doctrine / Symfony in order to use my own local settings? The idea is not touching databases.yml and using some sort of local unversioned file to override that default. I'm trying to find out how without much success yet :/ For this kind of configuration file, that contains stuff that depends on the environment (dev, testing, staging, production, ...) , I generally use one file per environment, and all are commited to source-control. For example, I could have : databases.yml == the development version, which will work when

Copy a Doctrine object with all relations

送分小仙女□ 提交于 2019-12-06 08:27:37
问题 I want to copy a record with all his relations. I'm trying with: $o = Doctrine::getTable('Table')->Find(x); $copy = $object->copy(); $relations = $o->getRelations(); foreach ($relations as $name => $relation) { $copy->$relation = $object->$relation->copy(); } $copy->save(); This code doesn't works, but I think it's on the way. 回答1: I never could get the deep copy function to operate correctly. I manually coded a deep copy function for one of my models like this public function copyAndSave ()

How to include multiple php libraries in Symfony?

ぐ巨炮叔叔 提交于 2019-12-06 05:55:54
so, I have some php files in my apps/myprogram/lib folder. e.g. apps/myprogram/lib/myLibA.class.php When I run in my modules/actions/ scripts, and try to use the functions in myLibA, I cannot. because symfony complains that the myLibA class is not defined. do I need to specify anywhere in the symfony framework that myLibA.class.php is a required library? Symfony's autoloader looks by default for your classes in the top-level <project>/lib directory. Any file in that directory or below (with the exception of "vendor") will be searched for classes. Symfony searches for any .php file with class