symfony1

Django-like framework on Ruby?

好久不见. 提交于 2019-12-05 17:09:26
Django as a framework is a neat little package. There are very few files (compared to Rails) and it's got a clean structure. The fact that you can plug and unplug apps between different projects is an extremely nifty feature. At the same time, Ruby's hacking ability is unparalleled. It's complete object-orientedness makes it more expressive and fun. To cut the story short, is there a Django-like or Django inspired framework on Ruby? If not, would be possible for an implementation of Django on Ruby? What would be the challenges? If one were to create a Django-inspired framework for Ruby, how

Symfony $request->isXmlHttpRequest() issue

余生长醉 提交于 2019-12-05 16:10:24
问题 I need to check if the request is ajax. $request->isXmlHttpRequest() works fine, however if there is a redirect somewhere during the execution, this method will return false. How else can I check if request is ajax in this case? p.s. ajax is initiated by jQuery 回答1: If you arent redirecting to a different application in your project or another external uri just use forward instead if isXmlHttpRequest is true on the first request. Well that method checks against the value of the X-Requested

how to set the selected option in Symfony forms select box

丶灬走出姿态 提交于 2019-12-05 14:53:10
I have a form created with Symfony forms. and in the template i have this selectbox, displayed on the page with the render method. <?php echo $form['field']->render() ?> is it possible to set the selected option of this select box? Or does this have to be done in the class that creates this form? There is the creation of the field done: public function configure() { $this->widgetSchema['field'] = new sfWidgetFormSelect( array("choices" => array('1' => 'test1','2' => 'test2') ) ); } yes, sure — you should have set corresponding form value — either via bind() , either via widget's default option

Force Exclude files from PHPUnit Code Coverage

强颜欢笑 提交于 2019-12-05 13:50:44
问题 Is it possible to forcefully exclude a folder from PHPUnit's code coverage? Problem I've got is, that I have a Symfony 1.4 project, which has folders at ./lib/vendor/symfony/* . I want to exclude anything that's inside ./lib/vendor/* - recursively. Now, I want to exclude them whether they were covered implicitly by my tests or not, i.e. I never want to see these folders. So, I've added this bit to my phpunit.xml config file, but it doesn't seem to exclude these folders, no matter what I do:

Symfony error 500 with app.php, works fine on app_dev.php

荒凉一梦 提交于 2019-12-05 13:35:52
I am currently trying to use our (basic) Symfony 2 app by accessing app.php. However, whenever I try to access app.php, I get an error 500. I have checked the logs, the production log is empty. I have tried the assetic entry in the config file, but to no avail. Anyone else who has any ideas on how to fix this? This is a very basic application (for now), with just some routing changes and a new controller. The most part is html (as a test), so it can't be the php we've written so far. --edit: I currently do not have the documentroot pointing to the /web directory, but I don't have admin rights

How to add canonical tag the pages that are derived from same link?

懵懂的女人 提交于 2019-12-05 11:41:51
I am using symfony 1.0.6. In my site I have two URLs. http://newe4s.com/news/articles/view/033/job-news-and-information and http://newe4s.com/news/articles/view/033/job-news-and-information/graduate/Connections-help-graduates-get-jobs Now, all the new articles are using same layout and both above links get same data from database. Google is reporting duplication of contents since it is getting multiple URLs for same content. When I searched for a solution, I got that using "canonical" structure fixes this issue which require <link rel="canonical" href="http://newe4s.com/news/articles/view/033

How to format dates based on locale?

安稳与你 提交于 2019-12-05 11:18:02
In a template I display the day and month of a specific date : <div class="jour"><?php echo date('d',strtotime($content->getCreatedAt())) ?></div> <div class="mois"><?php echo date('M',strtotime($content->getCreatedAt())) ?></div> This works fine, problem is the month name is in English. Where do I specify that I want the month names in another locale, French for instance ? Symfony has a format_date helper among the Date helpers that is i18n-aware. The formats are unfortunately badly documented, see this link for a hint on them. default_culture only applies for the symfony internationalisation

Symfony: Is it possible to setTemplate for components?

你说的曾经没有我的故事 提交于 2019-12-05 02:31:59
There’s no setTemplate() for components! I know but maybe there is another way to do it ? (The question seems to be about a php framework: http://www.symfony-project.org/ ) There is no setTemplate method on sfComponents. You essentially have 3 options: Name your component the same as the partial you'd like the component to render. This may not be possible if you have multiple components you'd like to share the same template. Create a partial with the same name of your component and include the partial there. That is, if you had a component with an executeFoo() method that you wanted to render

Which unit testing framework do you use for Symfony?

情到浓时终转凉″ 提交于 2019-12-05 02:04:07
问题 Which unit testing framework do you use for Symfony? Lime or PHPUnit? What are the pros and cons of using them? 回答1: In my opinion, here are a few things that come to my mind : PHPUnit is more integrated with other tools, like, for instance, Selenium (PHPUnit can use it to open true real browsers to test your site) phpUnderControl for continuous-integration PHPUnit works well with Xdebug, to generate code-coverage reports PHPUnit is more widely used ; which probably means more support But

Execute custom SQL in symfony

纵然是瞬间 提交于 2019-12-05 01:41:57
问题 I'm trying to execute some custom SQL to retrieve some model objects in a Symfony application. I found a tutorial on the web that said something like this would allow me to execute the query although not populate the models (populating the model isn't a major issue, it's just for read only data). $pdo = Doctrine_Manager::getInstance()->connection()->getDbh(); $pdo->prepare("SELECT * from something complicated"); $pdo->execute(); $this->sensorReadings = $pdo->fetchAll(); But I'm getting an