symfony1

Secure file management with symfony

假装没事ソ 提交于 2019-12-06 12:18:53
问题 By default, symfony uploades file to web/upload folder, so they are accessible for anyone. I need to check user credentials on every request to a file. How should I do this? 回答1: Move your uploads outside of your webroot, like in /data/uploads. In that case, you'll need to put this in your ProjectConfiguration file: sfConfig::set('sf_upload_dir' => sfConfig::get("sf_data_dir") . DIRECTORY_SEPARATOR . 'uploads'); Provided that you always used sf_upload_dir to specify the uploads folder, all

Processing large data sets via AJAX brings no speed benefits

拈花ヽ惹草 提交于 2019-12-06 12:11:40
问题 I have several time consuming database queries to run. Each has been built to be triggered from an option chosen on a web page. I thought I was being quite cunning by firing off the work via several AJAX requests . I presumed that multiple requests would be split over multiple processes/threads meaning the work would be completed relatively quickly for the user. However, the requests seem to be processed in serial , meaning that no speed benefit is felt by the user. Worse still, AJAX requests

sfWidgetFormChoice rendered as an unordered list

孤街浪徒 提交于 2019-12-06 11:56:09
I'm using symfony 1.4.3 Is there some way to render a sfWidgetFormChoice as an unordered list? In the API there is an option called 'renderer_class' but I can't find any documentation or example about it. Thanks! take a look at lib/vendor/symfony/lib/widget/sfWidgetFormSelect.class.php for example. Basically, what you need to do is implement a class that extends sfWidgetFormChoiceBase and write a method render() therein. A minimal example would look like this: <?php class sfWidgetFormChoiceUnordered extends sfWidgetFormChoiceBase { public function render($name, $value = null, $attributes =

Work with app/console in Symfony at Mac OS X

孤者浪人 提交于 2019-12-06 10:44:30
问题 I've installed Symfony on Mac Os X and do: chmod -R 777 app/cache app/log Try do this: php app/console cache:clear And get back error: [RuntimeException] Unable to write in the "/Users/anton/Sites/local/Symfony/app/cache/dev" directory Try to fix it! Thanks! 回答1: If you are on Mac you can use ACL as it is explained here. From the project directory: sudo chmod +a "_www allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs sudo chmod +a "whoami allow delete,write,append

Passing PHP arguments into NetBeans into a page that features symfony url-routing

只愿长相守 提交于 2019-12-06 08:33:52
问题 I am doing the Jobeet tutorial that features url routing. The url routing (I think that's the proper term) makes urls look like this http://localhost:8080/frontend_dev.php/job/extreme-sensio/paris-france/2/web-designer I would like to debug into this page however I cannot properly pass arguments into NetBeans. I set the arguments in NetBeans "Run Configuration" area to this job/extreme-sensio/paris-france/2/web-designer however the url that is executed is this (notice the ? that NetBeans

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 ()

Performing Join with Multiple Criteria in Propel 1.5

二次信任 提交于 2019-12-06 06:48:56
问题 This question follows on from the questions here and here. I have recently upgraded to Propel 1.5, and have started using it's Query features over Criteria. I have a query I cannot translate, however - a left join with multiple criteria: SELECT * FROM person LEFT JOIN group_membership ON person.id = group_membership.person_id AND group_id = 1 WHERE group_membership.person_id is null; Its aim is to find all people not in the specified group. Previously I was using the following code to

Symfony 1.4 change admin generator actions or templates

╄→尐↘猪︶ㄣ 提交于 2019-12-06 06:35:27
问题 how can I modify admin generated modules (acions and templates)? They are stored in cache but I need to modify them (templates!). Is it possible at all? Greetings 回答1: Sure is - just copy the template files from the cache to the relevant module/templates folder in the backend for templates and then modify/extend. For actions, add the same named action to the module/actions/actions.class.php file, and extend it as necessary, e.g.: apps/backend/modules/blah/actions/actions.class.php : class

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

In remote host: Connection could not be established with host smtp.gmail.com [Connection timed out #110]

坚强是说给别人听的谎言 提交于 2019-12-06 05:31:19
问题 after deploying I gettin this error below when i try to send an mail: 500 | Internal Server Error | Swift_TransportException Connection could not be established with host smtp.gmail.com [Connection timed out #110] stack trace * at () in SF_ROOT_DIR/lib/vendor/symfony/lib/vendor/swiftmailer/classes/Swift/Transport/StreamBuffer.php line 235 ... 232. } 233. if (!$this->_stream = fsockopen($host, $this->_params['port'], $errno, $errstr, $timeout)) 234. { 235. throw new Swift_TransportException(