Re: [symfony-users] Auto-filling caches

2011-02-11 Thread Robert Gründler

thanks for the tip. This is what i've come up with so far:

// in the template the sf_cache_key is set containing the current page

include_component('article','articles',array('page' => $page, 
'sf_cache_key' => 'articles_' . $page))



// in the task the cached version of the first 10 pages should be 
pre-filled:


$manager = sfContext::getInstance()->getViewCacheManager();
$browser = new sfBrowser();
$browser->setHttpHeader("X-Requested-With","XMLHttpRequest");

for ($page = 1; $page < 11; $page++) {
$content = 
$browser->get('/articles/page/'.$page)->getResponse()->getContent();
$manager->setPartialCache('article', '_articles', 'articles_' . 
$page, $content);

}


The task runs fine, and i'm able to get the correct page using 
sfBrowser->get(), but when i hit
one of the first 10 pages after running the task, i'm still getting an 
uncached response.


From what i understand, internally the sfPartialView does the same call 
in the render() method:


$retval = $this->viewCache->setPartialCache($this->moduleName, 
$this->actionName, $this->cacheKey, $retval);


I've also set the correct application/environment for the task, so this 
shouldn't be the problem.


Any hint what im missing here?

thanks!

-robert




On 2/10/11 11:14 PM, Benoit Montuelle wrote:

Hi,

I would make it using a task which uses sfBrowser on the ajax urls, 
eventually using DB queries to generate them. If you use html cache it 
should do the job. The only thing is to run the task with the good env 
argument so it generates cache for 'prod'.


Now if you use sfViewCacheManager, it seems you can do it more 
naturally when a new post is created, with setPageCache 
method. 




Regards
Benoit

2011/2/10 Robert Gründler >


Hi,

Imagine a blog where each BlogEntry has one Author, and can be
tagged with one ore more Tags.
The mainpage displays a paginated list of all blogentries. Every
entry displays the title, author and the tags. The pagination
is implemented using AJAX.

To display the paginated list using symfony + doctrine, 3 Database
queries are needed:

1. select count(*)  # get the total number of entries
2. select distinct ... limit ... offset # get the actual ids of
blog entries for that page
3. select ... where in (...)  # retrieve the data to display for
that page

When the number of blogs and the authors + tags is getting large,
these 3 queries can take up to 800 - 1000 ms, which is
not fast enough, if you want ajax pagination.

If a single page is cached, the ajax request takes about 200 - 300
ms, but the uncached page takes over 1 second to load.

What we're thinking about is to "pre-fill" the cache of every page
in that list, so that no user ever hits an uncached page. This
"pre-fillling"
could take place in a cronjob, which is run every 5 minutes or so
- frequent enough for this use case.

What i was thinking about is to set the cache-lifetime of the
partial for a single page to one day, and update the cached results
in the background - which actually is the part i'm not sure how to
implement.

Anyone knows if this kind of logic could be implemented using
symfony + doctrine?

thanks!

-robert

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


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


--
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] Auto-filling caches

2011-02-11 Thread Robert Gründler

should have rtfm:

factories.yml:

view_cache_manager:
  param:
cache_key_use_host_name: false


just in case if anyone runs into the same problem...






On 2/11/11 9:49 AM, Robert Gründler wrote:

thanks for the tip. This is what i've come up with so far:

// in the template the sf_cache_key is set containing the current page

include_component('article','articles',array('page' => $page, 
'sf_cache_key' => 'articles_' . $page))



// in the task the cached version of the first 10 pages should be 
pre-filled:


$manager = sfContext::getInstance()->getViewCacheManager();
$browser = new sfBrowser();
$browser->setHttpHeader("X-Requested-With","XMLHttpRequest");

for ($page = 1; $page < 11; $page++) {
$content = 
$browser->get('/articles/page/'.$page)->getResponse()->getContent();
$manager->setPartialCache('article', '_articles', 'articles_' . 
$page, $content);

}


The task runs fine, and i'm able to get the correct page using 
sfBrowser->get(), but when i hit
one of the first 10 pages after running the task, i'm still getting an 
uncached response.


From what i understand, internally the sfPartialView does the same 
call in the render() method:


$retval = $this->viewCache->setPartialCache($this->moduleName, 
$this->actionName, $this->cacheKey, $retval);


I've also set the correct application/environment for the task, so 
this shouldn't be the problem.


Any hint what im missing here?

thanks!

-robert




On 2/10/11 11:14 PM, Benoit Montuelle wrote:

Hi,

I would make it using a task which uses sfBrowser on the ajax urls, 
eventually using DB queries to generate them. If you use html cache 
it should do the job. The only thing is to run the task with the good 
env argument so it generates cache for 'prod'.


Now if you use sfViewCacheManager, it seems you can do it more 
naturally when a new post is created, with setPageCache 
method. 




Regards
Benoit

2011/2/10 Robert Gründler >


Hi,

Imagine a blog where each BlogEntry has one Author, and can be
tagged with one ore more Tags.
The mainpage displays a paginated list of all blogentries. Every
entry displays the title, author and the tags. The pagination
is implemented using AJAX.

To display the paginated list using symfony + doctrine, 3
Database queries are needed:

1. select count(*)  # get the total number of entries
2. select distinct ... limit ... offset # get the actual ids of
blog entries for that page
3. select ... where in (...)  # retrieve the data to display for
that page

When the number of blogs and the authors + tags is getting large,
these 3 queries can take up to 800 - 1000 ms, which is
not fast enough, if you want ajax pagination.

If a single page is cached, the ajax request takes about 200 -
300 ms, but the uncached page takes over 1 second to load.

What we're thinking about is to "pre-fill" the cache of every
page in that list, so that no user ever hits an uncached page.
This "pre-fillling"
could take place in a cronjob, which is run every 5 minutes or so
- frequent enough for this use case.

What i was thinking about is to set the cache-lifetime of the
partial for a single page to one day, and update the cached results
in the background - which actually is the part i'm not sure how
to implement.

Anyone knows if this kind of logic could be implemented using
symfony + doctrine?

thanks!

-robert

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


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




--
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 th

Re: [symfony-users] Auto-filling caches

2011-02-11 Thread Gareth McCumskey
Why not just chain ajax requests? Have two divs, one visible one invisible.
Load what the person wants to see with one ajax request. When that completes
it calls another ajax request which loads the next page into the invisible
div. When the person goes to the next page, the act of making that page
visible starts loading the next page into the hidden div.

2011/2/10 Robert Gründler 

> Hi,
>
> Imagine a blog where each BlogEntry has one Author, and can be tagged with
> one ore more Tags.
> The mainpage displays a paginated list of all blogentries. Every entry
> displays the title, author and the tags. The pagination
> is implemented using AJAX.
>
> To display the paginated list using symfony + doctrine, 3 Database queries
> are needed:
>
> 1. select count(*)  # get the total number of entries
> 2. select distinct ... limit ... offset # get the actual ids of blog
> entries for that page
> 3. select ... where in (...)  # retrieve the data to display for that page
>
> When the number of blogs and the authors + tags is getting large, these 3
> queries can take up to 800 - 1000 ms, which is
> not fast enough, if you want ajax pagination.
>
> If a single page is cached, the ajax request takes about 200 - 300 ms, but
> the uncached page takes over 1 second to load.
>
> What we're thinking about is to "pre-fill" the cache of every page in that
> list, so that no user ever hits an uncached page. This "pre-fillling"
> could take place in a cronjob, which is run every 5 minutes or so -
> frequent enough for this use case.
>
> What i was thinking about is to set the cache-lifetime of the partial for a
> single page to one day, and update the cached results
> in the background - which actually is the part i'm not sure how to
> implement.
>
> Anyone knows if this kind of logic could be implemented using symfony +
> doctrine?
>
> thanks!
>
> -robert
>
> --
> 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
>



-- 
Gareth McCumskey
http://garethmccumskey.blogspot.com
twitter: @garethmcc
identi.ca: @garethmcc

-- 
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] Auto-filling caches

2011-02-11 Thread Robert Gründler
this approach could work too, but you don't know in advance which page 
the user clicks next, so you'd have to
pre-load all currently available pages, which would lead to unnecessary 
server requests.


The hostname thing was solved by this if anyone runs into the same problem:

  view_cache_manager:
class: sfViewCacheManager
param:
  cache_key_use_host_name: false



On 2/11/11 10:27 AM, Gareth McCumskey wrote:
Why not just chain ajax requests? Have two divs, one visible one 
invisible. Load what the person wants to see with one ajax request. 
When that completes it calls another ajax request which loads the next 
page into the invisible div. When the person goes to the next page, 
the act of making that page visible starts loading the next page into 
the hidden div.


2011/2/10 Robert Gründler >


Hi,

Imagine a blog where each BlogEntry has one Author, and can be
tagged with one ore more Tags.
The mainpage displays a paginated list of all blogentries. Every
entry displays the title, author and the tags. The pagination
is implemented using AJAX.

To display the paginated list using symfony + doctrine, 3 Database
queries are needed:

1. select count(*)  # get the total number of entries
2. select distinct ... limit ... offset # get the actual ids of
blog entries for that page
3. select ... where in (...)  # retrieve the data to display for
that page

When the number of blogs and the authors + tags is getting large,
these 3 queries can take up to 800 - 1000 ms, which is
not fast enough, if you want ajax pagination.

If a single page is cached, the ajax request takes about 200 - 300
ms, but the uncached page takes over 1 second to load.

What we're thinking about is to "pre-fill" the cache of every page
in that list, so that no user ever hits an uncached page. This
"pre-fillling"
could take place in a cronjob, which is run every 5 minutes or so
- frequent enough for this use case.

What i was thinking about is to set the cache-lifetime of the
partial for a single page to one day, and update the cached results
in the background - which actually is the part i'm not sure how to
implement.

Anyone knows if this kind of logic could be implemented using
symfony + doctrine?

thanks!

-robert

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




--
Gareth McCumskey
http://garethmccumskey.blogspot.com
twitter: @garethmcc
identi.ca : @garethmcc

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


--
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: [Symfony2] How to create Forms in PR6?

2011-02-11 Thread stfalcon
What is "$this->get('form.context')" and where it set?

On 8 Лют, 20:23, Nikita Korotaev  wrote:
> Bernhard, thanks for your suggestion. After playing around with different
> configurations, I've finally made it working.
>
>         // Code in controller
>      $relationUserUniversity = new RelationUserUniversity();
>      $relationUserUniversity->setUser(new User());
>      $relationUserUniversity->setUniversity(new University());
>         $form =
> UniversityRegistrationForm::create($this->get('form.context'),
> 'Registration');
>         $form->bind($this->get('request'), $relationUserUniversity);
>
> class UniversityRegistrationForm extends Form
> {
>     protected function configure()
>     {
>      $user = new Form('User');
>      $user->add(new TextField('firstName'));
>      $user->add(new TextField('lastName'));
>      $user->add(new TextField('email'));
>      $user->add(new RepeatedField(new PasswordField('password')));
>      $this->add($user);
>      $university = new Form('University');
>      $university->add(new TextField('name'));
>      $this->add($university);
>
>     }
>
> }
>
> Thanks for help,
> Nikita

-- 
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: [Symfony2] How to create Forms in PR6?

2011-02-11 Thread stof
On Fri, 11 Feb 2011 03:08:10 -0800 (PST), stfalcon
 wrote:
> What is "$this->get('form.context')" and where it set?
> 

This gets the service named "form.context" in the container (it is a
shortcut for "$this->container->get('form.context')" in the controllers)
which is set in
Symfony\Bundle\FrameworkBundle\DependencyInjection\FrameworkExtension as
many other services.

This service contains the dependencies of the form (validator, ...) to
avoid you passing each dependency by hand (which is also possible by
retrieving them from the container).

-- 
Christophe | Stof

-- 
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] [PR6] Using ESI tag renders nothing

2011-02-11 Thread Christophe Beyer
Hi,

Since PR6, my zones where I want to display content using ESI tags display 
nothing. This was OK in PR5.


-- main layout :

{% render 'MyBundle:Match:cadre' with {}, { 'standalone': true} %}

-- controller :

$response = $this->container->get('response');
$response->setSharedMaxAge(60*60);
return $this->render('MyBundle:Match:cadre.twig.html', array(
), $response);

--  web/app.php :

use Symfony\Component\HttpFoundation\Request;

require_once __DIR__.'/../app/bootstrap.php';
require_once __DIR__.'/../app/AppCache.php';

$kernel = new AppCache(new AppKernel('dev', true));
$kernel->handle(Request::createFromGlobals())->send();

error_log($kernel->getLog());

-- AppCache.php :

protected function getOptions()
{
return array(
'debug'  => true,
'default_ttl'=> 0,
'private_headers'=> array('Authorization', 'Cookie'),
'allow_reload'   => false,
'allow_revalidate'   => false,
'stale_while_revalidate' => 2,
'stale_if_error' => 60,
);
}


In the Firebug window, I see the header "X-Symfony-Cache", but it contains only 
"GET /: miss", on all pages.

So, whats is wrong here ?
The same parameters worked fine in PR5...


-- 
Christophe



-- 
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] [PR6] Using ESI tag renders nothing

2011-02-11 Thread stof
On Fri, 11 Feb 2011 13:07:49 +0100, Christophe Beyer 
wrote:
> Hi,
> 
> Since PR6, my zones where I want to display content using ESI tags
display
> nothing. This was OK in PR5.
> 

Did you enable the esi explicitly in your configuration file ? This is now
necessary when using esi (to avoid loading the classes when not using it)

-- 
Christophe | Stof

-- 
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] [PR6] Using ESI tag renders nothing

2011-02-11 Thread Christophe Beyer
No, I didn't modify my config file in this way.

What should I add in the config file ?


I found nothing in the documentation :(


-- 
Christophe Beyer
cbe...@cap-tic.fr




Le 11 févr. 2011 à 13:32, stof a écrit :

> On Fri, 11 Feb 2011 13:07:49 +0100, Christophe Beyer 
> wrote:
>> Hi,
>> 
>> Since PR6, my zones where I want to display content using ESI tags
> display
>> nothing. This was OK in PR5.
>> 
> 
> Did you enable the esi explicitly in your configuration file ? This is now
> necessary when using esi (to avoid loading the classes when not using it)
> 
> -- 
> Christophe | Stof
> 
> -- 
> 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

-- 
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] [PR6] Using ESI tag renders nothing

2011-02-11 Thread stof
On Fri, 11 Feb 2011 13:45:31 +0100, Christophe Beyer 
wrote:
> No, I didn't modify my config file in this way.
> 
> What should I add in the config file ?
> 
> 
> I found nothing in the documentation :(
> 

Seems like the doc has not been updated on this point. Here is the config:

app.config:
   esi: ~

Regards

-- 
Christophe | Stof

-- 
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] Question about block

2011-02-11 Thread Christophe Beyer
My main HTML layout looks like that :





{% block title 'Default title - example.com' %}


I want to have only to write this in my controller layout :
{% block title %}My title{% endblock %}
instead
{% block title %}My title - Default title - example.com{% endblock %}


Ton render this HTML :
My title - Default title - example.com


How can I do this ?



-- 
Christophe

-- 
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] Question about block

2011-02-11 Thread stof
On Fri, 11 Feb 2011 13:53:00 +0100, Christophe Beyer 
wrote:
> My main HTML layout looks like that :
> 
> 
> 
> 
>  />
> {% block title 'Default title - example.com' %}
> 
> 
> I want to have only to write this in my controller layout :
> {% block title %}My title{% endblock %}
> instead
> {% block title %}My title - Default title - example.com{% endblock %}
> 
> 
> Ton render this HTML :
> My title - Default title - example.com
> 
> 
> How can I do this ?
> 
> 
> 
> -- 
> Christophe

Two solution:
{% block title %}My title - {{ parent() }}{% endblock %} keeping the
current layout
or witing the part you always want outside of the block in the layout so
it is not discarded when changing the block in a child template.

-- 
Christophe | Stof

-- 
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] [PR6] Using ESI tag renders nothing

2011-02-11 Thread Christophe Beyer
Thanks, but the result is the same... :(



-- 
Christophe




Le 11 févr. 2011 à 13:50, stof a écrit :

> On Fri, 11 Feb 2011 13:45:31 +0100, Christophe Beyer 
> wrote:
>> No, I didn't modify my config file in this way.
>> 
>> What should I add in the config file ?
>> 
>> 
>> I found nothing in the documentation :(
>> 
> 
> Seems like the doc has not been updated on this point. Here is the config:
> 
> app.config:
>   esi: ~
> 
> Regards
> 
> -- 
> Christophe | Stof
> 
> -- 
> 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

-- 
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: Redirect with method POST

2011-02-11 Thread Massimiliano Arione
If you need to post a page without user interaction, use sfBrowser (in 
sfBrowserPlugin)

cheers
Massimiliano

-- 
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] Question about block

2011-02-11 Thread Christophe Beyer
This works great :
> {% block title %}My title - {{ parent() }}{% endblock %}


Nothing about this tip in the documentation, I could'nt know this.

Thanks !


-- 
Christophe




Le 11 févr. 2011 à 14:00, stof a écrit :

> On Fri, 11 Feb 2011 13:53:00 +0100, Christophe Beyer 
> wrote:
>> My main HTML layout looks like that :
>> 
>> 
>> 
>>
>>>/>
>>{% block title 'Default title - example.com' %}
>> 
>> 
>> I want to have only to write this in my controller layout :
>> {% block title %}My title{% endblock %}
>> instead
>> {% block title %}My title - Default title - example.com{% endblock %}
>> 
>> 
>> Ton render this HTML :
>> My title - Default title - example.com
>> 
>> 
>> How can I do this ?
>> 
>> 
>> 
>> -- 
>> Christophe
> 
> Two solution:
> {% block title %}My title - {{ parent() }}{% endblock %} keeping the
> current layout
> or witing the part you always want outside of the block in the layout so
> it is not discarded when changing the block in a child template.
> 
> -- 
> Christophe | Stof
> 
> -- 
> 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

-- 
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] Question about block

2011-02-11 Thread stof
On Fri, 11 Feb 2011 14:25:00 +0100, Christophe Beyer 
wrote:
> This works great :
>> {% block title %}My title - {{ parent() }}{% endblock %}
> 
> 
> Nothing about this tip in the documentation, I could'nt know this.
> 
> Thanks !
> 

The Twig documentation clearly says that the "parent" function exists and
is used to display the content of the parent block :
http://www.twig-project.org/doc/templates.html#parent-blocks

-- 
Christophe | Stof

-- 
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] Is it possible to check the filesize of an image *before* uploading it ?

2011-02-11 Thread Manu
Is it possible to check the filesize of an image *before* uploading
it ? Maybe using javascript ?

-- 
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: The helper "javascripts" is not defined

2011-02-11 Thread Justin Fortier
Thanks for the heads up Christophe, looking forward to it after seeing
the presentation up on the blog.

On Feb 10, 4:53 pm, Christophe COEVOET  wrote:
> Le 10/02/2011 21:32, Justin Fortier a crit :
>
> > Yeah this is kind of a mess. It's been taken out because it did not
> > work as "intended". Originally I was 
> > usinghttps://github.com/Adenclassifieds/AssetOptimizerBundle
> > as a substitute that Fabien was recommending. Apparently recently
> > they've abandoned the project as they say:
>
> > "Warning This Bundle is not maintained any more : you should try the
> > FOS's [AsseticBundle](https://github.com/FriendsOfSymfony/
> > AsseticBundle) instead, if you look for forward compatibility"
>
> > But clicking on their link leads to a 404. So I'm not sure what's
> > available as a viable solution for asset management, as I don't like
> > Symfony2 default implementation. Described here:
> >http://docs.symfony-reloaded.org/guides/templating/PHP.html#using-ass...
>
> > Hopefully they implement something a little more user-friendly by
> > launch. But for now $view['assets'] is the way to go.
>
> The AsseticBundle is currently in kryswallsmith's symfony repo, waiting
> to become a core bundle. The merging is not done yet.
>
> --
> Christophe | Stof

-- 
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: Is it possible to check the filesize of an image *before* uploading it ?

2011-02-11 Thread Gabriel Petchesi
Look into flash (sfWidgetFormInputSWFUploadPlugin) or java applet 
uploaders. 
Those are capable of checking the size, I don't think it's technically 
possible using stock browser file upload.

   gabriel

-- 
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: Is it possible to check the filesize of an image *before* uploading it ?

2011-02-11 Thread Stéphane
Using File API for HTML 5 it's possible. But it needs File API enabled
browser (FF 4 for example).
Using JS of course.

Regards,

Before Printing, Think about Your Environmental Responsibility!
Avant d'Imprimer, Pensez à Votre Responsabilitée Environnementale!


On Fri, Feb 11, 2011 at 4:07 PM, Gabriel Petchesi wrote:

> Look into flash (sfWidgetFormInputSWFUploadPlugin) or java applet
> uploaders.
> Those are capable of checking the size, I don't think it's technically
> possible using stock browser file upload.
>
>gabriel
>
> --
> 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
>

-- 
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] Detect the environment in the template

2011-02-11 Thread Manu
Is it possible to detect the environment in a template file ?
I would like to show a warning when the user is using the production
admin, and not when he's on the development one.

-- 
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] Detect the environment in the template

2011-02-11 Thread Michał Piotrowski
Hi,

2011/2/11 Manu :
> Is it possible to detect the environment in a template file ?



?

> I would like to show a warning when the user is using the production
> admin, and not when he's on the development one.
>
> --
> 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
>



-- 
Best regards,
Michal

http://eventhorizon.pl/

-- 
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: Detect the environment in the template

2011-02-11 Thread Manu
Well, that was easy. :)
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


[symfony-users] Sandbox PR6 - Override Twig in child template

2011-02-11 Thread LionelFristot
Hi,

I'm trying to get this to work without any success :

{% extends "::base.html.twig" %}

{% block title %}Expediteur{% endblock %}

{% block head %}
{{ parent() }}

{% endblock %}

I'm in a bundle, "js" folder is in /web. The title block works fine
but not the head block, what am I missing here ?

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


[symfony-users] Re: How to let the user choose the upload directory ?

2011-02-11 Thread Felds Liscia
I think the better way to do this is by saving the file always on a
temp folder (could be the /web/uploads itself) and moving it to it's
final location on the Model::save() so the model can keep track of the
file's final location.

If you really want to manage this process on the Form class, you could
use a post-validator.

On Feb 9, 1:12 pm, Manu  wrote:
> I have a form used to upload images in my blog engine. The files are
> uploaded to web/uploads, but I'd like to add a "choice" widget to let
> the users pick from a list of folders, for instance 'photos',
> 'cliparts', 'logos'.
>
> Here's my form
> class ImageForm extends BaseForm
> {
>   public function configure()
>   {
>     $this->widgetSchema->setNameFormat('image[%s]');
>
>     $this->setWidget('file', new sfWidgetFormInputFileEditable(
>       array(
>         'edit_mode'=>false,
>         'with_delete' => false,
>         'file_src' => '',
>         )
>     ));
>
>     $this->setValidator('file', new mysfValidatorFile(
>       array(
>         'max_size' => 50,
>         'mime_types' => 'web_images',
>         'path' => 'uploads',
>         'required' => true
>         )
>
>     ));
>
>     $this->setWidget('folder', new sfWidgetFormChoice(array(
>       'expanded' => false,
>       'multiple' => false,
>       'choices'  => array('photos', 'cliparts', 'logos')
>        )
>     ));
>
>     $this->setValidator('folder', new sfValidatorChoice(array(
>       'choices' => array(0,1,2)
>     )));
>
>   }
>
> }
>
> and here is my action :
>   public function executeAjout(sfWebRequest $request)
>   {
>     $this->form = new ImageForm();
>
>     if ($request->isMethod('post'))
>     {
>       $this->form->bind(
>         $request->getParameter($this->form->getName()),
>         $request->getFiles($this->form->getName())
>       );
>
>       if ($this->form->isValid())
>       {
>            $this->form->getValue('file')->save();
>            $this->image = $this->form->getValue('file');
>       }
>
>     }
>
> So how do I tell the file upload widget to save the image in a
> different folder ?

-- 
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 to check if a file exist before uploading it ?

2011-02-11 Thread Lionel Fristot
Maybe you can try the post-validator way :

#Add something like that in your Form class

protected function checkFile()
  {
$file = $this->getValue('file');//your file input name
$dir  = $this->getValue('choosen_upload_dir');

if
  // check if file exists
  // throw an error (or not depending of what you want to do!)

  }

#and in your setup()
 $this->mergePostValidator(
new sfValidatorCallback(
array('callback' => array($this, 'checkFile'))
));

Hope this helps!

On 10 fév, 12:18, Manu  wrote:
> Nevermind I'll do it in the action before ->save()

-- 
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: Problem setting up authentication in symfony2

2011-02-11 Thread Frenck
Try it with this in your config first:

  encoders:
Symfony\Component\Security\Core\User\AccountInterface:
  algorithm: plaintext


And work from there...


../Frenck

On 10 feb, 05:26, Klaas Naaijkens  wrote:
> Hi, I am struggling with the security system in symfony2 for about a
> day now.
>
> I have this in my config_dev.yml (running with the latest version of
> symfony2 github)
> -
> security.config:
>    providers:
>        main:
>            users:
>                foo: { password: foo }
>
>    firewalls:
>        main:
>            http-basic: true
>
>    access_control:
>        - { path: /.*, role: ROLE_USER }
>
>    encoders:
>        HelloBundle/Entity/User: plaintext
> --
> Then I get this error.
>
> No encoder has been configured for account
> "Symfony\Component\Security\Core\User\User".
>
> Stack Trace
> in /home/klaas/code/LPbackend/vendor/symfony/src/Symfony/Component/
> Security/Core/Encoder/EncoderFactory.php
> line 75 »
>            }
>        }
>        throw new \InvalidArgumentException(sprintf('No encoder has
> been configured for account "%s".', get_class($account)));
>    }}
>
> at EncoderFactory->createEncoder(object(User))
> in /home/klaas/code/LPbackend/vendor/symfony/src/Symfony/Component/
> Security/Core/Encoder/EncoderFactory.php
> line 43 »
> at EncoderFactory->getEncoder(object(User))
> in /home/klaas/code/LPbackend/vendor/symfony/src/Symfony/Component/
> Security/Core/Authentication/Provider/DaoAuthenticationProvider.php
> line 65 »
> at DaoAuthenticationProvider->checkAuthentication(object(User),
> object(UsernamePasswordToken))
> in /home/klaas/code/LPbackend/vendor/symfony/src/Symfony/Component/
> Security/Core/Authentication/Provider/UserAuthenticationProvider.php
> line 70 »
> at UserAuthenticationProvider->authenticate(object(UsernamePasswordToken))
>
> in /home/klaas/code/LPbackend/vendor/symfony/src/Symfony/Component/
> Security/Core/Authentication/AuthenticationProviderManager.php
> line 61 »
> at AuthenticationProviderManager->authenticate(object(UsernamePasswordToken))
>
> in /home/klaas/code/LPbackend/vendor/symfony/src/Symfony/Component/
> Security/Http/Firewall/BasicAuthenticationListener.php
> line 97 »
> at BasicAuthenticationListener->handle(object(Event))
> at call_user_func(array(object(BasicAuthenticationListener),
> 'handle'), object(Event))
> in /home/klaas/code/LPbackend/vendor/symfony/src/Symfony/Bundle/
> FrameworkBundle/Debug/EventDispatcher.php
> line 72 »
> at EventDispatcher->notifyUntil(object(Event))
> in /home/klaas/code/LPbackend/vendor/symfony/src/Symfony/Component/
> Security/Http/Firewall.php
> line 88 »
> at Firewall->handle(object(Event))
> at call_user_func(array(object(Firewall), 'handle'), object(Event))
> in /home/klaas/code/LPbackend/vendor/symfony/src/Symfony/Bundle/
> FrameworkBundle/Debug/EventDispatcher.php
> line 72 »
> at EventDispatcher->notifyUntil(object(Event))
> in /home/klaas/code/LPbackend/vendor/symfony/src/Symfony/Component/
> HttpKernel/bootstrap.php
> line 378 »
> at HttpKernel->handleRaw(object(Request), '1')
> in /home/klaas/code/LPbackend/vendor/symfony/src/Symfony/Component/
> HttpKernel/bootstrap.php
> line 361 »
> at HttpKernel->handle(object(Request), '1', true)
> in /home/klaas/code/LPbackend/vendor/symfony/src/Symfony/Bundle/
> FrameworkBundle/HttpKernel.php
> line 39 »
> at HttpKernel->handle(object(Request), '1', true)
> in /home/klaas/code/LPbackend/vendor/symfony/src/Symfony/Component/
> HttpKernel/bootstrap.php
> line 534 »
> at Kernel->handle(object(Request))
> in /home/klaas/code/LPbackend/web/app_dev.php line 15 »
>
> 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: Problem setting up authentication in symfony2

2011-02-11 Thread Klaas Naaijkens
Justin, is this with PR6 or the latest symfony version from git?

On Thu, Feb 10, 2011 at 2:44 PM, Justin Fortier  wrote:
> First make sure have the Bundle enabled in your AppKernel. So add this
> line:
>
> new Symfony\Bundle\SecurityBundle\SecurityBundle(),
>
>
> Then here's an example of my working config. The stuff that is
> commented out is what you're looking to implement. However I've set it
> up for multiple users with entities. Thought you might like to see
> both.
>
> security.config:
>    encoders:
>        #Symfony\Security\Core\User\AccountInterface:
>        MRX\Backend\AuthBundle\Entity\Users:
>            algorithm: plaintext
>
>    providers:
>        main:
>            entity: { class: AuthBundle:Users, property: email }
>            #users:
>                #foo: { password: foo, roles: ['ROLE_USER',
> 'ROLE_ADMIN'] }
>
>    firewalls:
>        main:
>            pattern:    .*
>            form_login: true
>            anonymous:  true
>            logout:     { path: /logout, target: /login }
>
>    access_control:
>        - { path: /login.*, role: IS_AUTHENTICATED_ANONYMOUSLY }
>        - { path: /.*, role: ROLE_USER }
>
>
> On Feb 9, 11:26 pm, Klaas Naaijkens  wrote:
>> Hi, I am struggling with the security system in symfony2 for about a
>> day now.
>>
>> I have this in my config_dev.yml (running with the latest version of
>> symfony2 github)
>> -
>> security.config:
>>    providers:
>>        main:
>>            users:
>>                foo: { password: foo }
>>
>>    firewalls:
>>        main:
>>            http-basic: true
>>
>>    access_control:
>>        - { path: /.*, role: ROLE_USER }
>>
>>    encoders:
>>        HelloBundle/Entity/User: plaintext
>> --
>> Then I get this error.
>>
>> No encoder has been configured for account
>> "Symfony\Component\Security\Core\User\User".
>>
>> Stack Trace
>> in /home/klaas/code/LPbackend/vendor/symfony/src/Symfony/Component/
>> Security/Core/Encoder/EncoderFactory.php
>> line 75 »
>>            }
>>        }
>>        throw new \InvalidArgumentException(sprintf('No encoder has
>> been configured for account "%s".', get_class($account)));
>>    }}
>>
>> at EncoderFactory->createEncoder(object(User))
>> in /home/klaas/code/LPbackend/vendor/symfony/src/Symfony/Component/
>> Security/Core/Encoder/EncoderFactory.php
>> line 43 »
>> at EncoderFactory->getEncoder(object(User))
>> in /home/klaas/code/LPbackend/vendor/symfony/src/Symfony/Component/
>> Security/Core/Authentication/Provider/DaoAuthenticationProvider.php
>> line 65 »
>> at DaoAuthenticationProvider->checkAuthentication(object(User),
>> object(UsernamePasswordToken))
>> in /home/klaas/code/LPbackend/vendor/symfony/src/Symfony/Component/
>> Security/Core/Authentication/Provider/UserAuthenticationProvider.php
>> line 70 »
>> at UserAuthenticationProvider->authenticate(object(UsernamePasswordToken))
>>
>> in /home/klaas/code/LPbackend/vendor/symfony/src/Symfony/Component/
>> Security/Core/Authentication/AuthenticationProviderManager.php
>> line 61 »
>> at AuthenticationProviderManager->authenticate(object(UsernamePasswordToken))
>>
>> in /home/klaas/code/LPbackend/vendor/symfony/src/Symfony/Component/
>> Security/Http/Firewall/BasicAuthenticationListener.php
>> line 97 »
>> at BasicAuthenticationListener->handle(object(Event))
>> at call_user_func(array(object(BasicAuthenticationListener),
>> 'handle'), object(Event))
>> in /home/klaas/code/LPbackend/vendor/symfony/src/Symfony/Bundle/
>> FrameworkBundle/Debug/EventDispatcher.php
>> line 72 »
>> at EventDispatcher->notifyUntil(object(Event))
>> in /home/klaas/code/LPbackend/vendor/symfony/src/Symfony/Component/
>> Security/Http/Firewall.php
>> line 88 »
>> at Firewall->handle(object(Event))
>> at call_user_func(array(object(Firewall), 'handle'), object(Event))
>> in /home/klaas/code/LPbackend/vendor/symfony/src/Symfony/Bundle/
>> FrameworkBundle/Debug/EventDispatcher.php
>> line 72 »
>> at EventDispatcher->notifyUntil(object(Event))
>> in /home/klaas/code/LPbackend/vendor/symfony/src/Symfony/Component/
>> HttpKernel/bootstrap.php
>> line 378 »
>> at HttpKernel->handleRaw(object(Request), '1')
>> in /home/klaas/code/LPbackend/vendor/symfony/src/Symfony/Component/
>> HttpKernel/bootstrap.php
>> line 361 »
>> at HttpKernel->handle(object(Request), '1', true)
>> in /home/klaas/code/LPbackend/vendor/symfony/src/Symfony/Bundle/
>> FrameworkBundle/HttpKernel.php
>> line 39 »
>> at HttpKernel->handle(object(Request), '1', true)
>> in /home/klaas/code/LPbackend/vendor/symfony/src/Symfony/Component/
>> HttpKernel/bootstrap.php
>> line 534 »
>> at Kernel->handle(object(Request))
>> in /home/klaas/code/LPbackend/web/app_dev.php line 15 »
>>
>> 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

[symfony-users] Using Symfony, sfDoctrineGuardPlugin plugin, How can i customise sf_content? Using partials?

2011-02-11 Thread erman taylan
Anyone cal help me about my question below. thanks,


Hi there,

I am using symfony 1.4.8 with sfDoctrineGuardPlugin for my backend.

My question is how can i customise sfDoctrineGuardPlugin's default content?
For example, how can i do something on the page between filter and table (on
the left hand site)? Or, how can i customize table (http://goo.gl/ZmRey)?

I cannot find any solution for using partials on backend. Is there any way
to use partials/components/slots on backend?

I hope you understand my question and tell me a way.

Thanks for your answer(s), Erman

-- 
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] Problem setting up authentication in symfony2

2011-02-11 Thread Klaas Naaijkens
Ok, I have set this now:

security.config:
encoders:
   Symfony\Component\Security\Core\User\User:
 algorithm: plaintext

providers:
main:
users:
foo: { password: foo }

firewalls:
main:
http-basic: true

and it works. Thank you.

> The exception message just tells you the issue: you have to define the
> encoder for the User class used by the InMemoryProvider, which is not
> "HelloBundle/Entity/User" but "Symfony\Component\Security\Core\User\User"
> as stated in the exception message.
> The doc about encoders is here:
> http://docs.symfony-reloaded.org/master/guides/security/users.html#configuring-encoders.
>
> Regards
>
> --
> Christophe | Stof
>
> --
> 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
>

-- 
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 Doctrine Oracle Connection problem

2011-02-11 Thread Altansuh A
Symfony 1.4.8 Doctrine Oracle not connection problem. Database.yml
all:
  doctrine:
class: sfDoctrineDatabase
phptype: oci8
param:
  dsn:  oracle:host=192.168.0.105:1521;dbname=oracle
  username: test
  password: test
Error:  Use of undefined constant OCI_COMMIT_ON_SUCCESS - assumed
'OCI_COMMIT_ON_SUCCESS"


AND--
all:
  doctrine:
class: sfDoctrineDatabase
param:
  dsn:  oci:host=192.168.0.105:1521;dbname=oracle
  username: test
  password: test
Error:  "Couldn't locate driver named oci"help me? send
altansu...@gmail.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] Shared Hostmonster: error Mime/type & custom Tasks for cronjob. Please help!

2011-02-11 Thread Diego
(sorry my english)

Hi, i have a full working Symfony 1.4 Doctrine Project, in my
localhost. Ubuntu 10.10 php 5.3.3

I uploaded it to my hostmonster on a subdomain, it works almost fine
but I have some issues like

* Symfony do not recognize a task class so the command line at a
cronjob:
php /home1/wikitron/public_html/cmpro/symfony post:cronFbPostTask
frontend --test=true
Return:
"There are no tasks defined in the "post" namespace"
This problem do not happen on my localhost, its very tested

and when execute just php /home1/wikitron/public_html/cmpro/symfony,
in the helper list do not apear the "post" option, its un-logical

* Symfony auto Mime/type validation for uploaded files at forms, do
not work good. I have a image validator (jpg,png,gif)... In the
hosting the validate is like where changed or not working like in
localhost : the form say "required text/plain" and not required image


Is it a problem in the webhosting? what can i do?


Thanks in Advance!

-- 
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] Updating existing project (Newbie to symfony)

2011-02-11 Thread Amador Antonio Cuenca
Hi all, I'm a junior developer, with experience in C#, Java, Ruby and some
Scala and PHP, I've assigned to extend a existing symfony project (I've
never work with symfony). Well, Here my problem:

I readed the quickstart and I copy the project from the server to my
personal computer. I've changed:
1.- ProjectConfiguration.class.php => require_once
'C://symfony//lib/autoload/sfCoreAutoload.class.php';
2.- databases.yml => I changed the host, user and password
3.- propel.ini => I changed the host, user and password
4.- clear the cache...

But I get this exception:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable
to complete your request.
Please contact the server administrator, ad...@example.com and inform them
of the time the error occurred, and anything you might have done that may
have caused the error.
More information about this error may be available in the server error log.

The project run in the server but in my PC don't, I've tested the symfony
installation create another project(Jobeet) and it works,

What do you think? Do I have to do something else? I'll really appreciate
your help guys.

Regards,
-- 
TSU. Amador Cuenca

-- 
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: Logging security events (syslog)

2011-02-11 Thread Manfred Dohmen
Thanks Leon, but the question relates more to how to hook into
Symfony2 in order to observe security events (and then having them
logged).

-- 
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] How to save form data into database ?

2011-02-11 Thread Erkhembayar Gantulga
Hi guys,

I've created News model and it's related form, repository.

Now, I can't save my posting data into my database.

code:
$form->bind($this->get('request'));

// If the form has been submitted and is valid...
if ($form->isValid()) {
  $em = $this->getEm();
  $em->persist($this->news);
  $em->flush();
  return $this->redirect($this->generateUrl('news'));
}

I just need to know how to persist news object.

Thank your help



Symfony Rock!
Erkhembayar Gantulga

-- 
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] Merge Form..

2011-02-11 Thread Erkhembayar Gantulga
HI, Vaibhav Rajput

It think that you need to embed your UserProfile form in UserForm. In order
to do that, you need to

1. In your schema:

>
> User:
>
 columns:

   id: { type: integer, primary: true,  autoincrement: true }

>username: { type: string(255), notnull: true, unique: true }
>password: { type: string(255), notnull: true, unique: true }
>
relations:
  UserProfile: {local: id, foreign: user_id,* type: many*}

>
> UserProfile:
>  actAs: { Timestampable: ~ }
>  columns:
>user_id: { type: integer, notnull: true }
>name:{ type: string(255) }
>phonenumber: { type: string(255), notnull: true }
>photo:   { type: string(255) }
>email:   { type: string(255) }
>  relations:
>User:{ onDelete: CASCADE, local: user_id, foreign: id,
> foreignAlias: UserProfile }
>


*type:* indicates one to many relation.

2. doctrine:build --all

3. In your UserForm:
$userProfile = new UserProfileForm($this->getObject->getUserProfile());
$this->embedForm('profile', $userProfile );


4.Done.

Cheers.


Erkhembayar Gantulga

-- 
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] Updating existing project (Newbie to symfony)

2011-02-11 Thread stof
On Thu, 10 Feb 2011 15:27:53 -0430, Amador Antonio Cuenca
 wrote:
> Hi all, I'm a junior developer, with experience in C#, Java, Ruby and
some
> Scala and PHP, I've assigned to extend a existing symfony project (I've
> never work with symfony). Well, Here my problem:
> 
> I readed the quickstart and I copy the project from the server to my
> personal computer. I've changed:
> 1.- ProjectConfiguration.class.php => require_once
> 'C://symfony//lib/autoload/sfCoreAutoload.class.php';
> 2.- databases.yml => I changed the host, user and password
> 3.- propel.ini => I changed the host, user and password
> 4.- clear the cache...
> 
> But I get this exception:
> 
> Internal Server Error
> The server encountered an internal error or misconfiguration and was
unable
> to complete your request.
> Please contact the server administrator, ad...@example.com and inform
them
> of the time the error occurred, and anything you might have done that
may
> have caused the error.
> More information about this error may be available in the server error
log.
> 
> The project run in the server but in my PC don't, I've tested the
symfony
> installation create another project(Jobeet) and it works,
> 
> What do you think? Do I have to do something else? I'll really
appreciate
> your help guys.
> 
> Regards,
> -- 
> TSU. Amador Cuenca

You should access the front controller of the dev environment to have an
exception message. The message provided by Apache when an error 500 occurs
does not says what was wrong.

-- 
Christophe | Stof

-- 
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: Logging security events (syslog)

2011-02-11 Thread Johannes Schmitt
What is a "security event" for you?

Kind regards,
Johannes


On Fri, Feb 11, 2011 at 8:14 AM, Manfred Dohmen wrote:

> Thanks Leon, but the question relates more to how to hook into
> Symfony2 in order to observe security events (and then having them
> logged).
>
> --
> 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
>

-- 
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 to check if a file exist before uploading it ?

2011-02-11 Thread Informations
Hi Lionel,

Anything common with Patrice Fristot ?

..
  - Original Message - 
  From: Lionel Fristot 
  To: Symfony users 
  Sent: Thursday, February 10, 2011 12:33 PM
  Subject: [symfony-users] Re: How to check if a file exist before uploading it 
?


  Maybe you can try the post-validator way :

  #Add something like that in your Form class

  protected function checkFile()
{
  $file = $this->getValue('file');//your file input name
  $dir  = $this->getValue('choosen_upload_dir');

  if
// check if file exists
// throw an error (or not depending of what you want to do!)

}

  #and in your setup()
   $this->mergePostValidator(
  new sfValidatorCallback(
  array('callback' => array($this, 'checkFile'))
  ));

  Hope this helps!

  On 10 fév, 12:18, Manu  wrote:
  > Nevermind I'll do it in the action before ->save()

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

-- 
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] Creating database SQL and Class Entities from a yaml file

2011-02-11 Thread Tac Tacelosky
This is a newbie question, but I've read the page at

http://docs.symfony-reloaded.org/guides/doctrine/orm/console.html

several times and I'm missing some of the basic steps in getting from YAML
to the set of Base / Peer classes.

I want to generate the MySQL schema from a yaml file, what command do I run?
 What I want to do is something like:

php app\console_dev doctrine:generate:entities MyTable.yml

but that's obviously not right.

I assume it's possible to go from an existing database to the .yml files, or
even directly to the generated entity classes, can anyone point me toward a
simple example of how to do that?

sf2/doctrine2 looks like a very powerful combination, and we're starting a
new project that won't need to be live for a few months, so I'm thinking
it's worth the risk to work with these new tools, but I miss the simple
step-by-step that the propel-based documentation offers.

On a related note, the documentation at
http://docs.symfony-reloaded.org/guides/doctrine/orm/console.html would be
much easier to read if there was at least a  at the end of the lines,
having :create in the middle isn't clear at all.  I'm not sure dd is the
best html tag to use there anyway, a formatted list would be fine, or use
 for each tag, not for a group of them.

Thanks!

Tac

-- 
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] Creating database SQL and Class Entities from a yaml file

2011-02-11 Thread stof
On Fri, 11 Feb 2011 11:11:11 -0500, Tac Tacelosky 
wrote:
> This is a newbie question, but I've read the page at
> 
> http://docs.symfony-reloaded.org/guides/doctrine/orm/console.html
> 
> several times and I'm missing some of the basic steps in getting from
YAML
> to the set of Base / Peer classes.

There is no Base classes with Doctrine 2. You should read the doc of
Doctrine 2 :)

> 
> I want to generate the MySQL schema from a yaml file, what command do I
> run?
>  What I want to do is something like:
> 
> php app\console_dev doctrine:generate:entities MyTable.yml

You have to give the bundle name, not the filename. And the filename has
to match the namespace of the entity (this is also explained in the doc) so
MyTable.yml is not a valid one.

> 
> but that's obviously not right.
> 
> I assume it's possible to go from an existing database to the .yml
files,
> or
> even directly to the generated entity classes, can anyone point me
toward a
> simple example of how to do that?
> 
> sf2/doctrine2 looks like a very powerful combination, and we're starting
a
> new project that won't need to be live for a few months, so I'm thinking
> it's worth the risk to work with these new tools, but I miss the simple
> step-by-step that the propel-based documentation offers.

Where did you find a Propel-based documentation for Symfony 2 ?

> 
> On a related note, the documentation at
> http://docs.symfony-reloaded.org/guides/doctrine/orm/console.html would
be
> much easier to read if there was at least a  at the end of the
lines,
> having :create in the middle isn't clear at all.  I'm not sure dd is the
> best html tag to use there anyway, a formatted list would be fine, or
use
>  for each tag, not for a group of them.
> 
> Thanks!
> 
> Tac

Btw, the up-to-date doc is at http://docs.symfony-reloaded.org/master/

-- 
Christophe | Stof

-- 
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] Creating database SQL and Class Entities from a yaml file

2011-02-11 Thread Tac Tacelosky
Any suggestions for a video tutorial or a step by step "Here's how to get a
table in MySQL into a sf2 model using doctrine2".  I see where it says
things like "MyBundle", but I'm still not sure if that's supposed to be a
directory or what.  Again, sorry for the newbie question!

The propel stuff is obviously for sf1, and there are more examples of how to
use it.

I'm hoping that the layout still gets fixed, even at

http://docs.symfony-reloaded.org/master/guides/doctrine/orm/console.html

the
options are hard to read.


Tac

On Fri, Feb 11, 2011 at 11:19 AM, stof  wrote:

> On Fri, 11 Feb 2011 11:11:11 -0500, Tac Tacelosky 
> wrote:
> > This is a newbie question, but I've read the page at
> >
> > http://docs.symfony-reloaded.org/guides/doctrine/orm/console.html
> >
> > several times and I'm missing some of the basic steps in getting from
> YAML
> > to the set of Base / Peer classes.
>
> There is no Base classes with Doctrine 2. You should read the doc of
> Doctrine 2 :)
>
> >
> > I want to generate the MySQL schema from a yaml file, what command do I
> > run?
> >  What I want to do is something like:
> >
> > php app\console_dev doctrine:generate:entities MyTable.yml
>
> You have to give the bundle name, not the filename. And the filename has
> to match the namespace of the entity (this is also explained in the doc) so
> MyTable.yml is not a valid one.
>
> >
> > but that's obviously not right.
> >
> > I assume it's possible to go from an existing database to the .yml
> files,
> > or
> > even directly to the generated entity classes, can anyone point me
> toward a
> > simple example of how to do that?
> >
> > sf2/doctrine2 looks like a very powerful combination, and we're starting
> a
> > new project that won't need to be live for a few months, so I'm thinking
> > it's worth the risk to work with these new tools, but I miss the simple
> > step-by-step that the propel-based documentation offers.
>
> Where did you find a Propel-based documentation for Symfony 2 ?
>
> >
> > On a related note, the documentation at
> > http://docs.symfony-reloaded.org/guides/doctrine/orm/console.html would
> be
> > much easier to read if there was at least a  at the end of the
> lines,
> > having :create in the middle isn't clear at all.  I'm not sure dd is the
> > best html tag to use there anyway, a formatted list would be fine, or
> use
> >  for each tag, not for a group of them.
> >
> > Thanks!
> >
> > Tac
>
> Btw, the up-to-date doc is at http://docs.symfony-reloaded.org/master/
>
> --
> Christophe | Stof
>
> --
> 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
>

-- 
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] Creating database SQL and Class Entities from a yaml file

2011-02-11 Thread stof
On Fri, 11 Feb 2011 11:34:23 -0500, Tac Tacelosky 
wrote:
> Any suggestions for a video tutorial or a step by step "Here's how to
get a
> table in MySQL into a sf2 model using doctrine2".  I see where it says
> things like "MyBundle", but I'm still not sure if that's supposed to be
a
> directory or what.  Again, sorry for the newbie question!
> 

The doctrine 2 doc describes how to creates entities so you really should
look at it: http://www.doctrine-project.org/docs/orm/2.0/en/

The directory in the filesystem are supposed to match the namespace as
this is the way the autoloader works to find the classes. You can look at
the sandbox to see how a project should look:
https://github.com/symfony/symfony-sandbox

-- 
Christophe | Stof

-- 
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] [Symfony2] How are you would divide your website on Applications and Bundles?

2011-02-11 Thread Nikita Korotaev
HI everyone,
 
Screening through the presentations from the San-Francisco conference 
http://www.symfony-project.org/blog/2011/02/10/symfony-live-san-francisco-day-2 
there were a few slides that suggesting you to how to divide you website on 
Applications and Bundles. They mention that it is better to have different 
applications for Frontend, for mobile version, for API

Let's describe the use-case, and see how it's better to organise the complex 
website into Applications and Bundles.
Let's take basecamphq.com and imagine that it was made with Symfony2. How 
would you organise your Symfony folder? 
You see that their main website interface of the basecamphq.com is very 
different from the subdomain interface of the 
*.basecamphq.com(customer.basecamphq.com). Hence I think it deserves 
separate application.
They also have mobile version. 

So should Symfony folder be smth like this:

---
|
|-main
|-subdomain
|-mobile
|-src
   |
   |-main
  |-mainBundels
   |-subdomain
  |-subdomainBundels
   |-mobile
  |-mobileBundels
|-vendor
   |-ThirdPartyBundles
|-web
   |-main.php
   |-subdomain.php
   |-mobile.php

In .htaccess you will choose which application to use, depending on your 
URL. Root folders main/,subdomain/, mobile/ contain their own configs, 
registering their bundles. And in src/ each application has their own 
Bundles. But in case of mobile-version I don't understand why in 
presentation it was suggested to use separate application, as only views 
will be different

That was only my idea. So how would you organise website like this? What is 
your suggestions?

Regards,
Nikita

-- 
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] Updating existing project (Newbie to symfony)

2011-02-11 Thread Alex Pilon
Do what you would do if this was a normal php app. Check the apache logs and
then return with a question about what is in there if that doesn't lead you
to the solution.

On Fri, Feb 11, 2011 at 10:45, stof  wrote:

> On Thu, 10 Feb 2011 15:27:53 -0430, Amador Antonio Cuenca
>  wrote:
> > Hi all, I'm a junior developer, with experience in C#, Java, Ruby and
> some
> > Scala and PHP, I've assigned to extend a existing symfony project (I've
> > never work with symfony). Well, Here my problem:
> >
> > I readed the quickstart and I copy the project from the server to my
> > personal computer. I've changed:
> > 1.- ProjectConfiguration.class.php => require_once
> > 'C://symfony//lib/autoload/sfCoreAutoload.class.php';
> > 2.- databases.yml => I changed the host, user and password
> > 3.- propel.ini => I changed the host, user and password
> > 4.- clear the cache...
> >
> > But I get this exception:
> >
> > Internal Server Error
> > The server encountered an internal error or misconfiguration and was
> unable
> > to complete your request.
> > Please contact the server administrator, ad...@example.com and inform
> them
> > of the time the error occurred, and anything you might have done that
> may
> > have caused the error.
> > More information about this error may be available in the server error
> log.
> >
> > The project run in the server but in my PC don't, I've tested the
> symfony
> > installation create another project(Jobeet) and it works,
> >
> > What do you think? Do I have to do something else? I'll really
> appreciate
> > your help guys.
> >
> > Regards,
> > --
> > TSU. Amador Cuenca
>
> You should access the front controller of the dev environment to have an
> exception message. The message provided by Apache when an error 500 occurs
> does not says what was wrong.
>
> --
> Christophe | Stof
>
> --
> 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
>



-- 
Alex Pilon
(613) 608-1480

-- 
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] [Symfony2] - entity manager in forms

2011-02-11 Thread jdewit
I'm trying to use the entityToIdTransformer in a form so I can populate a 
choiceField dynamically.

Here's my code.

namespace Sensio\HelloBundle\Form;

use Symfony\Component\Form\Form;
use 
Symfony\Bundle\DoctrineBundle\Form\ValueTransformer\EntityToIDTransformer;
use Symfony\Component\Form\ChoiceField;


class JobForm extends Form
{
  public function __construct()
  {
$em = $this->get('doctrine.orm.entity_manager');
  }

public function configure()
{
$em = $this->get('doctrine.orm.entity_manager');
$userChoices = array();
$users = 
$em->getRepository('Sensio\HelloBundle\Entity\User')->findAll();
foreach ($users as $user) {
$userChoices[$user->getId()] = $user->getName();
}

$userTransformer = new EntityToIDTransformer(array(
'em' => $em,
'className' => 'User',
));
$this->add(new ChoiceField('engineer', array(
'choices' => $userChoices,
'value_transformer' => $userTransformer,
)));
}
}

I get the error

Field "doctrine.orm.entity_manager" does not exist.


-- 
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] [symfony2] - entity manager in forms

2011-02-11 Thread jdewit
I'm trying to use the entityToIdTransformer in a form so I can populate a 
choiceField dynamically.

Here's my code.

namespace Sensio\HelloBundle\Form;

use Symfony\Component\Form\Form;
use 
Symfony\Bundle\DoctrineBundle\Form\ValueTransformer\EntityToIDTransformer;
use Symfony\Component\Form\ChoiceField;


class JobForm extends Form
{
public function configure()
{
$em = $this->get('doctrine.orm.entity_manager');
$userChoices = array();
$users = 
$em->getRepository('Sensio\HelloBundle\Entity\User')->findAll();
foreach ($users as $user) {
$userChoices[$user->getId()] = $user->getName();
}

$userTransformer = new EntityToIDTransformer(array(
'em' => $em,
'className' => 'User',
));
$this->add(new ChoiceField('engineer', array(
'choices' => $userChoices,
'value_transformer' => $userTransformer,
)));
}
}

I get the error

Field "doctrine.orm.entity_manager" does not exist.

Any help would be much appreciated!

-- 
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] [symfony2] - entity manager in forms

2011-02-11 Thread Christophe COEVOET

Le 11/02/2011 20:30, jdewit a écrit :
I'm trying to use the entityToIdTransformer in a form so I can 
populate a choiceField dynamically.


Here's my code.

namespace Sensio\HelloBundle\Form;

use Symfony\Component\Form\Form;
use 
Symfony\Bundle\DoctrineBundle\Form\ValueTransformer\EntityToIDTransformer;

use Symfony\Component\Form\ChoiceField;


class JobForm extends Form
{
public function configure()
{
$em = $this->get('doctrine.orm.entity_manager');
$userChoices = array();
$users = 
$em->getRepository('Sensio\HelloBundle\Entity\User')->findAll();

foreach ($users as $user) {
$userChoices[$user->getId()] = $user->getName();
}

$userTransformer = new EntityToIDTransformer(array(
'em' => $em,
'className' => 'User',
));
$this->add(new ChoiceField('engineer', array(
'choices' => $userChoices,
'value_transformer' => $userTransformer,
)));
}
}

I get the error

Field "doctrine.orm.entity_manager" does not exist.

Any help would be much appreciated!

$this->get('...') only works in controlers to get a service (where it is 
a shortcut for $this->container->get('...')). The container is not 
available in the form class so you have to pass the entity manager to 
your form as an argument.


Thus you should use the EntityChoiceField to propose a choice between 
entities. The EntityToIDTransformer has been removed.


--
Christophe | Stof

--
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: Logging security events (syslog)

2011-02-11 Thread Manfred Dohmen
> What is a "security event" for you?

http://docs.symfony-reloaded.org/guides/security/authentication.html

When I use form based authentication the user only gets redirected to
my custom SecurityController if he is not authenticated. The actual
authentication following a form post gets triggered by Symfony's event
system. I'm looking for a way to observe events like "successful
login", "failed login" and "logout" in order to get log messages sent
to syslog.

Regards
Manfred


-- 
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] [Symonfy2] Simple form seems never valid, no error messages?

2011-02-11 Thread Frenck
Hi,

I've got a small little issue with Symfony2 PR6. I'm trying to create
a small and simple form.
Input is an barcode (entered by a barcode scanner).

The form does not generate any error's.
It's display, I can submit it, but nothing happens.
I've added an simple else{} statement with an echo "INVALID" to check
if validation passes.

Whatever I do. Validation never passes, but no error's are printed :S

Could someone please tell me what I'm doing wrong? It's driving me
completely crazy :S

Thanks in a million!




This is (part) of my config.yml:
=
app.config:
  charset:UTF-8
  csrf_protection:
enabled:  true
secret:   secretkeykey
  router: { resource: "%kernel.root_dir%/config/routing.yml" }
  validation: { enabled: true, annotations: true }

BarcodeRequest.php
===
barcode = $barcode;
}

public function getBarcode()
{
  return $this->barcode;
}
  }


BarcodeForm.php

add(new TextField('barcode'));
}
   }


(part of) My Template:
==
errors($form) ?>
  

  label($form['barcode']) ?>render($form['barcode'], array('class'=>'medium auto-focus')) ?>
  hidden($form) ?>

  


My Controller:
==
get('form.context'),
'scan');

  $barcodeForm->bind($this->get('request'), $barcodeRequest);

  if ($barcodeForm->isValid()) {
die($barcodeRequest->getBarcode());
  } else {
echo "INVALID!";  //Extra echo.. .just for debugging/testing
  }

  return $this->render('MyBundle:Scan:index.html.php', array(
  'form' => $barcodeForm,
  ));
}
  }

-- 
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] [symfony2] - entity manager in forms

2011-02-11 Thread jdewit
Ok. The choice field shows up, but that's it. It doesn't populate with my 
data and it causes the form fields after it to disappear. 

Here's the attempt...

namespace Sensio\HelloBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\HelloBundle\Form\JobForm;
use Sensio\HelloBundle\Entity\Job;

class JobController extends Controller
{
public function newAction()
{
  $em = $this->get('doctrine.orm.entity_manager');
  $job = new Job();
  $form = JobForm::create($this->get('form.context'), 'Job', array('em' 
=> $em));
  
  return $this->render('HelloBundle:Hello/job:new.html.twig', array(
'form' => $form
));
}
}

namespace Sensio\HelloBundle\Form;

use Symfony\Component\Form\Form;
use Symfony\Component\Form\TextField;
use Sensio\HelloBundle\Entity\User;
use Symfony\Component\Form\EntityChoiceField;

class JobForm extends Form
{
public function configure()
{
  $this->addOption('em');
  $em = $this->getOption('em');
  $repository = $em->getRepository('Sensio\HelloBundle\Entity\User');
  $this->add(new EntityChoiceField('salesRep', array(
 'em' => $em,
 'class' => 'Sensio\HelloBundle\Entity\User',
 'query_builder' => function ($repository) {
 return $repository->createQueryBuilder('u')->where('u.active = 
1');
 },
 )));
$this->add(new TextField('address'));
$this->add(new TextField('city'));
   }
}

new.html.twig--
{% block content %}
Create Account

{{ form_errors(form) }}

{% for field in form %}

{{ form_label(field) }}
{{ form_field(field) }}
{{ form_errors(field) }}

{% endfor %}



{% endblock %}

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


Re: [symfony-users] [symfony2] - entity manager in forms

2011-02-11 Thread jdewit
This fixed it. Property needed to be assigned.

  $this->add(new EntityChoiceField('salesRep', array(
 'em' => $em,
 'class' => 'Sensio\HelloBundle\Entity\User',
 'property' => 'firstName',
 'query_builder' => function ($repository) {
 return $repository->createQueryBuilder('u')->where('u.active = 
1');

 },
   )));

However, I would like to display first and last name. Is this possible?

-- 
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] [Symfony2] - Choicefield empty_value

2011-02-11 Thread jdewit
empty_value doesn't seem to work in for choiceField. 

in choicefield.php

protected function initializeChoices()
{
if (!$this->choices) {
$this->choices = $this->getInitializedChoices();

if (!$this->isRequired()) {
$this->choices = array('' => 
$this->getOption('empty_value')) + $this->choices;
}
}
}

should be changed to

if ($this->getOption('empty_value')) {
$this->choices = array('' => 
$this->getOption('empty_value')) + $this->choices;
}

?



-- 
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] [symfony2] init:bundle

2011-02-11 Thread wickass
I just created an new bundle using the console init:bundle command.
Works like a charm for setting up a skeleton structure for a new
bundle, however I noticed that in the config/ folder it only generated
a routing.xml no .php and no .yml.

Is there a setting somewhere where I can specify which format / 's
should be generated by default ?


-- 
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] Two Foreign keys refferencing same primary key

2011-02-11 Thread Ali
HI Guys i am new to symfony and i have a simple data model.

There is a Team model and Match model , and a match is played by two
teams i want to store the date and venue which is another Model Venue

my schema is as follows

Team:
  actAs: { Timestampable: ~ }
  columns:
title: { type: string(255), notnull: true }
is_active: { type: boolean, notnull: true, default: false }

TeamMatch:
  actAs: { Timestampable: ~ }
  columns:
venue_id: { type: integer, notnull: true }
team1_id: { type: integer, notnull: true }
team2_id: { type: integer, notnull: true }
held_at: { type: datetime, notnull: true }
is_active: { type: boolean, notnull: true, default: false }
  relations:
Venue: { onDelete: CASCADE, local:venue_id, foreign: id }
Team: { onDelete: CASCADE, local: team1_id, foreign: id }
Team: { onDelete: CASCADE, local: team2_id, foreign: id }

Venue:
  actAs: { Timestampable: ~ }
  columns:
title: { type: string(255), notnull: true }
country: { type: string(255), notnull: true }
city: { type: string(255), notnull: true }
description: { type: text, notnull: true }
is_active: { type: boolean, notnull: true, default: false }

but my cmatch model only reference team1 and dont show team2 in the
class, and not even in the forms.
Am i doing it right , if not whats the solutions
Regards
MHS

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