草庐IT

entity-mode

全部标签

php - Symfony2 : How to modify the current user's entity using a form?

我正在尝试添加一个简单的表单以允许我的用户编辑他们的个人资料。我的问题是:由于“链接”到表单的实体与当前用户对象相同($user===$entity,见下文),如果表单验证失败,则View是使用修改后的用户对象呈现(即使用无效形式的值)。这是我的(经典)Controller:publicfunctionprofileAction(){$em=$this->getDoctrine()->getEntityManager();$user=$this->get('security.context')->getToken()->getUser();$entity=$em->getReposit

php - CURLOPT_FOLLOWLOCATION 不能在启用 safe_mode 或在

当我运行此脚本时(http://bizonbytes.com/miscellaneous/sharrre.php?url=https://bizonbytes.com&type=googlePlus):'','count'=>0);$json['url']=$_GET['url'];$url=urlencode($_GET['url']);$type=urlencode($_GET['type']);if(filter_var($_GET['url'],FILTER_VALIDATE_URL)){if($type=='googlePlus'){//sourcehttp://www.he

php - 如何避免 "Entities passed to the choice field must be managed. Maybe persist them in the entity manager?"

GeneratedEntities来自现有数据库GeneratedCRUDController但它不适用于异常消息:Entitiespassedtothechoicefieldmustbemanaged.Maybepersistthemintheentitymanager?实体/***Question**@ORM\Table(name="question",indexes={@ORM\Index(name="question_category_id",columns={"question_category_id"})})*@ORM\Entity*/classQuestion{//...

php - 执行 html_entity_decode 后出现奇怪的字符 (�)

在一个单独的YML文件中,我有:flags:[]当我将它调用到我的代码中时,它没有被解释,所以我使用了html_entity_decode.它有效,但我只有1个奇怪的字符在我的图像之前:�render());?>我的所有文件都是UTF8编码的。你知道我错过了什么来解决这个问题吗?附言:publicstaticfunctiongetI18nCulturesForChoice(){returnarray_combine(self::getI18nCultures(),self::getI18nCulturesFlags());} 最佳答案

php - 类中的 Doctrine 注释 "@Doctrine\ORM\Annotation\Entity"不存在或无法自动加载

我正在关注DoctrineGettingStarted字母教程。我已经创建了Product类(通过从教程中复制/粘贴,以确保没有拼写错误),但是当我运行时vendor/bin/doctrineorm:schema-tool:create我得到[OK]NoMetadataClassestoprocess。这似乎是因为Setup::createAnnotationMetadataConfiguration的useSimpleAnnotationReader参数默认为true。因此,如果我将其更改为false:$config=Setup::createAnnotationMetadataCo

PHP cli 命令行 safe_mode 限制

我使用的是生成每日日志的Kohana框架(3.0.9)。如果日志文件是在CRON运行脚本的前一天制作的,我想通过邮件发送,但经过几天的尝试后,我无法弄清楚如何在PHPCLI模式中推迟safe_mode。当我在网络上运行我的脚本时,没有问题。但是我想在我的Plesk9.5.2服务器上(或在命令行上以root用户身份)将脚本作为CRON任务运行,我收到以下错误:ErrorException[2]:dir():SAFEMODERestrictionineffect.Thescriptwhoseuidis10001isnotallowedtoaccess/var/www/vhosts/mydo

php - 学说 2 : reattaching entities through value objects

我正在使用Doctrine2,并且有一个Address值对象:classAddress{/**@varstring*/protected$street;/**@varstring*/protected$city;/**@varApplication\Domain\Model\Country*/protected$country;}我需要将此Address存储在PHPsession中(序列化),并在稍后检索它。当我随后检索这个值对象时,我想将Country对象合并到当前的实体管理器,以便这个国家与当前的工作单元同步。是否可以将这个值对象“合并”到当前的实体管理器,就像我使用cascade

php - 有什么方法可以将 Entity Framework 与 mysql 和 php 一起使用?

我想知道是否有任何方法可以将EntityFramework与mysql和php一起使用。是否需要任何连接器或特殊程序。能否请您介绍一些引用资料供我阅读? 最佳答案 EntityFramework是.NET的ORM,它不是php或类似东西的“端口”,即使在那种情况下,我怀疑它是否会比当前的PHPORM框架更好。如果你想在PHP中使用ORM,那么你有很多选择,你应该阅读一些关于备选方案的信息并选择ORM。就我个人而言,我使用Doctrine框架http://www.doctrine-project.org/

php - 如何用预言测试 Doctrine Entity Manager findOneById 方法?

我正在使用预言来编写我的单元测试"require":{...,"phpspec/prophecy-phpunit":"~1.0"},我调用$dbUser=$this->em->getRepository('MainBundle:User')->findOneById($id);测试时出现错误,因为未定义findOneByProperty方法。除了将原始代码更改为:$dbUser=$this->em->getRepository('MainBundle:User')->findOneBy(array('id'=>$id);我没有找到任何其他解决方法。有什么方法可以使用预言并保留原始代码来

数字 HTML 实体 60 和 62 的 PHP html_entity_decode() 异常

我如何使用PHP的html_entity_decode(),数字HTML实体60和62除外?目前我的代码如下所示:$t=mysqli_real_escape_string($db,html_entity_decode($_POST['title'],ENT_COMPAT,'UTF-8'));但是,如果我将其编码为在内容中显示为插入符(就像您直接向客户端显示一个符号一样),它们也会被编码,这会导致HTML格式错误。所以我需要做一些异常(exception),尽管我不确定该怎么做;用临时占位符替换字符串?我相信有更好的方法。 最佳答案