symfony1

edit values in app.yml by backend

北慕城南 提交于 2019-12-13 08:11:16
问题 public function executeShow(sfWebRequest $request) { $this->category = $this->getRoute()->getObject(); $this->pager = new sfDoctrinePager( 'JobeetJob', sfConfig::get('app_max_jobs_on_category') ); $this->pager->setQuery($this->category->getActiveJobsQuery()); $this->pager->setPage($request->getParameter('page', 1)); $this->pager->init(); } sfConfig::get('app_max_jobs_on_category') # apps/frontend/config/app.yml all: active_days: 30 max_jobs_on_homepage: 10 max_jobs_on_category: 20 how can i

How to let the user choose the upload directory?

╄→尐↘猪︶ㄣ 提交于 2019-12-13 07:40:09
问题 I have a form used to upload images in my blog engine. The files are uploaded to web/uploads , but I'd like to add a "choice" widget to let the users pick from a list of folders, for instance 'photos', 'cliparts', 'logos'. Here's my form class ImageForm extends BaseForm { public function configure() { $this->widgetSchema->setNameFormat('image[%s]'); $this->setWidget('file', new sfWidgetFormInputFileEditable( array( 'edit_mode'=>false, 'with_delete' => false, 'file_src' => '', ) )); $this-

symfony fixtures: set ondelete: CASCADE on refclass table

吃可爱长大的小学妹 提交于 2019-12-13 06:32:49
问题 I'm using symfony 1.4.5, Doctrine 1.2 and Mysql 5. In my schema.yml I have a few Many-to-Many relations which work great. But I need the joining table to have onDelete: CASCADE. Now for doctrine it is needed to add onDelete: CASCADE on the side where the foreignkey exists but since the refclass does not have any relations in the schema.yml I can't. example schema: Organisatie: connection: doctrine tableName: organisatie columns: org_id: type: integer(4) fixed: false unsigned: false primary:

Symfony check whether jQuery already included

本秂侑毒 提交于 2019-12-13 06:10:04
问题 Is there any way to check in sfContext whether jQuery library is already added, using: sfContext::getInstance()->getResponse()->addJavascript('/js/jquery-1.4.2.min.js'); or addJavascript('jquery-1.4.2.min.js', sfView::getContext()); or use_javascript('jquery-1.4.2.min.js'); in the templates? Seems to me that adding more jQuery's stops their action. 回答1: You should use your own check. Use your own sfWebResponse Override addJavascript Add the check So create a new myWebResponse.class.php file

Symfony Filter not working

社会主义新天地 提交于 2019-12-13 05:48:46
问题 My schema: Poster: actAs: Timestampable: ~ Sluggable: fields:[name] columns: id: type: integer(4) autoincrement: true primary: true name: type: string(255) notnull: true filename: type: string(255) notnull: true approved: type: boolean(1) default: false start_date: type: date notnull: true end_date: type: date notnull: true user_id: type: integer(20) default: 1 attributes: export: all validate: true relations: User: class: sfGuardUser local: user_id foreign: id type: one foreignType: many

Symfony, Doctrine Guard Plugin, generator.yml file, customizing by using another module

点点圈 提交于 2019-12-13 05:13:34
问题 I am using Symfony 1-4 and sfDoctrineGuardPlugin. My question is, on Doctrine Guard Plugin as you know each module came with generator.yml. And i need to customize generator.yml. For example, i need to display another table's (module's) column. // for example i am at X module and need to sort according to another table's/module's column ... config: list: sort: [X, asc] // x is not on my module Same thing with list/display. I need to display some column which is not on my current module... I

Execute symfony task command from the shell_exec() permission denied

送分小仙女□ 提交于 2019-12-13 04:58:40
问题 I have symfony task call "doNothing" and i want to execute it from executing shell_exec('/var/www/esm/symfony php symfony doNothing'); by calling to my symfony action apache error saying permission denied. i think www-data user dont have permission how could i resolved this? Edited error is sh: /var/www/esm/symfony: permission denied 回答1: You should look in the directory where your script is. Use ls -la to show all files in the folder and their permissions (to execute php script file must

Choosing between Symfony's Doctrine ORM files Model.class.php and ModelTable.class.php

此生再无相见时 提交于 2019-12-13 04:46:38
问题 when doctrine builds model files for a table, it generates three files, essentially BaseModel.class.php , Model.class.php and ModelTable.class.php . Common knowledge requires that any modifications be done to Model.class.php or ModelTable.class.php vs BaseModel.class.php . But when do you choose between either Model.class.php vs ModelTable.class.php . From what I gather is that Model.class.php is for a single instance and ModelTable.class.php is for multiple instances. Can anyone shed any

sfDoctrineGuard and Forgot Password function

时光毁灭记忆、已成空白 提交于 2019-12-13 03:36:37
问题 I'm pretty new to smyfony and I've been playing around with that sfDoctrineGuard plugin the whole day. it's working for the most part. I'm just having troubles with the forgot_password function. Actually I did everything according to the readme file in the plugin. the problem is: in security.yml i set default: is_secure:true obviously in the module sfGuard there's a security.yml that sais: secure: is_secure: false signin: is_secure: false signout: is_secure: false which makes sense, cause

Set mime_types not working for zip file in Symfony

陌路散爱 提交于 2019-12-13 03:25:30
问题 In my Symfony application, I want to set zip file as one of the mime type during the file upload, the code to do this is below: $this->validatorSchema ['Documents'] = new sfValidatorFile ( array ('mime_types' => array( 'application/zip', 'image/jpeg', 'image/pjpeg', 'image/png', 'image/x-png', 'image/gif', 'application/x-zip', 'application/octet-stream', 'application/pdf') ), array ('invalid' => 'Invalid file.', 'required' => 'Select a file to upload.', 'mime_types' => 'The file must be of