symfony1

Elmah For other PHP

孤街浪徒 提交于 2019-12-10 19:04:01
问题 Is there an Elmah equivalent for PHP in general, Symfony in particular? 回答1: Symfony comes with a logging framework that can log to file or any other backend you care to give it. From my understanding of Elmah this is about as close as you can get - there's nothing with all the features available and integrated with frameworks such as Symfony. Please see this chapter in the Symfony book for more information on Symfony's logging capabilities. 回答2: For future reference, elmah.io can be used for

Doctrine: Query only where relationship doesn't exist?

不想你离开。 提交于 2019-12-10 18:23:51
问题 I have two tables: Articles and Categories. Articles can have a single Category assigned to them. But they don't have to have a Category. Schema: Article: columns: title: type: string(255) content: type: string(255) category_id: type: integer(4) Category: columns: name: type: string(255) article_id: type: integer(4) relations: Article: class: Article local: article_id foreign: id foreignAlias: ArticleCategories I can query for all Articles that have categories assigned to them like this:

PHP ini directive per directory depending of request_uri

那年仲夏 提交于 2019-12-10 17:20:40
问题 I'm trying to change the size limit of an upload. I know I have to change those directive, in Apache configuration (some can't be changed using ini_set) php_value session.gc_maxlifetime 3600 php_value max_input_time 3600 php_value max_execution_time 3600 php_value upload_max_filesize 10M php_value post_max_size 110M Unfortunately, I can't do that directly in a <Directory> of my virtualhost, since the directory is always the same (I'm using a front controller, thus all request go through index

Temporary Connection to External Database with Symfony/Doctrine

元气小坏坏 提交于 2019-12-10 17:14:13
问题 Summary: I want to be able to run a query against an external database to grab some needed data at the time the user logs in. I don't want this site to do anything else with the external database. Long term, it may need to be able to push data back, but specifically, I don't want symfony to try to build the schema for the external db, it should just leave it alone and allow a connection from time to time. Details: I'm trying to create a temporary connection to a database of another symfony

Preventing Doctrine's query cache in Symfony

对着背影说爱祢 提交于 2019-12-10 12:50:57
问题 In my Symfony/Doctrine app, I have a query that orders by RANDOM(). I call this same method several times, but it looks like the query's result is being cached. Here's my relevant code: $query = $table->createQuery('p') ->select('p.*, RANDOM() as rnd') ->orderBy('rnd') ->limit(1) ->useQueryCache(null) ->useResultCache(null); $result = $query->fetchOne(); Unfortunately, the same record is returned every time, regardless of me passing null to both useQueryCache and useResultCache . I tried

Propel: how to remove link made via many-to-many relation

谁说我不能喝 提交于 2019-12-10 12:13:19
问题 (link to previous question just in case: Struggling with one-to-many relation in an admin form) I have this many-to-many relation in my Symfony-1.3 / Propel-1.4 project between User and Partner . When the User is being saved, if it has certain boolean flag being true, I want to clear all the links to the partners. Here is what I do at the moment and it doesn't work: // inside the User model class public function save(PropelPDO $con = null) { if ($this->getIsBlaBla()) { $this-

Doctrine Entity findBy Many to Many

给你一囗甜甜゛ 提交于 2019-12-10 10:55:41
问题 I have a many to many relationship between products and colours. What I am trying to do is find products by their colours. eg) $colours = $em->getRepository('Xxxxx\XxxxxBundle\Entity\Colour')->findBy(array('name'=>'red'); $products = $em->getRepository('Xxxxx\XxxxxBundle\Entity\Product')->findBy(array('colours'=>$colours)); This is my Yaml config: Xxxxx\XxxxxBundle\Entity\Product: type: entity manyToMany: colours: targetEntity: Colour joinTable: name: Product_Colour joinColumns: product_id:

jQuery is not defined (in [Symfony] templating environment)

一个人想着一个人 提交于 2019-12-10 10:22:09
问题 I am trying to display a page that uses jQuery. The AJAX functionality implemented in the page does not work. I am using FF for debugging. When I look in the console panel, I see the following error: 'jQuery is not defined'. Ah, that's an easy one I think - maybe the jQuery file has not been included correctly, or not found etc. So I take a look at the HTML and click on the node - lo and behold, the jQuery script has been CORRECTLY included in the page. Although none of the other js libraries

Symfony: Is it possible to setTemplate for components?

青春壹個敷衍的年華 提交于 2019-12-10 02:48:51
问题 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/) 回答1: 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

Creating a rss feed in Symfony

你。 提交于 2019-12-10 00:12:52
问题 I'm trying to create a RSS feed in Symfony. I've added the following route : rss_every_content: url: /rss/all param: { module: content, action: index, sf_format: rss } requirements: sf_method: [get] And I created a file called indexSuccess.rss.php in module/content/templates/ : test message But when I go to the url mysite/rss, all I get is an empty page ! No content at all, not even the debug toolbar... Help ! What is going on ? 回答1: I had the same problem as you. I noticed that sf_format: