- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我有一个正在使用 Symfony2 编码的应用程序。我创建了一个 Account 实体并使用注解创建了一个名为 AccountRepository 的存储库 在 AccountRepository 对象内 我创建了一个函数来运行一些业务逻辑,该业务逻辑发送给外部供应商并在他们的站点创建一个用户,然后返回信息给我们,这样我就可以将他们的用户与我们的帐户实体相关联。创建该用户的一部分包括发送信用卡 token 。然后他们返回一些我想存储并与我们的帐户关联的有限信用卡数据,因此在创建对象并插入适当的数据后我有一个实体 AccountCard,我无法从存储库请求实体管理器并坚持 AccountCard 做$em 变量上的 print_r 什么也没显示,但我读过的所有内容都告诉我我应该能够做到这一点。我做错了什么?
<?php
namespace Openbridge\CommonBundle\Entity\Repository;
use Doctrine\ORM\EntityRepository;
use Openbridge\CommonBundle\Entity\Account as Account;
use Openbridge\CommonBundle\Entity\AccountCard as AccountCard;
use Openbridge\CommonBundle\Entity\AccountAddress as AccountAddress;
/**
* AccountRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class AccountRepository extends EntityRepository
{
public function __construct()
{
}
function createVendorUser(Account $account, $userData = array())
{
// Request new user from vendor code here. (this works)
$ac = new AccountCard();
// setters for $ac data here.
// Get entity manager
$em = $this->getEntityManager();
$em->persist($ac);
$em->flush();
}
最佳答案
你必须删除构造函数,因为EntityRepository使用它来将依赖项绑定(bind)到类。
关于php - Doctrine Repository getEntityManager() 确实返回空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18067599/
我要选择column1小于或等于 column2 的数据.但是,当我尝试使用 { console.log(notify) res.render('index', { title
我在页面中有一个更新面板,供用户指定事件的“所有者”。该所有者将是我们事件目录中的用户。该面板允许用户输入一些文本,然后单击搜索按钮以在我们的 Active Directory 中查找匹配的用户。当用
我想知道为什么同一个实体在控制台中调用的浏览器 window 对象中有不同的表示: 如果我们仅在浏览器控制台内调用window,我们将获得完整的浏览器信息。其中文档将表示为类似对象的实体,包括各种 P
我有一个正在处理大量数据的应用程序,我正在监视它的 .NET 内存性能计数器。基于性能计数器,所有堆中的#Bytes 正在缓慢增长(每 12 小时约 20MB)。所有 3 代也被收集(gen0 每秒几
According to documentation 默认实现不执行任何操作。 但是...我从 drawRect 方法中抛出异常并且我看到了下一个调用堆栈 3 EasyWakeup
我使用 package maven 插件构建了一个 Spring 应用程序的 jar。在本地,我可以运行它java -jar -Dspring.profiles.active=dev target/m
我们正在开发一种软件,我们可以在其中预览和记录从视频采集卡采集的输入视频源。预览是用DirectShow实现的,录制是用Media Foundation实现的(老软件慢慢升级到MediaFound
我在 symfony 中构建了一个简单的操作,它通过 wkhtmltopdf 生成一个 PDF 文件并将其输出到浏览器。 代码如下: $response = $this->getResponse(
这将是一个简短的问题。 来源在这里:https://github.com/exhuma/grc 标题解释了我的问题;) 我注册并上传了包到pypi。现在,如果我运行 easy_install grc,
我需要将事务与LINQ to SQL一起使用,并且正在阅读以熟悉它。 确实已处理SubmitChanges吗? 最佳答案 当您调用SubmitChanges时,LINQ to SQL将检查一组已知对象
在 Ajax 结果之后,我试图淡出 html 按钮。这在大多数情况下都有效,但有时按钮不会淡出,我不明白为什么。 $.ajax({ type: frm.attr('method'),
我以这样的方式创建 Cesium.Primitive: _createPrimitive: function (linesNumber) { var instances = [
我正在 Spring 上构建一个 Web 应用程序。 我很困惑是否应该在配置中使用 mvc:annotation-driven 还是 context:annotation-config 来扫描注释来处
问题 - 给定一个字符串 '0'、'1' 和 '?'。生成所有可能的字符串,您可以在其中替换“?”用“0”或“1”? 例如 - 输入 - “0??” 输出 - “000”、“001”、“010”、“0
总结: 修改wxwidgets Hello World tutorial中的代码后在 CppMicroServices 框架中的“模块”中,使用事件表或 Bind() 注册的事件似乎不会触发,但使用
我的 Capistrano 任务失败了 No such file or directory @ rb_sysopen - /home/blog/pids/grantb.blog.staging.pid
我们在 repo 协议(protocol)中有一个配置文件,所有用户都根据他们的功能做出贡献。对于我的本地测试,我需要手动更改该配置文件中的两个值,但我不想将我的更改提交回服务器。 但是,如果存储库中
我在顶部菜单(ListItems)的开头插入一个菜单选项并使用 $('#newMenuItem').show('slide'); 成功了。但是,我不喜欢它从左上角滑入的方式,所以我将其更改为 $('#
我尝试在我的 NSWindow 上调用 setFrame:display:animate: 并且没有执行任何操作,但是如果我在同一个窗口上调用 setFrame:display:,它有效。 我需要做其
我是一名优秀的程序员,十分优秀!