In addtion to my previous question Attache zend filters and validation chains to models/doctrine entities I have given a try to Spiffy framework, but I got stack with this exception like this: Exception No form element was specified for "title" and one not be determined automatically from "Spiffy\Zend\Form". In my entity I have this:
<?php
namespace Entities;
use Doctrine\ORM\Mapping as ORM;
use Spiffy\Doctrine\AbstractEntity as Entity;
use Spiffy\Doctrine\Annotations\Filters as Filter;
use Spiffy\Doctrine\Annotations\Validators as Assert;
/** @ORM\Entity(repositoryClass="Repositories\PostRepository") */
class Post extends Entity {
public function __construct()
{
$this->created = new \DateTime("now");
$this->comments = new \Doctrine\Common\Collections\ArrayCollection();
}
public function __get($property)
{
return $this->$property;
}
public function __set($name, $value)
{
$this->$name = $value;
return $this->$name;
}
/**
* @ORM\Id @ORM\Column(type="integer") @ORM\GeneratedValue
*/
private $id;
/**
* @var string $title
* @Filter\Alnum
* @Assert\StringLength(5)
* @ORM\Column(type="string",length=255)
*/
private $title;
/**
* @ORM\Column(type="text")
*/
private $body;
/**
* @ORM\Column(type="datetime")
*/
private $created;
/**
* @ORM\OneToMany(targetEntity="Comment", mappedBy="post", fetch="LAZY")
*/
private $comments;
}
And my form is like this:
<?php
use \Spiffy\Zend\Form as Form;
class Application_Form_Post extends Form
{
public function init()
{
//var_dump($this->getEntity()); //returns null
// die;
$this->add('title');
$this->add('body');
$this->addElement('submit', 'submit', array(
));
}
}
So I am block myself here. Thank you for your help.
In my application.ini, I comented out this lines:
and
but I still got the exception:
What is not clear for me, is that in the bisna resource I had something like this:
and in the spiffy resource I had like this:
But in my Boostrap.php, I had this two:
I was expected to be a diffrence between doctrine and Spiffy_Doctrine, but is not. And something else that is for me, not understandable. I modify some line in Spiffy container like this:
but instead of cacthing the exception, I got this:
Ps: Sorry for the duplication of content from the doctrine group from linekdin, but these are my answers. Rigth now I debug my application, maybe I will figure out what I'm missing, but any help will be great. Thank you.