symfony1

How to bind a array with a single data to a form using the Action file in Symfony

旧巷老猫 提交于 2020-01-03 04:59:08
问题 I need to add a variable to be displayed as a default in the form in the widget area, I have set a filter to select a single value according to a different name in the dropdown. i have set the selected data to a session. and from that session i have taken that data to the action file. I want to display the selected data in the form dropdown with out creating a submit event. the form is displayed below public function configure() { //the dropdown $cost_range[''] = '-- Please select --'; for (

sfErrorNotifierPlugin: The “default” context does not exist

时光怂恿深爱的人放手 提交于 2020-01-01 19:12:30
问题 I have installed the sfErrorNotifierPlugin . When both options reportErrors/reportPHPErrors reportPHPWarnings/reportWarnings are set to false, everything is ok. But I want to catch PHP exceptions and warnings to receive E-mails, but then all my tasks fail, including clear-cache. After few hours of tests I'm 100% sure that the problem is with set_exception_handler/set_error_handler. There's a similar question: sfErrorNotifierPlugin on symfony task but the author there is having problems with a

Migrating Existing Users and Passwords to new Symfony/sfDoctrineGuard User System

陌路散爱 提交于 2020-01-01 17:42:36
问题 I have an existing, non-framework-based PHP/MySQL website. It has a simple security model, with a users table with usernames and hashed (MD5) passwords. I'm currently working on "version 2" of this site, this time using Symfony, with Doctrine. The new version is working fine, and I'm using the sfDoctrineGuard plugin for my user management. I'd like to migrate my existing users into the new app with the minimum of fuss, retaining their existing usernames and passwords. My main problem, though,

Custom route class

吃可爱长大的小学妹 提交于 2020-01-01 10:53:55
问题 In symfony 1.4 you could define a custom route class, where you override the generation of url with custom logic, for example: custom: class: sfDoctrineRouteCollection options: model: Custom prefix_path: /custom/category/:category_id column: id route_class: CustomDoctrineRoute class CustomDoctrineRoute extends sfDoctrineRoute { public function generate($params, $context = array(), $absolute = false) { if (!isset($params['category_id'])) { $params['category_id'] = sfContext::getInstance()-

Symfony - Is it possible to disable output escaping per module (or per template)?

落爺英雄遲暮 提交于 2020-01-01 09:37:06
问题 I'm trying to output some HTML in an XML template and Symfony's escaping method is messing it up. So I tried making a copy of settings.yml in the module's config folder, but it seems to be completely ignored. Is there an easy way to change the escaping_strategy and/or escaping_method settings per module or even per template? 回答1: While output escaping is turned on you still have access to the raw value through $sf_data . For example, if the HTML you're trying to output was stored in a

PDO connection error when using symfony and MAMP

白昼怎懂夜的黑 提交于 2020-01-01 04:29:12
问题 Getting an PDO error when trying to do php symfony doctrine:insert-sql The error I get: Warning: PDO::__construct(): [2002] Connection refused (trying to connect via tcp://127.0.0.1:3306) in /Users/johannes/Programmering/PHP/htdocs/symfony/sfprojects/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection.php on line 470 databases.yml all: doctrine: class: sfDoctrineDatabase param: dsn: mysql:host=127.0.0.1;dbname=jobeet; username: root password: root Doing a

How to structure this Symfony web project?

谁说胖子不能爱 提交于 2019-12-31 23:00:34
问题 I am new to Symfony and am not sure how to best structure my web project. The solution must accommodate 3 use cases: Public access to www.mydomain.com for general use Member only access to member.mydomain.com Administrator access to admin.mydomain.com All three virtual hosts point to the Symfony /web directory Questions: Is this 3 separate applications in my Symfony project (e.g. "frontend", "backend" and "admin" or "public", "member", "admin")? Is this a good approach if there is to be some

Web front end caching best practices for site?

狂风中的少年 提交于 2019-12-31 22:48:29
问题 Summary As I'm looking on stackoverflow and around the net, I find that there is a general lack of good documentation on best practices for caching a high performance site that uses sessions. It would be helpful if we can share some ideas around some basic building blocks particularly around caching. For the purpose of this discussion, I'm avoiding memcache and focusing on the caching of static and pages that are fully generated. So to set up the scenario, imagine a web server (say nginx),

How to sort own columns in admin panel with symfony?

两盒软妹~` 提交于 2019-12-31 04:10:48
问题 M schema.yml: News: columns: title: type: string(50) category_id: type: integer(4) relations: Category: local: category_id foreign: category_id type: one Category: columns: category_name: type: string(50) generator: class: sfDoctrineGenerator param: model_class: News theme: admin non_verbose_templates: true with_show: false singular: ~ plural: ~ route_prefix: news with_doctrine_route: true actions_base_class: sfActions config: actions: ~ fields: ~ list: display: [news_id, title, category_name

How to query NOT NULL with Doctrine?

半腔热情 提交于 2019-12-30 07:55:47
问题 I have table Test: Test: id | name 1 | aaa 2 | 3 | ccc 4 | aaa 5 | 6 | ddd I want result where name is NOT NULL: aaa ccc aaa ddd How can i get with: Doctrine_Core::getTable('Test')->findBy('name', NOTNULL??) <-doesnt working and in model with: $this->createQuery('u') ->where('name = ?', NOTNULL ???) <- doesnt working ->execute(); 回答1: Try this: $this->createQuery('u') ->where('name IS NOT NULL') ->execute(); which is standard SQL syntax. Doctrine doesn't convert Null values into proper sql.