Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/274.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何确定symfony中是否存在条令模型的方法?_Php_Doctrine_Symfony 1.4_Symfony Forms - Fatal编程技术网

Php 如何确定symfony中是否存在条令模型的方法?

Php 如何确定symfony中是否存在条令模型的方法?,php,doctrine,symfony-1.4,symfony-forms,Php,Doctrine,Symfony 1.4,Symfony Forms,我有一个条令模型,它有一个getSomethingId()方法 我正在制作一个自动表单生成器,供公司内部使用 如何检查我的模型是否具有此方法 我尝试过php的方法_exists,但它对每个方法都返回false,我能做什么? 谢谢我想试试is_callable()prueba asi $class=get_class($object); if ( method_exists($class , $method)||$object->getTable()->hasField($fieldN

我有一个条令模型,它有一个getSomethingId()方法

我正在制作一个自动表单生成器,供公司内部使用

如何检查我的模型是否具有此方法

我尝试过php的方法_exists,但它对每个方法都返回false,我能做什么? 谢谢

我想试试is_callable()

prueba asi

$class=get_class($object);
if ( method_exists($class , $method)||$object->getTable()->hasField($fieldName)) {
  $string= str_replace($matches,call_user_func(array($object, $method)),$string);
}

谢谢你的推荐我明天下班后再试试投票