doctrine-collection 相关问题


Doctrine ORM:正则表达式与表达式生成器中的 DQL 函数匹配

我在 Doctrine ORM 中注册了 REGEX() DQL 函数。 现在,我想在表达式生成器中使用该函数 $expr = $queryBuilder->expr(); $or = $expr->orX(); $or->add($expr->eq(&q...


Flutter Firebase Firestore 固定消息查询

我喜欢这个查询 查询> pageChat = _fireStore .collection('聊天') .where('chatUsersId', arrayContains: firebaseUser!.uid) .where('聊天...


react中firestore onSnapshot的返回值

我在函数中有一个 onSnapshot 查询: //firebaseutil.js 导出异步函数 getShorts(uid) { const q = query(collection(db, 'shorted'), where('owner', '==', uid)); 常量取消订阅 = onSnapsh...


PHP 5.x 是否有某种 HashSet 或 Set 类?

我习惯了 Java,其中有 HashSet、ArrayList 和其他 Collection。但我现在正在开发一个 PHP 项目。 我需要创建一个集合,用对象填充该集合(在本例中为字符串),但是...


将文件夹添加到 Firestore 时出错:无法使用空路径调用函数 collection()

我试图在我的项目模式中创建一个“AddFolderButton”,所以我想要的是添加后我单击按钮,它应该更新 firebase 云中的名称和 userId。 ...


使用 Doctrine 与多个实体管理器的缓存问题

我们需要将数据库拆分为一个 LIVE 数据库和一个 Archive 数据库 为此,我们创建了一个实时数据库和一个存档数据库,并且我们设置了这样的原则: 教义: 数据库:


Doctrine 2.2+ 想要重新创建我的所有表,因为它试图使用错误的 postgres 架构

我在 symfony 2.0 项目上将原则从 2.1 更新到 2.2。 但现在每次我尝试执行 php app/console 学说:schema:update 学说都想重新创建我的所有架构,并且我有以下内容...


Doctrine 2.2+ 想要重新创建我的所有表,因为它试图使用错误的 postgres 架构

我在 symfony 2.0 项目上将原则从 2.1 更新到 2.2。 但现在每次我尝试执行 php app/console 学说:schema:update 学说都想重新创建我的所有架构,并且我有以下内容...


具有 TimestampableEntity 特征的实体在 PUT 操作中失败

我正在全新安装 API Platform (v3.2.7),并且使用 Gedmo\Timestampable\Traits\TimestampableEntity 这是我的实体(问候语示例) 我正在全新安装 API Platform (v3.2.7),并且正在使用 Gedmo\Timestampable\Traits\TimestampableEntity 这是我的实体(问候语示例) <?php namespace App\Entity; use ApiPlatform\Metadata\ApiResource; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; use Gedmo\Timestampable\Traits\TimestampableEntity; #[ApiResource] #[ORM\Entity] class Greeting { use TimestampableEntity; #[ORM\Id] #[ORM\Column(type: "integer")] #[ORM\GeneratedValue] private ?int $id = null; #[ORM\Column] #[Assert\NotBlank] public string $name = ""; public function getId(): ?int { return $this->id; } } 和我的 config/services.yaml gedmo.listener.timestampable: class: Gedmo\Timestampable\TimestampableListener tags: - { name: doctrine.event_listener, event: 'prePersist' } - { name: doctrine.event_listener, event: 'onFlush' } - { name: doctrine.event_listener, event: 'loadClassMetadata' } 它在 POST 操作上工作正常,但在执行 PUT 时失败。我收到此错误 执行查询时发生异常:SQLSTATE[23000]: 完整性约束违规:1048 列“created_at”不能 空 我使用的版本是:symfony 6.4.1,doctrine 2.12,gedmo 3.14 我最终做的是使用 PATCH 而不是 PUT。所以我可以编辑部分实体,并且特征仍然更新 updated_at 字段


另一个模型中的模型列表仅保存列表中所有项目中最后添加的项目

对于 (int x=0; x for (int x=0; x<listaEquipes.length; x++) { await _loadEquipe(listaEquipes[x].id.toString()); TabelaListaEquipes _reg = TabelaListaEquipes(); _reg.equipeId = listaEquipes[x].id.toString(); _reg.equipe = listaAtletaEquipe; //print (_reg.equipe![0].nome.toString()); listaEquipesGeral.add(_reg); } 此型号: class TabelaListaEquipes { String? equipeId; List<TabelaInscricoes>? equipe; TabelaListaEquipes( { this.equipeId, this.equipe}); } 现在我看到最后一个reg保存在列表的所有iten中,为什么? 这就对了: listaEquipesGeral[0].equipe == listEquipesGeral[1].equipe ...仍然添加了最后一项。为什么?? _loadEquipe 函数,它也有效,我已经测试过了, List<TabelaInscricoes> listaAtletaEquipe = []; Future<void> _loadEquipe(equipId) async { setState(() { listaAtletaEquipe.clear(); carregandoEquipe = true; }); TabelaInscricoes _result = TabelaInscricoes(); CollectionReference _dbCollection = FirebaseFirestore.instance.collection('campeonatos').doc(resultSelect.campId).collection('divisoes').doc(resultSelect.divId).collection('equipes').doc(equipId).collection('atletas'); await _dbCollection.orderBy('pos2', descending: false).get().then((QuerySnapshot querySnapshot) async { if (querySnapshot.docs.isNotEmpty) { querySnapshot.docs.forEach((element) async { _result = TabelaInscricoes.fromJson(element.data()! as Map<String, dynamic>); if (_result.campId == resultSelect.campId && _result.divId == resultSelect.divId) { _result.id = element.id; _result.filePath = ""; setState(() { listaAtletaEquipe.add(_result); }); } }); for (int x = 0; x<listaAtletaEquipe.length; x++) { for (int y = 0; y<listaAtletas.length; y++) { if (listaAtletaEquipe[x].atletaId.toString() == listaAtletas[y].id.toString()) { setState(() { listaAtletaEquipe[x].nome = listaAtletas[y].nome; listaAtletaEquipe[x].fotoNome = listaAtletas[y].fotoNome; listaAtletaEquipe[x].filePath = listaAtletas[y].filePath; listaAtletaEquipe[x].dataN = listaAtletas[y].dataN; listaAtletaEquipe[x].fone1 = listaAtletas[y].fone1; listaAtletaEquipe[x].fone2 = listaAtletas[y].fone2; listaAtletaEquipe[x].nTitulo = listaAtletas[y].nTitulo; listaAtletaEquipe[x].info = listaAtletas[y].info; listaAtletaEquipe[x].email = listaAtletas[y].email; }); } } } for (int x=0; x<listaAtletaEquipe.length; x++) { if (listaAtletaEquipe[x].fotoNome.toString().isNotEmpty) { await MyStorage.getUrl(context, "atletas/${listaAtletaEquipe[x].fotoNome.toString()}").then((value) { setState(() { listaAtletaEquipe[x].filePath = value; }); }); } } setState(() { carregandoEquipe = false; }); }else { setState(() { carregandoEquipe = false; }); } }); } AtletaEquipes 型号操作系统列表: class TabelaInscricoes{ bool? carregando = true; String? id; String? campId; String? divId; String? atletaId; String? nome_responsavel; String ?posicao; String? filePath; Uint8List? imageFile; String? usuario; String? nInscricao; String? nome; String? dataN; String? nTitulo; String? fone1; String? fone2; String? info; String? email; String? fotoNome; String? pos2; String? selected; TabelaInscricoes({ this.carregando, this.nome, this.dataN, this.nTitulo, this.fone1, this.fone2, this.info, this.email, this.id, this.campId, this.divId, this.posicao, this.nome_responsavel, this.nInscricao, this.atletaId, this.selected, this.pos2, this.fotoNome, this.filePath, this.imageFile, this.usuario}); Map<String, dynamic> toJson() => { 'campId': campId, 'divId': divId, 'atletaId': atletaId, 'nome_responsavel': nome_responsavel, 'posicao': posicao, 'usuario': usuario, 'nInscricao': nInscricao, 'pos2': pos2, 'selected': selected }; TabelaInscricoes.fromJson(Map<String, dynamic> json) : campId = json['campId'], divId = json['divId'], atletaId = json['atletaId'], nome_responsavel = json['nome_responsavel'], posicao = json['posicao'], nInscricao = json['nInscricao'], pos2 = json['pos2'], selected = json['selected'], usuario = json['usuario']; } 这里发生了什么,listaEquipesGeral 总是保存最后添加的所有项目。 我明白了,解决方案是在模型内的列表中逐项添加: for (int x=0; x<listaEquipes.length; x++) { await _loadEquipe(listaEquipes[x].id.toString()); TabelaListaEquipes _reg = TabelaListaEquipes(); _reg.equipeId = listaEquipes[x].id.toString(); _reg.equipe = []; //here above the solution, include for to put item by item, and it works for (int y = 0; y<listaAtletaEquipe.length; y++) { _reg.equipe!.add(listaAtletaEquipe[y]); } //print (_reg.equipe![0].nome.toString()); listaEquipesGeral.add(_reg); }


更新 MyBatis 中的值列表 - SQLSyntaxErrorException

更新 MyBatis 中的值列表时出现 SQLSyntaxErrorException。我正在使用分隔符=“;”在 forecach 标签中,但我仍然收到错误。下面是我的sql查询 更新 MyBatis 中的值列表时出现 SQLSyntaxErrorException。我在 forecach 标签中使用 separator=";" ,但仍然收到错误。下面是我的sql查询 <update id="updateComplianceCheckListResponse" parameterType="java.util.List"> <foreach collection="list" item="response" separator=";"> UPDATE AM_ComplianceChecklistResponse SET complianceDetailsId = #{response.complianceDetailsId}, complianceChecklistId = #{response.complianceChecklistId}, questionResponse = #{response.questionResponse}, expiryDate = #{response.expiryDate}, documentName = #{response.documentName}, comments = #{response.comments} WHERE id = #{response.id} </foreach> </update> org.apache.ibatis.exceptions.PersistenceException: 更新数据库时出错。原因:java.sql.SQLSyntaxErrorException:您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,了解在“UPDATE AM_ComplianceChecklistResponse”附近使用的正确语法 SET complianceDetailsId = 1, com' at line 10 错误可能存在于 com/am/dao/managecompliance/ComplianceChecklistResponse.xml 中 错误可能涉及ComplianceChecklistResponse.updateComplianceCheckListResponse-Inline 设置参数时出现错误 SQL: UPDATE AM_ComplianceChecklistResponse SETcomplianceDetailsId = ?,complianceChecklistId = ?,questionResponse = ?,expiryDate = ?,documentName = ?,comments = ?哪里 id = ? ; UPDATE AM_ComplianceChecklistResponse SET complianceDetailsId = ?、complianceChecklistId = ?、questionResponse = ?、expiryDate = ?、documentName = ?、comments = ?哪里 id = ? 原因:java.sql.SQLSyntaxErrorException:您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,了解在“UPDATE AM_ComplianceChecklistResponse”附近使用的正确语法 SET complianceDetailsId = 1, com' at line 10 at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:196) at com.am.dao.managecompliance.ComplianceChecklistResponseDAO.updateComplianceCheckListResponse(ComplianceChecklistResponseDAO.java:50) at com.am.service.managecompliance.ComplianceChecklistResponseService.updateComplianceCheckListResponse(ComplianceChecklistResponseService.java:122) at com.am.webservice.controller.managecompliance.ManageComplianceController.updateComplianceCheckListResponse(ManageComplianceController.java:230) at com.am.webservice.controller.managecompliance.ManageComplianceController$$FastClassBySpringCGLIB$$e3100610.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at org.springframework.aop.framework.CglibAopProxy.invokeMethod(CglibAopProxy.java:386) at org.springframework.aop.framework.CglibAopProxy.access$000(CglibAopProxy.java:85) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:704) at com.am.webservice.controller.managecompliance.ManageComplianceController$$EnhancerBySpringCGLIB$$4a5751a4.updateComplianceCheckListResponse(<generated>) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1071) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:964) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) at javax.servlet.http.HttpServlet.service(HttpServlet.java:555) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) at javax.servlet.http.HttpServlet.service(HttpServlet.java:623) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:209) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:337) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:346) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:122) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:116) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:346) at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:346) at com.dbp.security.auth.spring.StatelessAuthenticationFilter.doFilter(StatelessAuthenticationFilter.java:55) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:346) at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90) at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:346) at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:221) at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:186) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:354) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:267) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:178) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:153) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:168) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:481) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:130) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:670) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:390) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:928) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1794) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.base/java.lang.Thread.run(Thread.java:833) 引起:java.sql.SQLSyntaxErrorException:您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,了解在“UPDATE AM_ComplianceChecklistResponse”附近使用的正确语法 设置合规性详细信息 ID = 1, com' 在第 10 行 在 com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120) 在com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) 在com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:916) 在 com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:354) 在 java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(本机方法) 在 java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) 在java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在 java.base/java.lang.reflect.Method.invoke(Method.java:568) 在org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59) 在 jdk.proxy5/jdk.proxy5.$Proxy81.execute(来源未知) 在 org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:47) 在 org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74) 在 org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50) 在 org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117) 在 org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76) 在 org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:194) ...省略69个常用框架 修复为 <insert id="updateComplianceCheckListResponse" parameterType="java.util.List"> insert into AM_ComplianceChecklistResponse (id,complianceDetailsId,complianceChecklistId,questionResponse,expiryDate,documentName,comments) VALUES <foreach collection="list" item="response" separator="," open="(" close=")"> #{response.id}, #{response.complianceDetailsId},#{response.complianceChecklistId},#{response.questionResponse},#{response.expiryDate},#{response.documentName},#{response.comments} </foreach> on duplicate key update complianceDetailsId= VALUES(complianceDetailsId), complianceChecklistId=VALUES(complianceChecklistId), questionResponse=VALUES(questionResponse), expiryDate=VALUES(expiryDate), documentName=VALUES(documentName), comments=VALUES(comments) </insert>


© www.soinside.com 2019 - 2024. All rights reserved.