异常是为&QUOT没有指定表单元素;标题"漂亮\\ Zend的\\表格及QUOT;以及一个不能从&QUOT自动确定; [英] Exception No form element was specified for "title" and one not be determined automatically from "Spiffy\Zend\Form"

查看:273
本文介绍了异常是为&QUOT没有指定表单元素;标题"漂亮\\ Zend的\\表格及QUOT;以及一个不能从&QUOT自动确定;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在addtion到我的previous问题<一href=\"http://stackoverflow.com/questions/10195188/attache-zend-filters-and-validation-chains-to-models-doctrine-entities\">Attache Zend的过滤器和验证链我给一个尝试漂亮的框架模型/学说实体,但我得到了与此异常这样的堆栈:异常没有表单元素是为标题规定,一个无法从自动确定漂亮\\ Zend的\\表。
在我的实体我有这样的:

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

和我的表是这样的:

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

推荐答案

在我的application.ini,我comented出这个行:

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

 pluginPaths.Bisna\Application\Resource\ = "Bisna/Application/Resource"

autoloaderNamespaces[] = Bisna

但我还是得到了异常:

but I still got the exception:

  Uncaught exception 'ReflectionException' with message 'Class Doctrine\ORM\Mapping\Driver\AnnotationDriver does not exist' in C:\Spiffy\lib\Spiffy\Doctrine\Container.php on line 359

什么是不明确的对我来说,是在bisna资源我有这样的事情:

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

  \Zend_Registry::set('doctrine', $container);

和在漂亮的资源我有这样的:

and in the spiffy resource I had like this:

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

但在我Boostrap.php,我有这个二:

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

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

我预计是教义和Spiffy_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! ' );
}

而是cacthing例外,我得到这个:

but instead of cacthing the exception, I got this:

`Uncaught exception 'ReflectionException'`

诗:对不起的从linekdin主义集团的内容重复,但这些都是我的答案。现在分辩我调试我的应用程序,也许我会找出我错过了什么,但任何帮助将是巨大的。谢谢你。

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.

这篇关于异常是为&QUOT没有指定表单元素;标题&QUOT;漂亮\\ Zend的\\表格及QUOT;以及一个不能从&QUOT自动确定;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆