Couldnt figure out how to bootstrap the validation Annotation stuff
for a unit test, I can reproduce minimally like this however:
# Controller
<?php
namespace yProx\CrmBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use yProx\CrmBundle\Entity\Note;
use Symfony\Component\Form\Form;
use Symfony\Component\Form\TextField;
use Symfony\Component\Controller\Controller;
class AdminNoteController extends Controller
{
public function createAction()
{
$note = new Note;
$form = new Form('note',$note, $this->get('validator'));
$form->add(new TextField('body'));
if ('POST' === $this->get('request')->getMethod()) {
$form->bind($this->get('request')->get($form->getKey()));
}
return $this->render('CrmBundle:AdminNote:create.twig.html',
array('form' => $form));
}
}
# Template
<form action="#" method="post">
{{ form_field(form) }}
<input type="submit"/>
</form>
# Object
<?php
namespace yProx\CrmBundle\Entity;
class Note
{
public $id;
/**
* @validation:NotBlank()
*/
public $body;
public $user;
}
On 20 January 2011 08:28, Bernhard Schussek <[email protected]> wrote:
> Hi Dan,
>
> Can you post a failing test case or a reproducible example please?
>
> Thanks,
> Bernhard
> --
> Software Architect & Engineer
> Blog: http://webmozarts.com
> Twitter: http://twitter.com/webmozart
>
> --
> 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 developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/symfony-devs?hl=en
>
--
Dan Leech
Web Developer
www.dantleech.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 developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en