[symfony-users] sfGuardPlugin Redirect Problem

2011-03-05 Thread drew
I am stuck on a problem with sfGuardPlugin. It keeps telling me the
page can't redirect. I have looked through htaccess, yml files, etc...
It was working before. It started acting up suddenly. I am pretty
dissapointed with this plugin. I can hardly find any documentation on
it that's useful.

-- 
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: Generating repositories

2011-03-05 Thread Lideln
Hi there !

Ok I succeeded in creating a Repository using your help, and using the
annotation type, and modifying the Entities by hand to prepend with
orm:.
But it is not convenient, and moreover the generated entities are not
complete and are overwrited each time (and not merged, so I lose my
modifications).

I'd rather stick with the yml generation.
I use :
php app/console doctrine:mapping:import MainBundle yml
Then :
php app/console doctrine:generate:entities MainBundle
And :
php app/console doctrine:generate:repositories MainBundle

But that last command is stubborn and keeps skipping my Entities. I
think I have to modify the generated yml files (Resources/config/
doctrine/metadata/orm/Ratethestar.MainBundle.Entity.Member.dcm.yml),
but I could not find tips either in Symfony or Doctrine online
tutorials.

If anyone knows how to modify my yml file in order not to be skipped
during the generate:repositories command, I would love that :)

Here is a sample generated yml file :
Ratethestar\MainBundle\Entity\Member:
  type: entity
  table: member
  fields:
  // and so on


Thanks to all !


On 24 fév, 20:30, olimination oliminat...@gmail.com wrote:
 Hi,

 I'm not an expert too, but I have managed to configure a working
 custom Repository class for my entity.
 My main problem was, that I have used a incorrect annotation like
 this:

 /**
  * @orm:Entity
  * @entity(repositoryClass=Laboda\LabodaAdminBundle\Entity
 \WishRepository)
  */
 class MyEntityName
 { ...

 The problem was that I have used only @entity(repositoryClass=...)
 instead of @orm:entity(repositoryClass...)

 And for a correct entity configuration you have to set an id or
 primary key field, something like that(in annotation form):

 /**
  * @orm:Entity
  * @orm:entity(repositoryClass=MyBundle\Entity
 \MyEntityRepositoryClass)
  */
 class MyEntityName
 {
     /**
      * @orm:Id
      * @orm:Column(type=integer)
      * @orm:GeneratedValue(strategy=IDENTITY)
      */
     protected $id;
 ...

 greets,
 Oli

 On Feb 24, 8:13 pm, taidehuone taidehu...@gmail.com wrote:

  I'm no expert in any way but since I have working repositories I might as
  well drop a line or two on this.

  Personally I have never called the doctrine:generate:repositories task. I
  have created the repository files and entity files by hand so that the file
  structure looks like this. I don't know if this follows the best practices
  because I might be outdated on that, but it works with the latest master
  branch version of symfony 2.

  src/Warbler/AccountBundle/Entity/Account.php
  src/Warbler/AccountBundle/Entity/AccountRepository.php
  src/Warbler/AccountBundle/Entity/OrganizationAccount.php
  src/Warbler/AccountBundle/Entity/OrganizationAccountRepository.php

  My Entity definition starts like this:

  ?php
  namespace Warbler\AccountBundle\Entity;
  use Symfony\Component\Security\Core\User\AccountInterface;
  use Symfony\Component\Security\Core\User\AdvancedAccountInterface;

  /**
   *
  @orm:Entity(repositoryClass=Warbler\AccountBundle\Entity\AccountRepository­)
   */
  class Account implements AdvancedAccountInterface
  {

  }

  And my Repository definition starts like this:

  ?php
  namespace Warbler\AccountBundle\Entity;
  use Doctrine\ORM\EntityRepository;

  class AccountRepository extends EntityRepository
  {

  }

-- 
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 default Locale recommended implementation

2011-03-05 Thread Diego
Hi all,

We are dealing with enabling localization in an almost finished
Symfony2 application.

S2 uses php's intl extension to manage everything that is locale-
dependent. As such, the DateTimeField uses php's \Locale::getDefault()
to obtain the current locale and transform the text input from the
form to a DateTime object.

What we want is to set this default value application-wide. For this
we could just add to the boot() method of the bundle the following to
obtain the locale from the session:

class AppBundle extends Bundle
{
public function boot()
{
$container = $this-container;

// Set default PHP locale to match session locale
if ($container-has('session')) {
$session = $container-get('session');
\Locale::setDefault($session-getLocale());
}
}
}

The only thing to figure out would be if somewhere in the app the
$session-setLocale($someLocale) is called, how would the
Locale::setDefault()  would be updated to the new default ? I couldn't
find any symfony2 event that fires when the location is changed. The
best thing I can think of doing this is to make sure the location
changes just in a User object that will be responsible of updating
both, the session locale and the php's default locale via
Locale::setDefault().

Any ideas?

Thanks for reading!



-- 
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 change default sfValidatorString max length message?

2011-03-05 Thread Ben
inside your form's configure method, you need to set the error message
for each error on each validator

e.g.

$this-getValidator('name')-setMessage('max_length', 'Your text was
too long, please keep it short');

On Jan 18, 5:47 pm, Basil Hussain basil.huss...@experience-
engine.co.uk wrote:
 I have a couple of forms with many sfValidatorString validators on
 them. The default 'max_length' error message ('%value% is too long
 (%max_length% characters max).') is really not suitable to the way my
 forms are laid out in the HTML, because repeating the too-long value
 within the message throws everything out of alignment.

 So, I want to set a shorter message (e.g. 'Too long, %max_length%
 characters max'), but I don't want to have to add the same message
 array repeatedly for every single sfValidatorString instance on these
 forms - each has 20 of them!

 Is there a way to set a default 'max_length' message once for every
 sfValidatorString on a form?

-- 
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: sfGuardPlugin Redirect Problem

2011-03-05 Thread catchamonkey
Hi Drew,

I think it is one of the most used plugins around so we should be able to 
help you here.
Can you provide some more information about where you are being told it 
can't redirect?

Can you paste the stack trace?

Chris

-- 
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] Functional Test (Mailer) Problem with Quoted-Printable Line Breaks (sf 1.4)

2011-03-05 Thread eric le bihen
Hi Matt,

 On 4 Mar 2011, at 21:36, I wrote:
 
 with('mailer')-begin()-
  checkBody('/A new Sentence has been submitted at uniquesentence.com/')-
 
 But this test fails, as the body doesn't match. If I add a debug(), my 
 dumped mail (the text/plain part) looks like this:
 
 
 I've done some more investigation, and I think I know more about what my 
 problem is now, though I still don't know how to fix it:
 
 It turns out that in sfTesterMailer's checkBody() function, 
 $this-message-getBody() is returning nothing. Therefore there's nothing to 
 check my regular expression against, and the test will always fail.
 
 Is this because I'm using multipart mails?

Correct. The sfTesterMailer checkBody does not check for message mime parts.

 I'm sending text/html and text/plain, in what I thought was a pretty normal 
 way:
 
 $message = Swift_Message::newInstance()
   -setSubject('New Sentence Submitted')
   -setFrom(array($mail_config['from_address'] = 
 $mail_config['from_name']))
   -setTo($mail_config['curator_address']);
 
 $message-attach(new 
 Swift_MimePart($this-getPartial('submitted_mail_html', $mail_fields), 
 'text/html'));
 $message-attach(new 
 Swift_MimePart($this-getPartial('submitted_mail_text', $mail_fields), 
 'text/plain'));
 
 $this-getMailer()-send($message);
 
 ...but are these both ending up, technically, as attachments? If so, is 
 there any way of testing the email contents in Symfony?
 
 Thanks,
 
 Matt

You could create a sfTesterMailerMultipart class that would extends the 
sfTesterMailer

You would need to iterate through the children of the message object to get the 
mime part you are interested in.

something like...

class sfTesterMailerMultipart extends sfTesterMailer
{
 public function checkBodyMultipart ($value, $contentType = 'text/plain')
 {
   foreach ($this-message-getChildren() as $key = $child)
   {
 if ($contentType === $child-getHeaders()-get('content-type')-getValue())
 {
   // Copied from the sfTesterMail::checkBody()
   $body = $child-getBody();
   $ok = false;
   $regex = false;
   $mustMatch = true;
   if (preg_match('/^(!)?([^a-zA-Z0-9]).+?\\2[ims]?$/', $value, $match))
   {
...

hopes that can helps.

Regards,
Eric

-- 
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] dynamic route

2011-03-05 Thread Vikos
Hello.

I use symfony 1.4.

A want to make a dynamic length route.

There's a list. This list has different templates. There is ordering
option and direction for ordering.

Is it possilbe to make url like this (is one routing rule)?

task_index:
  url: /activity/:id/tasks/:type/:order/:desc
  class:   sfDoctrineRoute
  options: { model: Activity, type: object }
  param:   { module: task, action: index, type: List, order: ~, desc:
~ }
  requirements:
id: \d+
sf_method: [get]
type: ( List| Details | Calendar  )
order: ( Title | Label | time | Assign )
desc: (  asc | desc )

This rule works when I use url_for('task_index', array( . )).

I want to define different length like:
mysite.com/activity/1/tasks
mysite.com/activity/1/tasks/Details
mysite.com/activity/1/tasks/Details/Label/
mysite.com/activity/1/tasks/Details/Label/desc


is it possible?

Thanks the answers!

Vikos

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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


[symfony-users] [Symfony 1.4] Deploying on Windows

2011-03-05 Thread Sebastian Göttschkes
Hi,

I'm currently having issues deploying symfony from my Windows machine as 
rsync breaks file/folder permissions. I wrote a shell-script which is 
setting the correct permissions and groups again but I'm not sure about the 
best way using the script. I find it complicated to log in via ssh after the 
deploy is done and run the script manually.

I know, this is not a symfony issue, but I figured since people here might 
use rsync with symfony, they'll have found a way to work around this.

Regards,
Sebastian

-- 
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] [symfony 1.4] Retrieving Value from FormField

2011-03-05 Thread Sebastian Göttschkes
I thought of this, but for some reason it isn't working. The input name is 
book_order[book_amount] and I tried $form-getValue('book_amount'), 
$form-getValue('book_order[book_amount]') and 
$form-getValue('bookAmount').

On the other hand, $form['book_amount']-getValue() is working as expected. 
Am I doing anything wrong or is this symfony behaviour?

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