[symfony-users] Re: Strange problem with multiple db connections

2010-08-14 Thread ming
Maybe your problem is due to this bug:
http://trac.symfony-project.org/ticket/7689

Set right connection before call and reset after
:(

On 12 Ago, 17:59, Zuchuat Bertrand bertrand.zuch...@rero.ch wrote:
 Hi Jon,

 I have a strange problem with multiple db connections.

 My databases.yml (definition):

 all:
   common:
     class:        sfDoctrineDatabase
     param:
       dsn:        'oracle:dbname=//server:1521/sid'
       username:   x
       password:   x
   web:
     class:        sfDoctrineDatabase
     param:
       dsn:        'oracle:dbname=//server:1521/sid'
       username:   x
       password:   x
   virtua:
     class:        sfDoctrineDatabase
     param:
       dsn:        'oracle:dbname=//server:1521/sid2'
       username:   x
       password:   x

 My model AffiliationGroup connected on common connection name. I show this 
 on BaseClass:
 Doctrine_Manager::getInstance()-bindComponent('AffiliationGroup', 'common');

 I use this code to get records on my table:
 $this-agroups = 
 Doctrine_Core::getTable('AffiliationGroup')-retrieveActive();

 With that, i have this error:
 500 | Internal Server Error | Doctrine_Connection_Oracle_Exception

 If i check the query on debug bar, i show this:
 SELECT c.id AS c__id, c.name AS c__name, (SELECT COUNT(c2.id) AS c2__0 FROM 
 common.affiliation c2 WHERE (c2.affiliation_group_id = c.id AND c2.is_enabled 
 = 1 AND c2.is_visible = 1)) AS c__0 FROM common.affiliation_group c WHERE 
 (c.is_show_on_map = '1' AND (c.deleted_at IS NULL)) ORDER BY c.name

 0.00s, virtua connection

 virtua is strong connection. The correct name for that is common.

 I check that with mysql. I have the same problem.

 Please help me with that because i start a project with 3 connections and i 
 have a big problem with that.

 Thanks for you help.

 Bertrand Zuchuat

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.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] [DI] How can I put data into getFooService?

2010-08-14 Thread Константин
I need send data to some services on the fly. Something like

$sc-getTranslatorService('translation namespace');

How can I do that?

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.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] [DI] How to inject $sc to service?

2010-08-14 Thread Константин
Hello!

Some services should get service container, something like this:

// class mySC extends Container
public functon getBarService()
{
  $instance = new Bar_Class();
  $instance-injectSC($this);
  return $instance;
}

How to do that?

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.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


Re: [symfony-users] [DI] How to inject $sc to service?

2010-08-14 Thread Fabien Potencier

On 8/14/10 1:00 PM, Константин wrote:

Hello!

Some services should get service container, something like this:

// class mySC extends Container
public functon getBarService()
{
   $instance = new Bar_Class();
   $instance-injectSC($this);
   return $instance;
}

How to do that?


The container is always available as the 'service_container' service.

Fabien

--
Fabien Potencier
Sensio CEO - symfony lead developer
sensiolabs.com | symfony-project.org | fabien.potencier.org
Tél: +33 1 40 99 80 80

--
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.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: [DI] How to inject $sc to service?

2010-08-14 Thread Константин
Thank you.
Can you give me other advice 
http://groups.google.com/group/symfony-users/browse_thread/thread/9892bb9729d0702e
?

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.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


Re: [symfony-users] [DI] How can I put data into getFooService?

2010-08-14 Thread Fabien Potencier


On 8/14/10 9:39 AM, Константин wrote:

I need send data to some services on the fly. Something like

$sc-getTranslatorService('translation namespace');

How can I do that?


I'm not sure I understand the question here. You get the service, and 
then you can do whatever you want with it. It looks like you are looking 
to create kind of a factory here, right?


Fabien

--
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.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: [DI] How can I put data into getFooService?

2010-08-14 Thread Константин
Hm, why my messages not shows?

Yes, it similar to Factory.

Translate
__construct(Translate_DriverAbstract $driver, $namespace)

$driver inject by container
$namespace - send by hand

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.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] Symfony 1.4-compatible minifier for Symfony now included in Apostrophe, can be used in any Symfony project

2010-08-14 Thread Tom Boutell
We've committed a new CSS and JS minifier to the trunk of
apostrophePlugin. It's possible to take advantage of this even if you
don't need the rest of Apostrophe for your project.

Apostrophe now has a built-in CSS and JS minifier, similar to
sfCombinePlugin but up to date and easier to work with. All you have
to do is call a_include_javascripts and a_include_stylesheets in your
layout.php rather than the usual include_javascripts and
include_stylesheets.

Although we didn't start from sfCombinePlugin, which has not been
updated for about a year, we are not reinventing the wheel here.
Apostrophe now bundles the latest stable release of the excellent
Minify package by Ryan Grove and Steve Clay.

We're not using Minify's built-in server. Instead we are using the
Minify library classes to do the actual minification and integrating
these into our helpers for a native Symfony feel. That means that:

* When minification is turned on with app_a_minify, all CSS files
needed on a page are rolled into a single file
* Ditto for JavaScript
* The cache files are automatically reused if they already exist
* The cache files are automatically erased when you 'symfony cc' on a
particular server, as you ought to do when you deploy anyway
* Files that need to be loaded separately (for instance, they have IE
conditional comments) are still loaded the traditional way
* Files that need to load together as a group because they have the
same script tag options (for instance, print stylesheets) are merged
to a separate cache file from the rest
* When app_a_minify_gzip is turned on, minimized CSS and JS files are
automatically gzip-compressed in advance when they are generated (the
necessary .htaccess directives to allow your server to support this
are in the trunk sandbox .htaccess file, take a look - all web
browsers support this so it's a big win)

Dead simple and very effective.

With app_a_minify and app_a_minify_gzip both turned on, the logged-out
view of the Apostrophe sandbox now receives a B grade from the YSlow
plugin. Those who are familiar with YSlow know that a B is extremely
hard to get. YSlow dings you for every little infraction, including
the use of images that are not CSS sprites and so on. Our former score
was an D
on an A to F scale (a C if the server is configured to gzip
everything on the fly, but that takes more CPU than app_a_minify_gzip,
which runs only at caching time).

To use this in a project in which you don't otherwise want Apostrophe
(although I obviously think you should consider using it!), you'll
want to tell Apostrophe to disable its built in routes:

app_aMedia_routes_register: false
app_a_routes_register: false

Turn it on in app.yml (for testing, do it under 'all', but later
probably just 'prod' so you can still easily debug JS and CSS):

all:
  a:
minify: true
#Optional but a huge win, requires appropriate Apache
configuration and zip support in PHP
minify_gzip: true

And just start calling a_include_javascripts and a_include_stylesheets
instead of include_javascripts and include_stylesheets in your
layout.php.

To make the gzipped CSS and JS files work, your PHP must have zlib
support (check your phpinfo), and Apache must be configured to serve
.cssgz and .jsgz files correctly (you can do this in your .htaccess
file):

AddType text/javascript .jsgz
AddType text/css .cssgz
AddEncoding x-gzip .jsgz .cssgz

If you don't want to do that, you can leave app_a_minify_gzip turned
off, but it won't be as awesome.

symfony cc and go to town.

That's it - no database tables needed, no schema changes.
Note that web/uploads/asset-cache needs to be writable by Apache
(project:permissions should take care of this).

Enjoy!

-- 
Tom Boutell
P'unk Avenue
215 755 1330
punkave.com
window.punkave.com

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.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


Re: [symfony-users] Re: [DI] How can I put data into getFooService?

2010-08-14 Thread Fabien Potencier

On 8/14/10 3:54 PM, Константин wrote:

Hm, why my messages not shows?

Yes, it similar to Factory.

Translate
__construct(Translate_DriverAbstract $driver, $namespace)

$driver inject by container
$namespace - send by hand


That's not possible. You can use a setter instead. You can also keep the 
namespace in the constrcutor but give it a default value.


Fabien

--
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.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: How i can implement this with sfGuard plugin

2010-08-14 Thread Tom Ptacnik
Maybe better would be to store the id of the user not the username.
But the principle is right.

And this code of creating the query move to the JobTable class ..
create a method with userId parametter.


On 12 srp, 21:16, RusAlex interpret...@gmail.com wrote:
 I have my own opinion:

 I need to add new field user into job table, and use edited actions
 to show:

 class jobActions extends sfActions
 {
   public function executeIndex(sfWebRequest $request)
   {
     $this-jobs = Doctrine::getTable('JobeetJob')
       -createQuery('a')
       -where('a.user = ?' , $this-getUser()-getUsername())
       -execute();
   }

 Is this a right approach for solving my task ?

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.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: symfony form not merging with existing object data (1.4.7-DEV)

2010-08-14 Thread Tom Ptacnik
This behaviour is correct. It depends on the form you are using...I
gess that this form is designed to set all attributes of the object.

If you want to change only some values of the object, then you need to
change the form. Or update just this few attributes of the object
manualy and seve it.


On 12 srp, 22:54, ashton ahonn...@gmail.com wrote:
 I have generated an action using doctrine:generate-module (I can
 reproduce this behavior in the admin module as well)

 When I post to the update page with an incomplete set of values (just
 the title for instance) so:
 /api_dev.php/event/update?id=1event[title]=nothing
 The object is updated and saves correctly, but all the other values in
 the object (except title in this instance) get nulled.

 This is easy to test by building the module and then removing one form
 element that has saved data in it from the page and then saving the
 form.  When saving that form without that form element, it gets
 nulled. I would assume that I am somehow building the form or binding
 it incorrectly, but I am using the generated code.  Is this expected
 behavior? How do I change this so that I can just update the existing
 object without having to pass all values every time?

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.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: Symfony 1.4-compatible minifier for Symfony now included in Apostrophe, can be used in any Symfony project

2010-08-14 Thread pghoratiu
Hi!

How do you solve the cache invalidation for these resources (in case
they are cached on the client side)?
Please post also a link to the sources.

Thanks,

gabriel

On Aug 14, 5:08 pm, Tom Boutell t...@punkave.com wrote:
 We've committed a new CSS and JS minifier to the trunk of
 apostrophePlugin. It's possible to take advantage of this even if you
 don't need the rest of Apostrophe for your project.

 Apostrophe now has a built-in CSS and JS minifier, similar to
 sfCombinePlugin but up to date and easier to work with. All you have
 to do is call a_include_javascripts and a_include_stylesheets in your
 layout.php rather than the usual include_javascripts and
 include_stylesheets.

 Although we didn't start from sfCombinePlugin, which has not been
 updated for about a year, we are not reinventing the wheel here.
 Apostrophe now bundles the latest stable release of the excellent
 Minify package by Ryan Grove and Steve Clay.

 We're not using Minify's built-in server. Instead we are using the
 Minify library classes to do the actual minification and integrating
 these into our helpers for a native Symfony feel. That means that:

 * When minification is turned on with app_a_minify, all CSS files
 needed on a page are rolled into a single file
 * Ditto for JavaScript
 * The cache files are automatically reused if they already exist
 * The cache files are automatically erased when you 'symfony cc' on a
 particular server, as you ought to do when you deploy anyway
 * Files that need to be loaded separately (for instance, they have IE
 conditional comments) are still loaded the traditional way
 * Files that need to load together as a group because they have the
 same script tag options (for instance, print stylesheets) are merged
 to a separate cache file from the rest
 * When app_a_minify_gzip is turned on, minimized CSS and JS files are
 automatically gzip-compressed in advance when they are generated (the
 necessary .htaccess directives to allow your server to support this
 are in the trunk sandbox .htaccess file, take a look - all web
 browsers support this so it's a big win)

 Dead simple and very effective.

 With app_a_minify and app_a_minify_gzip both turned on, the logged-out
 view of the Apostrophe sandbox now receives a B grade from the YSlow
 plugin. Those who are familiar with YSlow know that a B is extremely
 hard to get. YSlow dings you for every little infraction, including
 the use of images that are not CSS sprites and so on. Our former score
 was an D
 on an A to F scale (a C if the server is configured to gzip
 everything on the fly, but that takes more CPU than app_a_minify_gzip,
 which runs only at caching time).

 To use this in a project in which you don't otherwise want Apostrophe
 (although I obviously think you should consider using it!), you'll
 want to tell Apostrophe to disable its built in routes:

 app_aMedia_routes_register: false
 app_a_routes_register: false

 Turn it on in app.yml (for testing, do it under 'all', but later
 probably just 'prod' so you can still easily debug JS and CSS):

 all:
   a:
     minify: true
     #Optional but a huge win, requires appropriate Apache
 configuration and zip support in PHP
     minify_gzip: true

 And just start calling a_include_javascripts and a_include_stylesheets
 instead of include_javascripts and include_stylesheets in your
 layout.php.

 To make the gzipped CSS and JS files work, your PHP must have zlib
 support (check your phpinfo), and Apache must be configured to serve
 .cssgz and .jsgz files correctly (you can do this in your .htaccess
 file):

 AddType text/javascript .jsgz
 AddType text/css .cssgz
 AddEncoding x-gzip .jsgz .cssgz

 If you don't want to do that, you can leave app_a_minify_gzip turned
 off, but it won't be as awesome.

 symfony cc and go to town.

 That's it - no database tables needed, no schema changes.
 Note that web/uploads/asset-cache needs to be writable by Apache
 (project:permissions should take care of this).

 Enjoy!

 --
 Tom Boutell
 P'unk Avenue
 215 755 1330
 punkave.com
 window.punkave.com

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.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: [DI] How can I put data into getFooService?

2010-08-14 Thread Константин
Have you in plans implementing this feature? Or no sense?

Also: add support of Multiton please.

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.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] Generate Repositories

2010-08-14 Thread Michael
I'm trying to create an EntityRepository to one of my Entities:

/**
 * Product
 *
 * @Entity(repositoryClass=Bundle\HelloBundle\Entity\Repository
\ProductRepository)
 * @Table(name=product)
 */
class Product
{
}

class ProductRepository extends EntityRepository
{
public function getTopProducts($arguments)
{
...
}
}

for some reason I can't call the getTopProducts(), keep getting this
error:

Undefined method 'getTopProducts'. The method name must start with
either findBy or findOneBy!

any ideas?

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.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


Re: [symfony-users] Re: How i can implement this with sfGuard plugin

2010-08-14 Thread Alan Bem
Wouldn't it be better?

$this-getUser()-getGuardUser()-getJobs()?

You just need to add proper relation between sf_guard_user and job tables.

2010/8/14 Tom Ptacnik to...@tomor.cz

 Maybe better would be to store the id of the user not the username.
 But the principle is right.

 And this code of creating the query move to the JobTable class ..
 create a method with userId parametter.


 On 12 srp, 21:16, RusAlex interpret...@gmail.com wrote:
  I have my own opinion:
 
  I need to add new field user into job table, and use edited actions
  to show:
 
  class jobActions extends sfActions
  {
public function executeIndex(sfWebRequest $request)
{
  $this-jobs = Doctrine::getTable('JobeetJob')
-createQuery('a')
-where('a.user = ?' , $this-getUser()-getUsername())
-execute();
}
 
  Is this a right approach for solving my task ?

 --
 If you want to report a vulnerability issue on symfony, please send it to
 security at symfony-project.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.comsymfony-users%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/symfony-users?hl=en


-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.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


Re: [symfony-users] Re: [DI] How can I put data into getFooService?

2010-08-14 Thread Alan Bem
Create factory and pick it with DI

$translatorFactory = $sc-getTranslatorFactoryService();
$tranlator = $translatorFactory-create(''translation namespace');

2010/8/14 Константин molodch...@gmail.com

 Have you in plans implementing this feature? Or no sense?

 Also: add support of Multiton please.

 --
 If you want to report a vulnerability issue on symfony, please send it to
 security at symfony-project.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.comsymfony-users%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/symfony-users?hl=en


-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.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] [SYMFONY 1.4] sfDoctrineGuardPlugin: get a 401 response code on non GET unauthorized request?

2010-08-14 Thread Gustavo Adrian
Hi,

I use sfDoctrineGuardPlugin for securing my apps. In my backend I use AJAX
heavily. With a GET request, if the user session is gone, I get a 401
(unauthorized) response, so using Javascript I redirect the user to the
login page correctly. But when a POST request occurs, it gives me a 200 (OK)
response with the login page, in the same situation where, with a GET
request, I receive a 401 code.

How could I get a 401 response with every type of request?


Thanks!

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.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