[symfony-users] Re: notice: serialize() __sleep

2011-04-18 Thread Fabien Potencier


On Apr 16, 4:46 am, Luis Cordova cordo...@gmail.com wrote:
 I am getting a notice:

 Notice: serialize(): sessionverses returned as member variable from
 __sleep() but does not exist in
 /home/cordoval/sites-2/memorizescripture/vendor/symfony/src/Symfony/Compone 
 nt/Security/Core/Authentication/Token/AbstractToken.php
 on line 136 Notice: serialize(): chapter returned as member variable
 from __sleep() but does not exist in
 /home/cordoval/sites-2/memorizescripture/vendor/symfony/src/Symfony/Compone 
 nt/Security/Core/Authentication/Token/AbstractToken.php
 on line 136

 I found :
 To summerize: in a given class hierarchy in which parent classes
 contain private member variables, those variables are serialized when
 __sleep() is not defined. However, once __sleep() is defined, there is
 no way to make those private member variables serialized as well. From
 that point on, serialization is performed from the visibility scope of
 the subclass. It is particularly important to note this little quirk
 when designing base classes that their derivables may be serialized,
 or when subclassing an external library class.

 However my question is how do i avoid this, since this is in twig that
 I am doing lazy loading with user then user.sessions, then
 session.sessionverses, then sessionverse.verse.Chapter etc

 Can someone please hint? thanks

Have you tried to use the Serialize interface instead. In the
serialize()/unserialize() methods, you can do pretty much what you
need
to serialize/unserialize your objects.

Fabien


 Luis

-- 
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] Proper way of using a logger in Symfony2?

2011-04-18 Thread Jordi Boggiano
On 18.04.2011 05:38, JC wrote:
 I couldn't find references on the proper use to integrate a logger in
 my code.
 I tried the following inside a controller, but I didn't see any output
 in the log file.
 
 Any ideas?
 
 public function loginAction()
 {
   $logger = $this-get('logger');
 .
   $logger-info('loginName=');
   $logger-log('loginName=');
   
 }

Sorry that was a little omission, for now you should be able to use
$this-get('monolog.logger') to get what you want.

I created a pull request [1] to fix this, so 'logger' should also work
in the next preview release.

[1] https://github.com/symfony/symfony/pull/578

Cheers

-- 
Jordi Boggiano
@seldaek :: http://seld.be/

-- 
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: ajax in symfony 2

2011-04-18 Thread symfonyMan
Hello Oscar,

thanks you for the replays..

can you show me an exemple of sending an ajax request with jquery ??

i tried a lot of things (.ajax(), .get()...) but il my ajaxAction,
this test is skipped : (not an XMLHttpRequest())
if ($this-container-get('request')-isXmlHttpRequest())
{
//some code here
}

i want to validate the email input (onblur)

thanks ;)


On 16 avr, 19:20, oscar balladares liebegr...@gmail.com wrote:
 If you just want to return a simple string you probably want to:

 # Controllers definition {
 #some logic here

 return new Response(/bThere are some errors on this field/b);

 ...

 You must import the namespace for Response :

 use Symfony\Component\HttpFoundation\Response;

 2011/4/15 symfonyMan ezziani.cha...@gmail.com

  Hello,

  thanks for all this responses.

  the controller must return a template ?

  Me, I need ajax just for validate email, and print ok next to the
  email field...

  sorry i have a bad english :)

  thnaks

  On 15 avr, 00:12, oscar balladares liebegr...@gmail.com wrote:
   The controller should return a template response, a common template
  (without
   inheritance of course)

   2011/4/14 oscar balladares liebegr...@gmail.com

With JQuery you can request Marc's controller's route. That should do
  the
trick.

2011/4/14 Marc MacLeod marbe...@gmail.com

In your controller:

   public function fooAction()
   {
       // Is this an ajax request?
       if ($this-container-get('request')-isXmlHttpRequest())
       {
           // do stuff and return ajax content
       }

       // return normal response
    }

On Apr 13, 5:16 am, symfonyMan ezziani.cha...@gmail.com wrote:
 hello,

 could somebody show me an example using ajax in symfony 2 ??

 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

  --
  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] Proper way of using a logger in Symfony2?

2011-04-18 Thread Jordi Boggiano
On Mon, Apr 18, 2011 at 9:30 AM, Jordi Boggiano j.boggi...@seld.be wrote:
 On 18.04.2011 05:38, JC wrote:
 I couldn't find references on the proper use to integrate a logger in
 my code.
 I tried the following inside a controller, but I didn't see any output
 in the log file.

 Any ideas?

     public function loginAction()
     {
       $logger = $this-get('logger');
                 .
       $logger-info('loginName=');
       $logger-log('loginName=');
       
     }

 Sorry that was a little omission, for now you should be able to use
 $this-get('monolog.logger') to get what you want.

 I created a pull request [1] to fix this, so 'logger' should also work
 in the next preview release.

It's been merged, so now you should use logger and there is no more
monolog.logger. If you are using the preview release, just remember to
change that when you update to the next one (that hopefully comes
later today).

Cheers

-- 
Jordi Boggiano
@seldaek :: http://seld.be/

-- 
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: notice: serialize() __sleep

2011-04-18 Thread Luis Cordova
hi Fabien, all

thanks for the suggestion, but this speaks about a class on the
Security/Core/Authentication/Token/AbstractToken.php symfony code
or on my class? and if my class i guess the one that has member that variable?

I will try but was not really sure since there is AbstractToken.php I
have no control on that...

I feel like I am doing this to find where the error really is right?
since it is going to serialize probably a stack trace as your post
here suggest, but I am not using sf1.x but rather sf2.
http://fabien.potencier.org/article/9/php-serialization-stack-traces-and-exceptions

On Mon, Apr 18, 2011 at 1:46 AM, Fabien Potencier
fabien.potenc...@gmail.com wrote:


 On Apr 16, 4:46 am, Luis Cordova cordo...@gmail.com wrote:
 I am getting a notice:

 Notice: serialize(): sessionverses returned as member variable from
 __sleep() but does not exist in
 /home/cordoval/sites-2/memorizescripture/vendor/symfony/src/Symfony/Compone 
 nt/Security/Core/Authentication/Token/AbstractToken.php
 on line 136 Notice: serialize(): chapter returned as member variable
 from __sleep() but does not exist in
 /home/cordoval/sites-2/memorizescripture/vendor/symfony/src/Symfony/Compone 
 nt/Security/Core/Authentication/Token/AbstractToken.php
 on line 136

 I found :
 To summerize: in a given class hierarchy in which parent classes
 contain private member variables, those variables are serialized when
 __sleep() is not defined. However, once __sleep() is defined, there is
 no way to make those private member variables serialized as well. From
 that point on, serialization is performed from the visibility scope of
 the subclass. It is particularly important to note this little quirk
 when designing base classes that their derivables may be serialized,
 or when subclassing an external library class.

 However my question is how do i avoid this, since this is in twig that
 I am doing lazy loading with user then user.sessions, then
 session.sessionverses, then sessionverse.verse.Chapter etc

 Can someone please hint? thanks

 Have you tried to use the Serialize interface instead. In the
 serialize()/unserialize() methods, you can do pretty much what you
 need
 to serialize/unserialize your objects.

 Fabien


 Luis

 --
 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] sfValidatorChoice and String convertion error

2011-04-18 Thread filip11
Hi all,

I was browsing the internet but I can`t find the answer for my problem
anywhere. A have my form:

$widget-setLabel('Odbiorcy');
$this-setWidget('receivers', $widget);
$validator = new
sfValidatorChoice(array('choices'=array_keys($choices),'multiple' =
true), array());
$this-setValidator('receivers', $validator);

$choices is an associative table. Form is rendering very nice but when
i am trying to send the form i am receiving the following error:
Catchable fatal error: Object of class sfValidatorChoice could not be
converted to string in ... on line 34

Thx in advance for any suggestions and sorry for my English because
i`ts not my native language. And hi everybody because it is my first
post here :)

-- 
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: [Symfon2] Twig vs PHP

2011-04-18 Thread ejosvp
TWIG helps a lot, specially for teams with designers which are not involved 
with PHP

-- 
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] Calling a PHP Function

2011-04-18 Thread Josher
Hey All,
Having fun using symfony2!

In my controller, I'm doing the following:
$doc = new DOMDocument();

However, symfony2 comes up with:
Fatal error: Class 'Acme\DemoBundle\Controller\DOMDocument' not found
in

As you can see, it thinks that DOMDocument is apart of symfony2, and
it is really a part of PHP.

How do I call these type of functions correctly?

Thanks,
Josh

-- 
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] jobeet tutorial http://localhost:8080/frontend_dev.php/job

2011-04-18 Thread voidpointer
Moi,

I am trying to work through the jobeet tutorial. I have got to day 3
and try to use the url posted in the title.

The layout is rubbish, there are no images etc. Here is a snippet from
the top of that page:

!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en
  head
meta http-equiv=Content-Type content=text/html;
charset=utf-8 /
title/title
link rel=shortcut icon href=/favicon.ico /
link rel=stylesheet type=text/css media=screen href=/css/
main.css /
  style type=text/css#sfWebDebug {   padding: 0;   margin:
0;   font-family: Arial, sans-serif... (and on and on and on)

The file /css/main.css is empty. I see the debug icons and so on at
the top right of the page.

Up till now, all the pages from the tutorial have been shown as per
the docs. What's happening now?

Cheers - VP

-- 
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: Strange distribution problem (PR10, PR11)

2011-04-18 Thread mysth
Hello,
I had the same problem but try to unpack the tar.gz version and then
unpack the .zip version.
Say 'Merge..' when it asks to..
It works for me...It's not a beautiful solution but it's better than
nothing until they correct this problem.
Good luck ;)

-- 
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] validation of runtime generated object properties / dynamic forms

2011-04-18 Thread Holger
Hi Bernhard,

thanks for the quick reply! I'll have a look into it.
Regards,
Holger

On 17 Apr., 18:09, Bernhard Schussek bschus...@gmail.com wrote:
 Hi Holger,

 You can use the Callback constraint for this purpose. You can see an
 example of its usage in 
 DelegatingValidator::validateFormData():https://github.com/symfony/symfony/blob/form/src/Symfony/Component/Fo...

 What is necessary for this approach:
 - a common base class for your domain objects
 - a callback method either in that base class or a static callback
 method somewhere else
 - a Callback constraint for this base class 
 (seehttps://github.com/symfony/symfony/blob/form/src/Symfony/Component/Fo...
 for an example - if you use a method in your base class, you can
 simply provide the name of that method instead of the {Class, Method}
 array)

 Bernhard

-- 
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 S2 blog is not being updated!!!

2011-04-18 Thread Javier Eguiluz
The blog has already been updated with the latest *a week of symfony*posts. 
Thanks for noticing it and sorry for any inconvenience.

-- 
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] Calling a PHP Function

2011-04-18 Thread Gustavo Adrian
$doc = new \DOMDocument();

By default, if you try to create an instance of a class which is not fully
qualified (in your case just DOMDocument) PHP will look for the class on
the current namespace (Acme\DemoBundle\Controller in your case).

More info: http://www.php.net/manual/en/language.namespaces.basics.php

2011/4/17 Josher joshuatayl...@gmail.com

 Hey All,
 Having fun using symfony2!

 In my controller, I'm doing the following:
 $doc = new DOMDocument();

 However, symfony2 comes up with:
 Fatal error: Class 'Acme\DemoBundle\Controller\DOMDocument' not found
 in

 As you can see, it thinks that DOMDocument is apart of symfony2, and
 it is really a part of PHP.

 How do I call these type of functions correctly?

 Thanks,
 Josh

 --
 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] Form objects not escaped

2011-04-18 Thread Rytis Daugirdas
Hello,

I've noticed that form objects are not escaped in templates.

$this-form = new MyObjectForm(); # won't be escaped

Other objects ARE escaped.

$this-myObject = $this-form-getObject(); # will be escaped

This can easily be checked using get_class() in a template.

Anyone could explain this behaviour?

Regards,
Rytis

-- 
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: Strange distribution problem (PR10, PR11)

2011-04-18 Thread Dmitry Bykadorov
Yes, ZIP version unpack successfully... Strange thing )



On 18 апр, 12:33, mysth peramo.lio...@gmail.com wrote:
 Hello,
 I had the same problem but try to unpack the tar.gz version and then
 unpack the .zip version.
 Say 'Merge..' when it asks to..
 It works for me...It's not a beautiful solution but it's better than
 nothing until they correct this problem.
 Good luck ;)

-- 
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: Validation propagating to related entities in Symfony2

2011-04-18 Thread whynotmatt
On a web form, for optimization reasons, we don't need to submit all
fields from the referenced entity, only the entity id. So yes, turning
off validation on referenced entities and only validating the
referenced id seems like the best solution to me.

With the cascading validation as it is now, how would that work where
entity A is related to entity B that his related to entity C? Am I
correct in assuming that for this flow to work correctly, all fields
of entities A, B and C must be validated in order for validation of A
to pass?

I doubt I am the first one to use this use case of including a
referenced entity in a web form. It is very common. How are others
addressing this issue?


Matt



On Apr 17, 4:06 pm, Bernhard Schussek bschus...@gmail.com wrote:
 2011/4/17 Dennis Jacobfeuerborn djacobfeuerb...@gmail.com:

  I think the reference should be validated but not necessarily the whole
  entity the reference points to.

 The reference would be validated anyway because the reference is a
 property of the main object.

 Bernhard

-- 
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: notice: serialize() __sleep

2011-04-18 Thread Luis Cordova
please somebody help me,
all my code is in https://github.com/cordoval/Memorize-Scripture-2
I have tried several things, not even serializing the errors would go away
rather they will get worse

can someone take a look at this please? appreciate it

 Notice: serialize(): sessionverses returned as member variable from
 __sleep() but does not exist in
 /home/cordoval/sites-2/memorizescripture/vendor/symfony/src/Symfony/Compone 
 nt/Security/Core/Authentication/Token/AbstractToken.php
 on line 136

check below

On Mon, Apr 18, 2011 at 8:01 AM, Luis Cordova cordo...@gmail.com wrote:
 hi Fabien, all

 thanks for the suggestion, but this speaks about a class on the
 Security/Core/Authentication/Token/AbstractToken.php symfony code
 or on my class? and if my class i guess the one that has member that variable?

 I will try but was not really sure since there is AbstractToken.php I
 have no control on that...

 I feel like I am doing this to find where the error really is right?
 since it is going to serialize probably a stack trace as your post
 here suggest, but I am not using sf1.x but rather sf2.
 http://fabien.potencier.org/article/9/php-serialization-stack-traces-and-exceptions

 On Mon, Apr 18, 2011 at 1:46 AM, Fabien Potencier
 fabien.potenc...@gmail.com wrote:


 On Apr 16, 4:46 am, Luis Cordova cordo...@gmail.com wrote:
 I am getting a notice:

 Notice: serialize(): sessionverses returned as member variable from
 __sleep() but does not exist in
 /home/cordoval/sites-2/memorizescripture/vendor/symfony/src/Symfony/Compone 
 nt/Security/Core/Authentication/Token/AbstractToken.php
 on line 136 Notice: serialize(): chapter returned as member variable
 from __sleep() but does not exist in
 /home/cordoval/sites-2/memorizescripture/vendor/symfony/src/Symfony/Compone 
 nt/Security/Core/Authentication/Token/AbstractToken.php
 on line 136

 I found :
 To summerize: in a given class hierarchy in which parent classes
 contain private member variables, those variables are serialized when
 __sleep() is not defined. However, once __sleep() is defined, there is
 no way to make those private member variables serialized as well. From
 that point on, serialization is performed from the visibility scope of
 the subclass. It is particularly important to note this little quirk
 when designing base classes that their derivables may be serialized,
 or when subclassing an external library class.

 However my question is how do i avoid this, since this is in twig that
 I am doing lazy loading with user then user.sessions, then
 session.sessionverses, then sessionverse.verse.Chapter etc

 Can someone please hint? thanks

 Have you tried to use the Serialize interface instead. In the
 serialize()/unserialize() methods, you can do pretty much what you
 need
 to serialize/unserialize your objects.

 Fabien


 Luis

 --
 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] Validation propagating to related entities in Symfony2

2011-04-18 Thread Dennis Jacobfeuerborn
Hi,
I'd strongly favor not doing such a recursive validation by default. When 
I create a form 99% of the time I only want to validate the data submitted 
in fact I can't even think of a case where I'd want to do a deeper 
validation right now. 
Checking the city when you only submit a user seems beyond the scope of what 
the validator should bother with.

Regards,
  Dennis

On Sunday, April 17, 2011 10:36:43 AM UTC+2, Bernhard Schussek wrote:

 Hi Matt,

 The problem is that by default the data of each field is validated. For the 
 entity field this is the selected entity. Does it make sense to generally 
 disable validation for entity fields?

 Bernhard

 Am 16.04.2011 21:38 schrieb Matt Johnston ma...@mjohnston.com:

 I have two entities that are joined by a ManyToOne relation. Each
 entity has it's own set of validators. When I submit a form for the
 one object, the related object is also being validated. Is there any
 way that the related object can not be validated?

 Here is an example, I am using Symfony2 PR11:

 class User {
 ...
 /**
 * @orm:Column(type=string,nullable=false, unique=true)
 * @assert:NotBlank()
 */
 protected $name;

 /**
 * @orm:ManyToOne(targetEntity=City)
 * @orm:JoinColumn(name=city_id,
 referencedColumnName=id,nullable=false)
 * @assert:NotNull()
 */
 protected $city;

 }

 class City {
 ...
 /**
 * @orm:Column(type=string,nullable=false)
 * @assert:NotBlank()
 */
 protected $name;

 }

 In my UserForm configure() I add a reference to the City:

 $this-add(new EntityChoiceField('city', array(
  'em' = $em,
  'class' = 'MyBundle\Entity\City',
  'property' = 'name'
 )));

 The form displays correctly and creates a drop down list of all
 existing cities pulled from the database. When I submit my UserForm
 and validate it, I get errors that the city is missing a name. Why is
 the validation propagating down to the related object? All the user object 
 needs to
 know is if the city id is present and it doesn't need all the
 additional fields for the city.

 -- 
 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 symfon...@googlegroups.com
 To unsubscribe from this group, send email to
 symfony-user...@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] [Symfony2] PR11, DemoBundle error 'The controller must return a response ([array]() given)'

2011-04-18 Thread oscar balladares
Hi, I've just downloaded the PR11.

When running the demo (when clicking the 'run the demo' button link) an
error is trhown: The controller must return a response ([array]() given)

Looking at the controller I found:

/**
 * @extra:Route(/, name=_demo)
 * @extra:Template()
 */
public function indexAction()
{
return array();
}

Which seems actually to be the issue, the returning array(),

Is  PR11 demoBundle suposed to not work??? [?]

-- 
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
360.gif

[symfony-users] Re: Strange distribution problem (PR10, PR11)

2011-04-18 Thread Carl
Very bizarre. I use 7-Zip exclusively in Windows 7 and I didn't have any 
issues unpacking the tar.gz version. Maybe it's a WinRAR issue?

-- 
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] PR11, DemoBundle error 'The controller must return a response ([array]() given)'

2011-04-18 Thread Carl
I can safely say that it isn't supposed to be returning an array, unless 
it's intended to show that you can't do that kind of thing. All actions have 
to return a response. And an array isn't a valid response. If you change 
that to return statement to return new Response(''); it should work. It 
won't do anything interesting but it shouldn't result in an exception being 
thrown. Make sure to include a use statement so PHP knows where to find the 
Response class.

-- 
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: notice: serialize() __sleep

2011-04-18 Thread Luis Cordova
ok finally I made inroads with the help of several people thank you guys!

and now I got the notices gone on real browser test however they are failing
for testing forms apparently? I was told the form_login needs to be
switched to http_basic
as shown in here
http://www.dobervich.com/2011/03/28/symfony2-blog-application-tutorial-part-v-2-testing-secure-pages/

so basically now I am trying to get the settings right for the FOS
UserBundle to test on http_basic
mode so if you are a FOS UserBundle developer please let me know about
that info, I would greatly appreciate it.

nonetheless i still continue to wonder why serialize and unserialize
methods were needed, and what parameters are really required in terms
of my design, I was told the needed to rebuild your object, however
hmm, in what situation this rebuilding is happening for me to figure
that out?

Any clarifications are welcome, thanks!

On Mon, Apr 18, 2011 at 2:08 PM, Luis Cordova cordo...@gmail.com wrote:
 please somebody help me,
 all my code is in https://github.com/cordoval/Memorize-Scripture-2
 I have tried several things, not even serializing the errors would go away
 rather they will get worse

 can someone take a look at this please? appreciate it

 Notice: serialize(): sessionverses returned as member variable from
 __sleep() but does not exist in
 /home/cordoval/sites-2/memorizescripture/vendor/symfony/src/Symfony/Compone
  nt/Security/Core/Authentication/Token/AbstractToken.php
 on line 136

 check below

 On Mon, Apr 18, 2011 at 8:01 AM, Luis Cordova cordo...@gmail.com wrote:
 hi Fabien, all

 thanks for the suggestion, but this speaks about a class on the
 Security/Core/Authentication/Token/AbstractToken.php symfony code
 or on my class? and if my class i guess the one that has member that 
 variable?

 I will try but was not really sure since there is AbstractToken.php I
 have no control on that...

 I feel like I am doing this to find where the error really is right?
 since it is going to serialize probably a stack trace as your post
 here suggest, but I am not using sf1.x but rather sf2.
 http://fabien.potencier.org/article/9/php-serialization-stack-traces-and-exceptions

 On Mon, Apr 18, 2011 at 1:46 AM, Fabien Potencier
 fabien.potenc...@gmail.com wrote:


 On Apr 16, 4:46 am, Luis Cordova cordo...@gmail.com wrote:
 I am getting a notice:

 Notice: serialize(): sessionverses returned as member variable from
 __sleep() but does not exist in
 /home/cordoval/sites-2/memorizescripture/vendor/symfony/src/Symfony/Compone
  nt/Security/Core/Authentication/Token/AbstractToken.php
 on line 136 Notice: serialize(): chapter returned as member variable
 from __sleep() but does not exist in
 /home/cordoval/sites-2/memorizescripture/vendor/symfony/src/Symfony/Compone
  nt/Security/Core/Authentication/Token/AbstractToken.php
 on line 136

 I found :
 To summerize: in a given class hierarchy in which parent classes
 contain private member variables, those variables are serialized when
 __sleep() is not defined. However, once __sleep() is defined, there is
 no way to make those private member variables serialized as well. From
 that point on, serialization is performed from the visibility scope of
 the subclass. It is particularly important to note this little quirk
 when designing base classes that their derivables may be serialized,
 or when subclassing an external library class.

 However my question is how do i avoid this, since this is in twig that
 I am doing lazy loading with user then user.sessions, then
 session.sessionverses, then sessionverse.verse.Chapter etc

 Can someone please hint? thanks

 Have you tried to use the Serialize interface instead. In the
 serialize()/unserialize() methods, you can do pretty much what you
 need
 to serialize/unserialize your objects.

 Fabien


 Luis

 --
 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: notice: serialize() __sleep

2011-04-18 Thread cordoval
results, findings and suggestions:

suggesstion:

- to implement on sf2 test1 mode and test2 mode, test1 mode generates
proxies on --env=test so for development, test2 mode is production

findings:

- form login test works as Fabien puts it on a tweeter, thanks Fabien!
- fos userbundle has broken the labels on the login form for some
reason check this please

results:

- got rid of my warnings and tests are passing

doubts:

- why serializable had to be implemented on my class for this to work?


On Apr 18, 5:56 pm, Luis Cordova cordo...@gmail.com wrote:
 ok finally I made inroads with the help of several people thank you guys!

 and now I got the notices gone on real browser test however they are failing
 for testing forms apparently? I was told the form_login needs to be
 switched to http_basic
 as shown in 
 herehttp://www.dobervich.com/2011/03/28/symfony2-blog-application-tutoria...

 so basically now I am trying to get the settings right for the FOS
 UserBundle to test on http_basic
 mode so if you are a FOS UserBundle developer please let me know about
 that info, I would greatly appreciate it.

 nonetheless i still continue to wonder why serialize and unserialize
 methods were needed, and what parameters are really required in terms
 of my design, I was told the needed to rebuild your object, however
 hmm, in what situation this rebuilding is happening for me to figure
 that out?

 Any clarifications are welcome, thanks!







 On Mon, Apr 18, 2011 at 2:08 PM, Luis Cordova cordo...@gmail.com wrote:
  please somebody help me,
  all my code is inhttps://github.com/cordoval/Memorize-Scripture-2
  I have tried several things, not even serializing the errors would go away
  rather they will get worse

  can someone take a look at this please? appreciate it

  Notice: serialize(): sessionverses returned as member variable from
  __sleep() but does not exist in
  /home/cordoval/sites-2/memorizescripture/vendor/symfony/src/Symfony/Compone
   nt/Security/Core/Authentication/Token/AbstractToken.php
  on line 136

  check below

  On Mon, Apr 18, 2011 at 8:01 AM, Luis Cordova cordo...@gmail.com wrote:
  hi Fabien, all

  thanks for the suggestion, but this speaks about a class on the
  Security/Core/Authentication/Token/AbstractToken.php symfony code
  or on my class? and if my class i guess the one that has member that 
  variable?

  I will try but was not really sure since there is AbstractToken.php I
  have no control on that...

  I feel like I am doing this to find where the error really is right?
  since it is going to serialize probably a stack trace as your post
  here suggest, but I am not using sf1.x but rather sf2.
 http://fabien.potencier.org/article/9/php-serialization-stack-traces-...

  On Mon, Apr 18, 2011 at 1:46 AM, Fabien Potencier
  fabien.potenc...@gmail.com wrote:

  On Apr 16, 4:46 am, Luis Cordova cordo...@gmail.com wrote:
  I am getting a notice:

  Notice: serialize(): sessionverses returned as member variable from
  __sleep() but does not exist in
  /home/cordoval/sites-2/memorizescripture/vendor/symfony/src/Symfony/Compone
   nt/Security/Core/Authentication/Token/AbstractToken.php
  on line 136 Notice: serialize(): chapter returned as member variable
  from __sleep() but does not exist in
  /home/cordoval/sites-2/memorizescripture/vendor/symfony/src/Symfony/Compone
   nt/Security/Core/Authentication/Token/AbstractToken.php
  on line 136

  I found :
  To summerize: in a given class hierarchy in which parent classes
  contain private member variables, those variables are serialized when
  __sleep() is not defined. However, once __sleep() is defined, there is
  no way to make those private member variables serialized as well. From
  that point on, serialization is performed from the visibility scope of
  the subclass. It is particularly important to note this little quirk
  when designing base classes that their derivables may be serialized,
  or when subclassing an external library class.

  However my question is how do i avoid this, since this is in twig that
  I am doing lazy loading with user then user.sessions, then
  session.sessionverses, then sessionverse.verse.Chapter etc

  Can someone please hint? thanks

  Have you tried to use the Serialize interface instead. In the
  serialize()/unserialize() methods, you can do pretty much what you
  need
  to serialize/unserialize your objects.

  Fabien

  Luis

  --
  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-users] Aw: jobeet tutorial http://localhost:8080/frontend_dev.php/job

2011-04-18 Thread Sebastian Göttschkes
Hi there,

would you mind showing the apache vhost you added (I asume you're using 
apache)? I would guess the default directory isn't set correctly but the sf 
shortcut is.

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