[symfony-users] Re: an intermitent bug, involving an error about favicon.ico

2009-09-10 Thread Fabrice B

I experienced the same as Thomas.

The solution, it seems, would be to edit your sfGuardAuth module to
remove any forwarding to the referer.

But I still don't understand how symfony can actually reference the
favicon url as a referer ! I have not taken the time to verify if the
favicon.ico url is actually stored in the $_SERVER['HTTP_REFERER'] or
if this is a second effect of some symfony magic...

Fabrice
--
http://www.theodo.fr

On Sep 10, 12:02 am, Thomas Rabaix  wrote:
> looks to me the sfGuardPlugin keeps the last referer to your favicon url.
> This can happen if the file does not exist, then symfony catch the call.
> Your app require authentication, so guard plugin keep the referer as the
> favicon.
>
> So next time you login it works...
>
> The favicon call can be done randomly by the web browser that why the
> problem is intermittent.
>
>
>
>
>
> On Wed, Sep 9, 2009 at 10:48 PM, Jake Barnes  wrote:
>
> > > An easy fix for your problem is adding a favicon.ico to your document
> > > root. Also make sure that the login page doesn't require any other
> > > images that do not exist on the server.
>
> > I'm sorry if I wasn't clear, but I've already tried this. Now what
> > happens is that you fill in your username and password and then you
> > hit submit and then you end up looking at an URL like this:
>
> >http://www.mydomain.com/favicon.ico
>
> > At which point, you can see the favicon, but that is all you can see,
> > because that is where the browser is now pointing.
>
> > If you log out, and then log back in, the problem vanishes. As I said
> > before, the problem is intermittent.
>
> >  lawrence
>
> > On Sep 9, 5:36 am, Bernhard Schussek  wrote:
> > > Hi Jake,
>
> > > Can you try to access the favicon directly on the server? The problem
> > > probably is that the favicon is requested by the login page. Instead
> > > of loading an image, the symfony stack is launched, redirects to the
> > > login page and stores the requested page in the session, which was the
> > > favicon.
>
> > > Once you sign in successfully, symfony recalls the remembered page and
> > > redirects to it.
>
> > > An easy fix for your problem is adding a favicon.ico to your document
> > > root. Also make sure that the login page doesn't require any other
> > > images that do not exist on the server.
>
> > > Bernhard
> > > --
> > > Software Architect & Engineer
> > > Blog:http://webmozarts.com
>
> --
> Thomas Rabaixhttp://rabaix.net
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: Symfony Facebook Integration

2009-09-06 Thread Fabrice B

http://www.symfony-project.org/plugins/sfFacebookConnectPlugin

It's been released two weeks ago, and we are 4 people (I know) using
it in projects already. For the moment I did not open the svn, but I
am very responsive when given a patch. It is theoretically propel/1.0
and doctrine/1.2 compatible.

You can see our conversation on my blog :
http://www.theodo.fr/blog/2009/08/a-facebook-connect-plugin-for-symfony/

I am looking forward all of your suggestions !

Regards,

Fabrice Bernhard
--
http://www.theodo.fr

On Sep 4, 7:09 pm, Kieu Anh Tuan  wrote:
> Interesting question. I've heard about a plugin named
> sfFacebookConnectPlugin during the Symfony live in Paris but there's nothing
> so far. Any idea on the development state of the plugin or how to get
> involved?
>
> On Sep 4, 2009 6:36 PM, "Sorom Uzomah"  wrote:
>
> Hi Daniel,
>
> Thanks alot, any information on facebook integration ?
>
> --
> *From:* Richtermeister 
> *To:* symfony users 
> *Sent:* Friday, September 4, 2009 4:36:44 PM
> *Subject:* [symfony-users] Re: Symfony Facebook Integration
>
> Hey Surom, I 
> believehttp://www.symfony-project.org/plugins/sfPropelApplyPlugincould help.
> Haven...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: How to automatically add stars on required fields using sfForm in Symfony 1.2

2009-08-31 Thread Fabrice B

> > > ho ho !! a third solution ;)
> > > The solution is mainly :
>
> > > call a static method
> > > it goes through the widgetSchema recursively
> > > update the label to be an *object* and not a sting.
> > > echo $label will invoke the __toString method
> > > the __toString format the label with default string : %s *


Looks like a very clean solution !

However, I would rename "Translable" in "Translatable" unless I
misunderstood something :-)

Fabrice Bernhard
--
http://www.theodo.fr
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: sfEasyGMapPlugin not working

2009-07-16 Thread Fabrice B

Hi Zach,

this is a really strange problem but will be actually be solved
unintentionally in the next release of the plugin : the new version
will use autoloading of the maps source file at the same time as the
generic google js api file. You can already check how it works in the
dev branch of the plugin:

http://trac.symfony-project.org/browser/plugins/sfEasyGMapPlugin/branches/dev/lib/GMapClient.class.php

The new version should be released around september, the time to test
everything which was added by the different developers and package it
well. And if I have time, I will also try to separate the PHP and
javascript layer as much as possible.

By the way for your information, if you like the plugin, it is now
possible to use the dev branch in any php project, outside of symfony!
Even if I wonder how one can still use php outside of symfony... :-)

Regards,

Fabrice
--
http://www.theodo.fr

On Jul 16, 5:34 pm, Zach  wrote:
> Hey Sebastian,
>
> The google javascript was getting loaded after the javascipt that
> draws the map... hence the "google" var was not found.
> I know I had tried putting the javascript source in manually before,
> but I must have had a different problem at the time.
>
> Now it works. Thank you very much for all your help and patience. It
> is greatly appreciated.
>
> Do you know why it would be loading out of order? Is there anything I
> can do to fix that? If not, it's not a problem to load this script
> manually, I'm just curious why it's not functioning the way it should.
>
> Again thanks for all you help.
>
> Zach
>
> On Jul 16, 9:19 am, Sebastian Müller
>
>  wrote:
> > Hi Zach,
>
> > Can you load the source from your JavaScript directly or can you check
> > with Firebug, if this script correctly loaded?
> > The error mean, that he can't found the JavaScript var "google". This
> > var is loading by the google JS source:
> >  > src="http://www.google.com/jsapi?key=ABQI5obbqtnOwlU7fJ78TAw-0BT4JpDCw...";>
>
> > Sunny regards from Hamburg
> > Sebastian
>
> > Zach schrieb:
>
> > > Thank you Sebastian,
>
> > > I installed Firebug and got the error:
>
> > > google is not defined
> > > sample1()sample1 (line 21)
> > >    google.load("maps", "2");
>
> > > hmm... where should it be defined at?
>
> > > Thanks for all your help,
>
> > > Zach
>
> > > On Jul 16, 3:03 am, Sebastian Müller
> > >  wrote:
> > >> Hi Zach,
>
> > >> hmm, thats strange. Have you Firebug on your Firefox installed?
> > >> Maybe you can check, if you have any JavaScript error.
>
> > >> If I start with this Plugin, I setup a API Key forhttp://localhost/,
> > >> create the part in the app.yml and tested the "sample1" example. And it
> > >> was working on my site.
>
> > >> Sorry, but otherwise I have unfortunately no idea anymore.
>
> > >> BR
> > >> Sebastian
>
> > >> Zach schrieb:
>
> > >>> I have not. Do I just put it in frontend/templates/layout.php?
> > >>> I tried that now, and it added  > >>> src="http://www.google.com/jsapi?
> > >>> key=ABQI5obbqtnOwlU7fJ78TAw-0BT4JpDCwIgIRnp1ddTI6MvRVBGLbhQyWub0Cef-
> > >>> VHzdDo70uUVQrZtOIA"> to the source, but it is still not
> > >>> loading the map, just a large blank area where the map would be
> > >>> - Zach
> > >> --
> > >> Sebastian Müller
> > >> s.muel...@nm-f.dehttp://www.new-mediafactory.de
>
> > --
> > Sebastian Müller
> > s.muel...@nm-f.dehttp://www.new-mediafactory.de
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: sfEasyGMapPlugin not working

2009-07-15 Thread Fabrice B

Hi Zach,

possible sources of errors :
 - you are using output escaping. In this case you should write in
your template $gMap = $sf_data->getRaw(’gMap’); to disable output
escaping on the $gMap variable
 - you are not connected to the Internet. This may seem stupid but
that can happen :-) In that case, you will see using firebug that the
javascript file of Google is empty
 - you did not set your api keys correctly. This is easy to check, you
just need to find the
http://www.google.com/jsapi?
key=ABQIR8dhgMmvaR96TE0zbrZpPhQFiMk9rCRpAVfjZuYFZtH1h1BR3xSPD2PKz9UJARRHopRTimtYjbDKAA">
line in your html source. If the key is empty, then that's where you
should look for your mistake. symfony cc might be a solution in that
case :-)


Regards,

Fabrice Bernhard
--
http://www.theodo.fr


On Jul 15, 10:25 am, Sebastian Müller
 wrote:
> Hi Zach,
>
> no. Because for the normal test, you didn't need the web folder from
> this plugin. I think there is something wrong with your API key.
>
> Loog on you html source code and check which API key is used. Make sure
> thats the right key for you local/test url!
>
> Here is my test template:
> 
> getRaw('gMap'); ?>
> 
> 
>
> Test this, maybe it works also for you.
>
> BR
> Sebastian
>
> Zach schrieb:
>
> > Sample 1 does not work for me. When I go here mydomain/
> > frontend_dev.php/sfEasyGMapPlugin/sample1 I just get the text "The
> > Map" a big white space where the map should be and a search box to
> > search the map.
>
> > Did you move the the entire contents of plugins/sfEasyGMapPlugin/web
> > to web/sfEasyGMapPlugin when you were setting it up?
>
> > Thanks,
> > Zach
>
> --
> Sebastian Müller
> s.muel...@nm-f.dehttp://www.new-mediafactory.de
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: Symfony-Doctrine Migrations and Branches

2009-05-14 Thread Fabrice B

A less technical solution :

 - everybody has on its own computer the main branch and his own
branch, which share the same development database
 - the rule is to create migration files only in the main branch

As long as migrations only affect database structure in a non-
destructive way, this works pretty fine. This is less fine if you :
 - delete tables/columns that another developer is still using. But
that is a bad sign in general !
 - or if you want to include code that refers to the model in the
migration. But experience shows that this is also a bad idea to do
anything else than modifications to the database structure in
migrations.

Cheers,

Fabrice Bernhard
--
http://www.theodo.fr
http://www.allomatch.com



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: Exporting using sfPhpExcel displays in browser rather than to file

2009-05-10 Thread Fabrice B

Ok here is my code, if that can help you (dirty version, i merged
everything together):

set_time_limit(1800);
$this->setLayout(false);
$response = $this->getResponse();
$response->clearHttpHeaders();
// version 2007
$response->setHttpHeader('Content-Type', 'application/
vnd.openxmlformats-officedocument.spreadsheetml.sheet');
$response->setHttpHeader('Content-Disposition', 'attachment;
filename="'.$filename.'.xlsx"');
$response->setHttpHeader('Cache-Control', 'must-revalidate, post-
check=0, pre-check=0');

$objPHPExcel = $this->getPHPExcelObject();
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel,
'Excel2007');
$pFilename = @tempnam('./', 'phpxl');
$objWriter->save($pFilename);
$excel_2007_string = file_get_contents($pFilename);
$excel_2007_size = filesize($pFilename);
unlink($pFilename);

$response->setHttpHeader('Content-Length', $excel_2007_size);
return $this->renderText($excel_2007_string);


So first of all I am not sur the php://output is compatible with the
rendertext method which uses a string. I do not remember what
motivated me to use a temporary file but it might be because I had the
exact same problem you have.

Second of all it is very important to set a high time limit since
PHPExcel is very slow. Ok 1800 seconds is maybe too much :-)

Regards,

Fabrice Bernhard
CTO Theodo
http://www.theodo.fr/blog
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: sfEasyGMapPlugin v1.0 out

2009-03-13 Thread Fabrice B

For the official page I meant of course: 
http://www.symfony-project.org/plugins/sfEasyGMapPlugin

Fabrice Bernhard
--http://www.theodo.fr
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] sfEasyGMapPlugin v1.0 out

2009-03-13 Thread Fabrice B

sfEasyGmapPlugin is a very easy to use Google Maps API plugin for
symfony, inspired by the Phoogle class... but better :-)

A very simple version has been available for a few months but I have
now finally released the 1.0 version,  with the following new
features :

- it is now sf1.2 compatible straight out of the box
- it has some unit tests
- the GMap constructor now takes an array of parameters, which is much
more flexible and also more in the symfony coding spirit (Warning :
the modification of the GMap constructor should break your application
if you used the prior version of sfEasyGMapPlugin)
- there are interesting functions concerning Bounds :
  - smallest enclosing bound
  - propel criteria "in bounds"
  - homothety transformation
  - zoomOut transformation
- there are interesting functions concerning conversion from/to lat/
lng to/from Google's pixel coordinates system. These can be very
useful if you want to guess the bounds knowing only the center lat/
lng, the zoom level and the map's width/height in pixels. They involve
a few mathematical formulas that were not so straightforward, (since
you need to understand how Google's projection works) so trust me,
these functions are valuable, even if they only concern power users.

I have also developed a few doctrine-specific functions which are
unfortunately not available yet because not generic enough. I will try
to release them in the next version.

The official symfony page is here : 
http://svn.symfony-project.com/plugins/sfEasyGMapPlugin

Please feel free to comment on this work in progress, here or on my
blog :
http://www.theodo.fr/blog/2009/03/symfony-google-maps-api-plugin-sfeasygmapplugin-v10-is-out/

Regards,

Fabrice Bernhard
--
http://www.theodo.fr
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: Bigger or smaller modules ?

2009-03-10 Thread Fabrice B

When trying to architecture an application, the best is to find an
objective justification to your design. The simplest I would suggest
is : one crud = one module

In your case, the question is : do you have a separate page to edit
user's preferences ? Then it's a separate crud and deserves its own
module user_preferences. Is the form of the user's preferences
included in the "edit user" page ? Then it surely deserves to stay in
the user module.

Regards,

Fabrice Bernhard
--
http://www.theodo.fr
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: Symfony Production Performance improvements

2009-03-10 Thread Fabrice B

> Naturally there is one problem with a hash; the
> possibility that two different string would create the same hash. So create
> two hashes and concatenate them, an SHA1 hash and an MD5 hash.

By definition a hash is supposed to statistically avoid this problem.
But well, it doesn't cost you much time to concatenate your two hashes
if you don't trust md5 enough :-)

>As a brief example for what I mean by overriding the doSelect method for a
> model class

Your idea is quite simple and should work but be aware that it could
also actually make the application slower ! Cache is interesting only
if you will use (statistically) the same query more than twice in the
caching interval. So you must evaluate the number of different queries
you have, and the number of times they are used in an hour.

If you are sure you only have 100 different queries in your whole site
and your pages are hit 10.000 times per hour, then it's worth it. If
you have 10.000 different queries (because the cirteria contains a time
() variable for example) and your pages are hit 1000 times per hour,
then you are actually slowing down the whole site by caching unique
queries.

I would recommend to do a very quick study to identifiy the cacheable
bottlenecks. Before caching your doSelect for example, simply add a
small logging feature that you enable for a day and then count how
many different queries you had and how many times each came up. Maybe
one query represents half of your db requests and you don't even need
to cache the others :-)

Good luck !

Fabrice Bernhard
--
http://www.theodo.fr
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: Overriding javascript_include_tag

2009-03-04 Thread Fabrice B

Sumedh,

it should work, you just need to be sure you put the file in your lib/
helper directory. Here is the code loading the helpers, you can see
that the sfConfig::get('sf_lib_dir').'/helper' directory comes before
the sfConfig::get('sf_symfony_lib_dir').'/helper' directory

  /**
   * Gets the helper directories for a given module name.
   *
   * @param string The module name
   *
   * @return array An array of directories
   */
  static public function getHelperDirs($moduleName = '')
  {
$dirs = array();

if ($moduleName)
{
  $dirs[] = sfConfig::get('sf_app_module_dir').'/'.
$moduleName.'/'.sfConfig::get('sf_app_module_lib_dir_name').'/
helper'; // module

  if ($pluginDirs = glob(sfConfig::get('sf_plugins_dir').'/*/
modules/'.$moduleName.'/lib/helper'))
  {
$dirs = array_merge($dirs,
$pluginDirs);   
   //
module plugins
  }
}

$dirs[] = sfConfig::get('sf_app_lib_dir').'/
helper';  //
application

$dirs[] = sfConfig::get('sf_lib_dir').'/
helper';
  //
project

if ($pluginDirs = glob(sfConfig::get('sf_plugins_dir').'/*/lib/
helper'))
{
  $dirs = array_merge($dirs,
$pluginDirs);   
 //
plugins
}

$dirs[] = sfConfig::get('sf_symfony_lib_dir').'/
helper';  //
global

return $dirs;
  }

Cheers,

Regards,

Fabrice Bernhard
+33 6 23 52 11 95
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: [ Export data To excel ]

2009-02-20 Thread Fabrice B

I know three solutions to do Excel exports.

 - Csv

It is in my opinion not an interesting one, unless your rows are
already formatted into arrays. In that case implode(';',$row) might be
interesting


 - HTML table formatted as Excel

This is a nice trick I once discovered. You can do a simple HTML table
in your template, and just add the following lines to your action
$this->setLayout(false);
$response = $this->getContext()->getResponse();
$response->clearHttpHeaders();
$response->setHttpHeader('Content-Type', 'application/vnd.ms-
excel;charset=utf-8');
$response->setHttpHeader('Content-Disposition:', 'attachment;
filename=export.xls');

Excel will open your html table as if it were an excel file and you
will not see the difference


 - PHPEscel

If you want better formatting, include pictures, etc. then use the
following very good class : http://www.codeplex.com/PHPExcel


As for using the filters in your export, you will need to look in your
cache folder at the auto-generated action of your admin generator and
find the functions which create the criteria from the filters and call
them from your own export action. This should work :

public function executeExportExcel()
{
$this->processSort();
$this->processFilters();
$this->filters = $this->getUser()->getAttributeHolder()->getAll
('sf_admin/bar/filters');
$c = new Criteria();
$this->addSortCriteria($c);
$this->addFiltersCriteria($c);

$this->objects_to_export = ObjectPeer::doSelect$c);

// if you use solution 2 :
$this->setLayout(false);
$response = $this->getContext()->getResponse();
$response->clearHttpHeaders();
$response->setHttpHeader('Content-Type', 'application/vnd.ms-
excel;charset=utf-8');
$response->setHttpHeader('Content-Disposition:', 'attachment;
filename=export.xls');
}

Fabrice
--
http://www.allomatch.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: URL's with dots ('.')

2008-12-04 Thread Fabrice B

This is a recurrent problem with the default .htaccess or the lighttpd
configuration for symfony

For example, if you want to pass float values as parameters.

The solution lies in customising your rewrite rules in you .htaccess
or lighttpd.conf to better reflect your own configuration. You may
need to plunge a little into regular expressions for that.

Fabrice



On Dec 4, 10:31 am, "Sid Bachtiar" <[EMAIL PROTECTED]> wrote:
> > What's the problem if the request is handed over to
> > controller in all cases? May be this is a foolish question...but
> > honestly, it's not very clear to me...
>
> Well, some URL are not for the controller. for example:
> images/something.gif or css/style.css or js/script.js
>
> I think it is better to add a rule that suits your situation than to
> try to handle all cases.
>
> Identify a pattern in your URL and add a rule to detect it.
>
>
>
> On Thu, Dec 4, 2008 at 10:23 PM, Sumedh <[EMAIL PROTECTED]> wrote:
>
> > Thanks Sid...
>
> > Now...I have a URL that is something like 
> > -http://www.example.com/string.with.dots/file.html
>
> > So, it doesn't contain something like '@' by which I can identify a
> > URL that is NOT to be skipped...
>
> > How do I handle this case? Ideally,
>
> > I would want the dots to be handled just like normal characters...what
> > if just remove the section from Symfony .htaccess that skips URL's
> > with dots, with exception to .HTML? Will it create a problem for other
> > kinda files? What's the problem if the request is handed over to
> > controller in all cases? May be this is a foolish question...but
> > honestly, it's not very clear to me...
>
> > On Dec 4, 11:16 am, "Sid Bachtiar" <[EMAIL PROTECTED]> wrote:
> >> The problem is with Symfony's .htaccess. Not in Symfony's controller
> >> nor in Symfony routing. Just in .htaccess.
>
> >> In a way this is a Symfony 'shortcoming'
>
> >> > If this problem can get solved by the apache rule, as you have said, I
> >> > won't need to do any special handling or encoding of the dots... :)
>
> >> You can't really encode the dots (I think), otherwise we won't have
> >> this problem.
>
> >> On Thu, Dec 4, 2008 at 6:56 PM, Sumedh <[EMAIL PROTECTED]> wrote:
>
> >> > Thanks guys
>
> >> > So Sid, I was thinking this is a problem with symfony routing that it
> >> > doesn't handle dots...but the problem actually lies at Apache layer
> >> > where it doesn't pass along the parameters correctly to the routing
> >> > layer of symfony...right?
>
> >> > If I write rule for
> >> > URL -http://www.example.com/string.with.dots/file.html
> >> > Rule -
> >> > dotted_rule:
> >> >  url: /:param1/:fileName
>
> >> > Then value of param1 is not received correctly as "string.with.dots"
>
> >> > If this problem can get solved by the apache rule, as you have said, I
> >> > won't need to do any special handling or encoding of the dots... :)
>
> >> > Lee, the URL encoding functions don't handle the dot...I believe it's
> >> > primarily because the dot has an important place in URL...just that
> >> > it's not taken kindly if it's in between the URL instead of at the
> >> > end, (for defining a file extension)...
>
> >> > Gunnar, yeah, as you've said, changing routing structure is a costly
> >> > affair, especially when Google (and others) have indexed and
> >> > bookmarked your URL's...
>
> >> > On Dec 4, 2:06 am, "Gunnar Lium" <[EMAIL PROTECTED]> wrote:
> >> >> Although not always possible or desirable, you can also get around this
> >> >> problem by creating urls with ?. For example
> >> >> somedomain.com/profiles/[EMAIL PROTECTED]
> >> >> 2008/12/3 Sid Bachtiar <[EMAIL PROTECTED]>
>
> >> >> > Hi,
>
> >> >> > I've had problem with this too. I don't know any general solution to
> >> >> > this problem.
>
> >> >> > For my case, I needed the dot because I was passing email address in
> >> >> > the URL. So I solved it by adding one line (the line with @) in the
> >> >> > web/,htaccess
>
> >> >> >  # we skip all files with .something
> >> >> >  RewriteCond %{REQUEST_URI} \..+$
> >> >> >  RewriteCond %{REQUEST_URI} [EMAIL PROTECTED]
> >> >> >  RewriteCond %{REQUEST_URI} !\.html$
> >> >> >  RewriteRule .* - [L]
>
> >> >> > The one added line in the htaccess basically detect if the URL
> >> >> > contains @ character, if so it will be passed to the controller
> >> >> > instead of handled as a file like images, css, js, etc.
>
> >> >> > On Thu, Dec 4, 2008 at 12:25 AM, Sumedh <[EMAIL PROTECTED]> wrote:
>
> >> >> > > Hi Friends,
>
> >> >> > > How is one supposed to handle a URL having a dot ('.')?
>
> >> >> > > For example,http://www.example.com/string.with.dots/file.html
>
> >> >> > > The urlencode() function from PHP doesn't handle dots...and the
> >> >> > > routing rules break for these kind of URL's...
>
> >> >> > > So, how should they be taken care of? Is there some standardized way
> >> >> > > that everyone uses?
>
> >> >> > > - Thanks in advance,
> >> >> > > Sumedh
>
> >> >> > --
> >> >> > Visit my website:http://onlinesid.com
>
> >

[symfony-users] Re: Changed images/CSS/JS after a new build...

2008-12-02 Thread Fabrice B

I myself used something very similar to what you see here

> http://particletree.com/notebook/automatically-version-your-css-and-j...

but overriding javascript_include_tag from the AssetHelper file,
inspired by François Baligant (synalabs.com)

function javascript_include_tag()
{
  // MODIF FABRICE
  $version = (sfConfig::get('app_asset_version_js') ?
'.v'.sfConfig::get('app_asset_version_js') : '');
  $html = '';
  foreach (func_get_args() as $source)
  {
$source = javascript_path($source);
if (substr($source,-3,3)=='.js' && substr($source,0,3)=='/js')
{
  $source  .= $version;
}
$html .= content_tag('script', '', array('type' => 'text/
javascript', 'src' => $source))."\n";
  }

  return $html;
}

And the same for stylesheets_include_tag. To override the AssetHelper
file, it is very easy, thanks to symfony :-) Just copy the AssetHelper
file from the symfony/lib folder to your own lib folder. And change
the new file. symfony cc will automatically make this second file
priority and therefore you will have "overridden" the former
functions.

You still need
1. to configure the version of your files in the app.yml
2. configure your .htaccess or your lighttpd configuration to rewrite
\.js(\.v.+) files into .js and the same for \.css(\.v.+)

Fabrice
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: sfModerationPlugin - critical bug in last commit !

2008-10-08 Thread Fabrice B

Hi Thomas,

Thanks for this suggestion. However it seems
http://trac.symfony-project.org/timeline?changeset=on&max=50&daysback=90&format=rss
has too many commits a day to be a security-only solution

As for the svn status -u, it just gives you the status of local files
compared to the repository, and does not include future revisions of
this repository...

Is the plugins repository open source ?

Fabrice Bernhard
--
http://www.allomatch.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: sfModerationPlugin - critical bug in last commit !

2008-10-07 Thread Fabrice B

I am really impressed by the reactivity ! Thank you very much Gabriele
for that.

As for your idea François, which is to use externals with a release
number, I think it is the best idea I have for the moment. However I
am still looking for an easy solution next to this to be informed
about security updates... are there any example of repositories where
you can subscribe to an "update newsletter" for each project for
example ? Or a RSS Feed ? Or does svn status -u tell you what is the
latest revision even if you use a fixed revision ? I will look into
that...

Cheers,

Fabrice

On Oct 6, 5:34 pm, blacksun <[EMAIL PROTECTED]> wrote:
> Hi Fabrice,
> I'm unconfortable with myself too.
> I apologize for the inconvenience.
>
> The bug should be fixed now.
>
> Gabriele Santini
>
> On Oct 6, 4:09 pm, Fabrice B <[EMAIL PROTECTED]> wrote:
>
> > If you are using sfModerationPlugin as an external, you may have
> > noticed a critical bug since the last commit by blacksun on Thursday.
>
> > The introduction of the following new function produces a completely
> > silent error :
> > public static function getWatchedColumns(string $class)
>
> > It uses type hinting with the string type, which is not supported by
> > PHP
> > "Traditional type hinting with int and string isn't supported. "
> > source:http://fr2.php.net/manual/en/language.oop5.typehinting.php
>
> > I encourage you not to update to the last version or change the guilty
> > line in file lib/sfPropelModerationBehavior.class.php, line 438 to :
> > public static function getWatchedColumns($class)
> > which seemed to solve our problem for the moment. However I am not
> > comfortable with the fact that blacksun's new commit uses unsupported
> > features.
>
> > This brings me to a new topic : how do you handle external plugins on
> > your projects ? Clearly, this experience proves me that externals are
> > too dangerous. But how do you keep track of security updates if you
> > don't use externals ?
>
> > Fabrice Bernhard
> > --http://www.allomatch.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] sfModerationPlugin - critical bug in last commit !

2008-10-06 Thread Fabrice B

If you are using sfModerationPlugin as an external, you may have
noticed a critical bug since the last commit by blacksun on Thursday.

The introduction of the following new function produces a completely
silent error :
public static function getWatchedColumns(string $class)

It uses type hinting with the string type, which is not supported by
PHP
"Traditional type hinting with int and string isn't supported. "
source: http://fr2.php.net/manual/en/language.oop5.typehinting.php

I encourage you not to update to the last version or change the guilty
line in file lib/sfPropelModerationBehavior.class.php, line 438 to :
public static function getWatchedColumns($class)
which seemed to solve our problem for the moment. However I am not
comfortable with the fact that blacksun's new commit uses unsupported
features.

This brings me to a new topic : how do you handle external plugins on
your projects ? Clearly, this experience proves me that externals are
too dangerous. But how do you keep track of security updates if you
don't use externals ?

Fabrice Bernhard
--
http://www.allomatch.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: Symfony + smarty

2008-10-05 Thread Fabrice B

I used Smarty for a long time because I found the templates much more
redable. But from my experience the PHP code generated by Smarty from
the templates is quite ugly. And since I discovered the PHP "script
version" ie "if(): endif;" I find PHP code in the template quite
readable.

You can go even further, depending on your PHP settings, by using
"short tags".  instead of . I personally don't because I
don't want to depend on the PHP settings of the server, but if you
really want smarty-like readability without adding another useless
layer, it is surely the best option. I would not recommend Smarty
anymore.

Cheers,

Fabrice




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: sfEasyGMapPlugin: a new plugin to quickly add a Google Map to a symfony project

2008-09-22 Thread Fabrice B

I have not fully understood how to configure pear install for both
symfony 1.0 and 1.1 at the same time.

So in the meantime, just use the "easy way", the svn checkout

svn co http://svn.symfony-project.com/plugins/sfEasyGMapPlugin/trunk/
plugins/sfEasyGMapPlugin
ln -s ../plugins/sfEasyGMapPlugin/web web/sfEasyGMapPlugin
php symfony cc

This should work under 1.0 !

Fabrice

On Sep 22, 9:49 pm, James <[EMAIL PROTECTED]> wrote:
> How hard would this be to make compatible with Symfony 1.0?  Looking  
> at the instructions for installation I don't see anything specific to  
> 1.1.  Is it using anything that is specific to the 1.1 APIs?
>
> Thanks
> James
>
> Who for the time being is stuck in Symfony 1.0 land.
>
> On Sep 22, 2008, at 3:14 PM, Fabrice B wrote:
>
>
>
> > Hello,
>
> > following a conversation on the French symfony group, I worked to
> > release my pernosal Google Maps plugin. I tried to make it as simple
> > as possible while leaving most of the functionalities I have developed
> > for my personal needs.
>
> > Here is the link:
> >http://www.symfony-project.org/plugins/sfEasyGMapPlugin
>
> > And here is a very quick implementation of it:
> >http://apps.facebook.com/my-friends-map/
>
> > A basic sample looks like this:
>
> > In the action:
> >    $this->gMap = new GMap();
> >    $this->gMap->addMarker(new GMapMarker(51.245475,6.821373));
> >    $this->gMap->addMarker(new GMapMarker(48.718952,2.219180));
>
> > In the template:
> >    
> >     > include_map($gMap,array('width'=>'512px','height'=>'400px')); ?>
> >    
>
> > Other available functionalities:
> >  - geocoding
> >  - customising marker's icons
> >  - a helper for a "search for a location" form
> >  - an easy function for the famous Google Info bubble
> >  - ability to add listeners on markers for google and dom
> > events"Google" et dom sur les markers
> >  - hidden functionality: the static map, which means without
> > javascript, intended for mobile apps for example. But this last
> > functionality is not tested and documented.
>
> > More infos available in the readme, where I wrote three samples. I
> > hope this helps anybody interested get started.
>
> > There is already a sfGMapsPlugin, but it was not very practical since
> > its first purpose was to geocode addresses and save them in a table
> > using Doctrine, and it has not been updated since June 2007. Globally,
> > I think it did not satisfy the need for a quick and easy integration
> > of a Google Maps in a symfony project, that is why I released this
> > plugin.
>
> > The first feedback I got was positive but I am looking forward to all
> > criticisms ! :-)
>
> > Cheers,
>
> > Fabrice Bernhard
> > fabriceb <> allomatch.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] sfEasyGMapPlugin: a new plugin to quickly add a Google Map to a symfony project

2008-09-22 Thread Fabrice B

Hello,

following a conversation on the French symfony group, I worked to
release my pernosal Google Maps plugin. I tried to make it as simple
as possible while leaving most of the functionalities I have developed
for my personal needs.

Here is the link:
http://www.symfony-project.org/plugins/sfEasyGMapPlugin

And here is a very quick implementation of it:
http://apps.facebook.com/my-friends-map/


A basic sample looks like this:

In the action:
$this->gMap = new GMap();
$this->gMap->addMarker(new GMapMarker(51.245475,6.821373));
$this->gMap->addMarker(new GMapMarker(48.718952,2.219180));

In the template:

'512px','height'=>'400px')); ?>



Other available functionalities:
  - geocoding
  - customising marker's icons
  - a helper for a "search for a location" form
  - an easy function for the famous Google Info bubble
  - ability to add listeners on markers for google and dom
events"Google" et dom sur les markers
  - hidden functionality: the static map, which means without
javascript, intended for mobile apps for example. But this last
functionality is not tested and documented.

More infos available in the readme, where I wrote three samples. I
hope this helps anybody interested get started.

There is already a sfGMapsPlugin, but it was not very practical since
its first purpose was to geocode addresses and save them in a table
using Doctrine, and it has not been updated since June 2007. Globally,
I think it did not satisfy the need for a quick and easy integration
of a Google Maps in a symfony project, that is why I released this
plugin.

The first feedback I got was positive but I am looking forward to all
criticisms ! :-)

Cheers,


Fabrice Bernhard
fabriceb <> allomatch.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: rendering partial in a task ?

2008-08-19 Thread Fabrice B

> Does anyone have a solution to this???

symfony guesses the root url using the $_SERVER variable, which you
can set manually beforehand

$_SERVER['HTTP_X_FORWARDED_HOST'] = 'myhost';
sfConfig::set('sf_no_script_name',true);
sfConfig::set('sf_relative_url_root','');
echo sfContext::getInstance()->getController()->genUrl('module/
action',true);

However I had the impression this worked very well too :

echo 'http://myhost'.sfContext::getInstance()->getController()-
>genUrl('module/action',false);

Did you try that ?

Fabrice Bernhard
--
http://www.allomatch.com
http://mobile.allomatch.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: How can I see the raw SQL that a Criteria() object is going to execute?

2008-07-14 Thread Fabrice B

> > $c = new Criteria();
> > $c->addAscendingOrderByColumn(VideoPeer::ID);
> > $c->add(VideoPeer::ID, $start_id, Criteria::GREATER_EQUAL);
> > $c->add(VideoPeer::ID, $end_id, Criteria::LESS_EQUAL);

That's a classical limitaion of Propel. Either do :

$c = new Criteria();
$c->addAscendingOrderByColumn(VideoPeer::ID);
$c->add(VideoPeer::ID, VideoPeer::ID.' BETWEEN '.$start_id.' AND '.
$end_id, Criteria::CUSTOM);

which I used at first but opens a door to sql injection, since we're
not used to escaping anymore and CRITERIA::CUSTOM does not escape for
you !

Or do this :
$c = new Criteria();
$c->addAscendingOrderByColumn(VideoPeer::ID);
$c1 = $c->getNewCriterion(VideoPeer::ID, $start_id,
Criteria::GREATER_EQUAL);
$c2 = $c->getNewCriterion(VideoPeer::ID, $end_id,
Criteria::LESS_EQUAL);
$c1->addAnd($c2);
$c->add($c1);
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: order by clause in symfony

2008-07-10 Thread Fabrice B

$c->addAscendingOrderByColumn('RAND()');

without the quotes, rand() was executed in PHP. Your goal is to
include it as a string in the SQL clause, so just put quotes aound it.

Fabrice


On Jul 10, 7:28 am, kusum <[EMAIL PROTECTED]> wrote:
> hi,
>      i have already used this
> addAscendingOrderByColumn(rand()).
> but rand() is not a defined column in any table ,so it is giving
> error.
>
> On Jul 9, 5:50 pm, Tom Haskins-Vaughan <[EMAIL PROTECTED]>
> wrote:
>
> > addAscendingOrderByColumn
> >                     ^^
>
> > kusum wrote:
> > > hi all
> > >          i want to select random records from listing table using this
> > > format,becoz i want to use
> > > some method of listing class.
>
> > >           $c=new Criteria();
> > >            $c->addJoin(BuilderProjectPeer::OWNER_ID, OwnerPeer::ID);
> > >            $c->addJoin(ListingPeer::OWNER_ID,
> > > BuilderProjectPeer::OWNER_ID);
> > >            $c->setLimit(5);
> > >            $c->addAscendingOrderBy(rand());//line 47
> > >            $checkrecord = ListingPeer::doSelectJoinOwner($c);
>
> > > It is giving error
>
> > > Fatal error: Call to undefined method Criteria::addAscendingOrderBy()
> > > in /home/kusum/workspace/zam_fe/apps/frontend/modules/home/actions/
> > > actions.class.php on line 47
>
> > > how i can set rand() in order by.
>
> > > Using this query it is working properly.
>
> > > $query2 = "SELECT listing.ID as listingid,listing.covered_area as
> > > covered_area ,listing.BEDS as listingbed,listing.PRICE as
> > > listingprice,listing.CITY as listing_city,listing.AREA as
> > > listing_area,listing.PROPERTY_TYPE as listing_property_type ,
> > > builder_property.name as propertyname,owner.logo_url as
> > > logo,listing.photo_url as photo FROM
> > > listing,builder_property,builder_project,owner WHERE
> > > listing.OWNER_ID=owner.ID AND
> > > builder_project.OWNER_ID=listing.OWNER_ID  AND
> > > builder_project.OWNER_ID=listing.OWNER_ID ORDER BY rand() LIMIT 4";
> > >        $conn = Propel::getConnection();
> > >       $stmt = $conn->prepareStatement($query2);
> > >      $this->listingbuilder =$stmt->executeQuery();
>
> > --
> > Tom Haskins-Vaughan
> > Temple Street Media: Design and Development for the Web
> > [EMAIL PROTECTED] |www.templestreetmedia.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: Table joins with Propel

2008-04-17 Thread Fabrice B

> Thanx for the response. This one is surely a better looking option but
> again the case I wanted to solve remains unsolved, decrease the number
> of queries to generate this page. Say I want to generate a page with
> 10 blog posts, now this approach will require at least 11 database
> queries, 1 to get the list of blogs and the other to get the interest
> of each 10 blogs.

No, I do two queries:
1 to get the blog psots
1 to get the interests of the user for all these posts
Then I loop to hydrate everybody.

> You are correct that unless the retrieved data is hydrated, the
> retrieved column is useless. For that I had to do one more hack in the
> Blog class. I override the hydrate function of the base class. I call
> the parent::hydrate() function in it. And inside the try {} block, I
> try to get the extra column value and populate it in the new variable
> defined in the Blog class. In this case the catch block is
> catch(exception e){}, an empty block because in some cases its
> possible that this column is not retrived.

This is the other solution, which I actually prefer, but needs you to
go in the Propel code: create a new function where you hydrate
yourself.
However your approach is not the perfect one yet. You should not
override the hydrate function, but create your own function
doSelectWithInterest() which would be very similar to the
Base::doSelect only after the hydrate you would also hydrate the
"Interest"

> Since the propel uses the column number to hydrate the data, I used
> BlogPeer::NUM_COLUMNS + USERPEER::NUM_COLUMNS + 1 to find the column
> number of the user_interest column.

Exactly, but this should not be done in an override of hydrate

Fabrice
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: Table joins with Propel

2008-04-16 Thread Fabrice B

If with your query you only hydrate your "blog posts" then that
additional information "get the interest of the user or nothing if no
interest" will just disappear, therefore making your approach
useless...

This is actually a common problem because a common one. My approach
would be the following :

$blog_posts = BlogPostPeer::doSelect();
BlogPostPeer::preloadInterestForUserId($blog_posts, 27);

in BlogPost.php I would create a private array
private $aInterestForUserId = array();

and in BlogPostPeer the following preloading function

public static function preloadInterestForUserId(&$blog_posts,
$user_id)
{
  $blog_post_ids = array();
  foreach ($blog_posts as $key => $blog_post)
  {
$blog_post_ids[$blog_post->getId()] = $key;
  }
  $criteria = new Criteria();
  $criteria->add(InterestPeer::BlogPostId, array_keys($blog_post_ids),
CRITERIA::IN);
  $criteria->add(InterestPeer::UserId, $user_id);
  $interests = InterestPeer::doSelect($criteria);
  foreach($interests as $interest)
  {
$blog_posts[$blog_post_ids[$interest->getBlogPostId()]]-
>setInterestForUserId($interest,$user_id);
  }
}

Finally create the setInterestForUserId and getInterestForUserId
functions

Another approach is to do the query and hydrate yourself.

Hope this helps

Fabrice


On Apr 16, 6:47 am, Manoj Ghimire <[EMAIL PROTECTED]> wrote:
> There was some confusion. First let me tell, the suggestion that I got
> above really worked, Thakn you all.
>
> Now to the point, the SQL query I wanted was
>
> SELECT table1.*
> FROM table1
> LEFT JOIN table2 ON (table1.id = table2..table1_id AND table2.user_id=
> '27')
>
> I think I wrote it wrong in the first post table1.user_id = '27', it
> must have been table2.user_id = '27'.
>
> Use:
> I use table1 to list things (say a blog post). Any user can show that
> they liked the post and show interest in it. To store this data I use
> Table2 which has table1_id as foreign key and user_id, the ID of the
> user showing interest. A user can only show his/her interest once, so
> in case of logged in user i want to find if the user has shown
> interest in the post or not. Left JOIN is required because I also want
> the blog posts to be listed on which user has not shown the interest.
>
> Initially I used a component for it, which for every table1 post
> queried the database for the given user_id to the table2. This
> increased the database queries used to build that page very much, so
> had to find this Hack out.
>
> Do I make some sense ?? Did I do it correct ?? Comments ??
>
> Manoj Ghimire
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: Batch and Emails, how to pass parameters to the action ?

2008-04-15 Thread Fabrice B

> The send mail method return the RAW mail, 
> seehttp://www.symfony-project.org/cookbook/1_0/email

Since it is complicated to parse the raw email, I prefer the variant
you suggest later on :

$this->getRequest()->setAttribute('last_mail', $this->mail); in the
action

> You cannot sent variables directly to the action. However an action
> can access to the parameter holder of the current request. So you can
> "place" variables in the parameter holder.
>
> The sfRequest objet hold an attributesHolder and an parameterHolder
> object. Maybe it will be more suitable to use the attribute holder, as
> values from the parameterHolder can be badly interpreted by actions.

Thanks for the clean answer :-)

Fabrice
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: Table joins with Propel

2008-04-15 Thread Fabrice B

> By the way, i'm not sure to understand the interest of doing a LEFT
> JOIN in this case, as the related objects won't be hydrated (you have
> to call doSelectJoinXXX to retrieve hydrated related objects) so you
> don't save queries, and a LEFT JOIN doesn't filter (like a INNER JOIN
> would).
> So you will have just the same amount of queries, and the same amount
> of results if you would have used an implicit join, very easier to set
> (just two calls to add()).
>
> Am I missing something about addJoin() and hydrating related objects ?

Well, after some thought, there might be a use case for it : if you
want to have as many identical Table1 object as you have coresponding
Table2.table1_id rows.

However that is a strange case. If, as might be expected from such a
query, you wanted to filter some lines OUT of Table1 using information
from table2, since all your conditions are on the first table in your
example :
SELECT table1.*
FROM table1
LEFT JOIN table2 ON (table1.id = table2..table1_id AND table1.user_id=
'27')
and you are using a left join, it wont work.

Fabrice
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: Table joins with Propel

2008-04-14 Thread Fabrice B

Hi Manoj,

Here is your answer, two different solutions :

The very clean one (but it needs a hack) :
http://www.rabaix.net/articles/2006/9/16/propel-complex-on-clause

The quick and dirty one:

$c = new Criteria();
$c->addJoin(Table1Peer::ID,Table2Peer::TABLE1_ID.' AND
'.Table1Peer::USER_ID.' = 27',Criteria::LEFT_JOIN);

Just put the condition concatenated after the second column ! I have
not tested it but I was told (by Thomas Rabaix) that it works fine.
And considering my experience on Propel, direct hacks like this one
usually work :-)

Fabrice
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Batch and Emails, how to pass parameters to the action ?

2008-04-13 Thread Fabrice B

Hi,

I want to send many emails from a batch. For that I use the following
function which works fine :

sfContext::getInstance()->getController()->sendEmail('module',
'sendEmailAction');

(Don't forget to create the $mail = new sfMail() object in the action)

First question :
I wanted to get the result of the email to save it in a sent_mail
table. I tried:

$mail = sfContext::getInstance()->getActionStack()->getLastEntry()-
>getActionInstance()->getVarHolder()->get('mail');

to get the $this->mail object of the last executed action, but it did
not work... How can I get infos about the last mail sent (Sender,
Recipient, etc. ?) using the sendEmail method ?

Second question :

My action is quite propel-heavy so I end up with a out of memory error
(thank you propel) after a few dozen mails sent. An easy solution
would be to do the actual database stuff outside of the action, in the
batch, since it's the same for EVERY email, and then pass it to the
sendEmailAction.

$complicated_data = ComplicatedData::getComplicatedThings();
sfContext::getInstance()->getController()->sendEmail('crm',
'managerActivityReportByDay');

How can I pass $complicated_data to the $this->complicated_data of the
action ?

Thank you !

Fabrice
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: Symfony + Propel + Multiple Schemas

2008-04-13 Thread Fabrice B

How many different users/databases do you have ?

If you don't have too many, you could create one database connection
in the databases.yml per different "connection" (different database or
user)

all:
  connection1:
class:  sfPropelDatabase
param:
  dsn:  mysql://user1:[EMAIL PROTECTED]/database
  encoding: utf8  # Default charset for table creation
  connection2:
class:  sfPropelDatabase
param:
  dsn:  mysql://user2:[EMAIL PROTECTED]/database
  encoding: utf8  # Default charset for table creation

Then you can create one schema per connection
---
connection1:
  _attributes:  { package: lib.connection1.model }
  table1:
...
connection2:
  _attributes:  { package: lib.connection2.model }
  table1:
...

And propel will handle everything without problem.

Now if you want to use joins I am less sure that will be enough. I
needed to join two different databses, and to answer Luciano, I also
tried to change the TABLE_NAME constant, but it didn't work because
the Propel addJoin method expects only ONE dot in the column name (ie
table.column and not schema.table.column)

The solution however to this was to give an alias to the table
$criteria->addAlias('t2','other_db.table');
and then do all the queries using the alias.
However I don't know if that solves your "multiple user" problem.

Cheers,

Fabrice
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---