Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
163 views
in Technique[技术] by (71.8m points)

validation - Exception No form element was specified for "title" and one not be determined automatically from "SpiffyendForm"

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 "SpiffyendForm". In my entity I have this:

<?php

namespace Entities;
use DoctrineORMMapping as ORM;
use SpiffyDoctrineAbstractEntity as Entity;
use SpiffyDoctrineAnnotationsFilters as Filter;
use SpiffyDoctrineAnnotationsValidators as Assert;

/** @ORMEntity(repositoryClass="RepositoriesPostRepository") */
class Post extends Entity {

public function __construct()     
{
    $this->created  = new DateTime("now");
    $this->comments = new DoctrineCommonCollectionsArrayCollection();
}


public function __get($property)
{
    return $this->$property;
}

public function __set($name, $value)
{
    $this->$name = $value;

    return $this->$name;
}

/**
 * @ORMId @ORMColumn(type="integer") @ORMGeneratedValue
 */
private $id;

/**
 * @var string $title
 * @FilterAlnum
 * @AssertStringLength(5)
 * @ORMColumn(type="string",length=255) 
 */
private $title;

/**
 * @ORMColumn(type="text")
 */
private $body;

/**
 * @ORMColumn(type="datetime")
 */
private $created;

/**
 * @ORMOneToMany(targetEntity="Comment", mappedBy="post", fetch="LAZY")
 */
private $comments;
}

And my form is like this:

   <?php
   use SpiffyendForm 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

In my application.ini, I comented out this lines:

 pluginPaths.BisnaApplicationResource = "Bisna/Application/Resource"

and

autoloaderNamespaces[] = Bisna

but I still got the exception:

  Uncaught exception 'ReflectionException' with message 'Class DoctrineORMMappingDriverAnnotationDriver does not exist' in C:SpiffylibSpiffyDoctrineContainer.php on line 359

What is not clear for me, is that in the bisna resource I had something like this:

  end_Registry::set('doctrine', $container);

and in the spiffy resource I had like this:

 `Zend_Registry::set('Spiffy_Doctrine', $container);`

But in my Boostrap.php, I had this two:

    $this->bootstrap('doctrine');
    $container = $this->getResource('doctrine');

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:

try{
$reflClass = new ReflectionClass($driverClass);
}catch (LogicException $Exception) {
die('Not gonna make it in here...');
}
catch(ReflectionException $Exception)
{
die('Your class does not exist! ' );
}

but instead of cacthing the exception, I got this:

`Uncaught exception 'ReflectionException'`

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...