persist

Symfony3 - How to persist an object with its collections?

▼魔方 西西 提交于 2019-12-02 09:22:00
I have an object "person" with several collections ("documents", "contacts", "etc"). I would like to save "person" and automatically the collection too. This is my controller: $em = $this->getDoctrine()->getManager(); $persona = new Persona(); $formulario = $this->createForm( PersonaType::class, $persona, array('action' => $this->generateUrl('persona_create'), 'method' => 'POST') ); $formulario->handleRequest($request); $em->persist($persona); $em->flush(); When I dump "$persona", I have the collection and all the information that I need to save, but when I persist it, I lose all the

Symfony add data to object on pre persist

给你一囗甜甜゛ 提交于 2019-12-02 03:57:35
I have a form to create documents. On the one side I can add names and descriptions and next to that I can select one or several agencies to whom the created document belongs. Each of the agencies is assigned to one specific market (there are 7 markets in total, so one market can have several agencies but one agency belongs only to one market!) What I want to achieve is a "prePersist" function which automatically adds the correct market(s) (depending on the number of agencies selected) to the document. My document entity has the two entities (markets and agencies) with the according getters

译:Spring Data Repository 不区分大小写查询

我与影子孤独终老i 提交于 2019-12-01 22:22:54
使用Spring Data Repository 不区分大小写查询 原文链接: https://www.baeldung.com/spring-data-case-insensitive-queries 作者: Shubhra Srivastava 译者:liululee 1. 概览 Spring Data JPA 查询默认是大小写敏感的,换句话说,字段值的比较是区分大小写的。 本教程中,我们将探讨如何在 Spring Data JPA repository 快速新建不区分大小写的查询. 2. 依赖 首先,确保 pom.xml 包含 Spring Data 和 H2 依赖。 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> <version>2.1.3.RELEASE</version> </dependency> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <scope>runtime</scope> <version>1.4.199</version> </dependency> 最新版本请移步

How can a checkmark state be saved in core data?

与世无争的帅哥 提交于 2019-12-01 14:00:56
I have a list app where users hit the + button and enter in an item that they want to appear in the list and hit save. The table is saved with core data. The only problem is when the cell is taped I want a checkmark to be displayed. Ive enabled multiple selection with UITableViewCell *thisCell = [tableView cellForRowAtIndexPath:indexPath]; if (thisCell.accessoryType == UITableViewCellAccessoryNone) { thisCell.accessoryType = UITableViewCellAccessoryCheckmark; } else { thisCell.accessoryType = UITableViewCellAccessoryNone; } [tableView deselectRowAtIndexPath:indexPath animated:NO]; I would like

How can a checkmark state be saved in core data?

女生的网名这么多〃 提交于 2019-12-01 11:56:54
问题 I have a list app where users hit the + button and enter in an item that they want to appear in the list and hit save. The table is saved with core data. The only problem is when the cell is taped I want a checkmark to be displayed. Ive enabled multiple selection with UITableViewCell *thisCell = [tableView cellForRowAtIndexPath:indexPath]; if (thisCell.accessoryType == UITableViewCellAccessoryNone) { thisCell.accessoryType = UITableViewCellAccessoryCheckmark; } else { thisCell.accessoryType =

EntityManager persist() method does not insert record to database

三世轮回 提交于 2019-11-30 05:10:40
I have problem with using EntityManager.persist(Object) method. Now when i get rid of other problems, by app work without Exception but object is not put in my database. my entity class: @Entity @Table(name ="Chain") public class Chain implements Serializable{ @Id @Column(name = "id") private Long id; @Column(name = "date") private Date date; @Column(name = "name") private String name; //setters and getters } my dao class: @Transactional @Repository("ChainDao") public class ChainDaoImpl implements ChainDao{ private EntityManager em; @PersistenceContext public void setEntityManager

How do you store data from NSMutable Array in Core Data?

帅比萌擦擦* 提交于 2019-11-29 10:41:48
The app i'm making draws a Polyline based on the users coordinates from CLLocationManager (these are all kept in an NSMutableArray ) When the app closes, the current polyline disappears. How can I store the array of points in CoreData to be retrieved when the app starts up? All of the past 'routes' that the user has taken since initiating the app should be recovered and overlaid on the map (which may be quite a lot, so CoreData seems the best option from what i've gathered). This is the code I use to create an MKPolyline from the loaded coordinates -(IBAction)didClickLoadCoordinates:(id)sender

jqgrid retain filter on reload

时间秒杀一切 提交于 2019-11-29 08:04:47
This question has been as a lot so please forgive me asking again. I have a grid loaded from a url. I use loadonce: true I use filtertoolbar: $("#status").jqGrid('filterToolbar', { stringResult:true, searchOnEnter:false, autosearch: true, defaultSearch: "cn" }); I have a dropdown search list from which I can select what I'm looking for. Works great. I have a navbutton I click to initiate a reload every 30 seconds. Works great. $("#status").jqGrid('navButtonAdd','#statuspager', { caption: '', buttonicon: 'ui-icon-play', onClickButton: function () { stint = setInterval (function() { postfilt = $

How to persist objects between requests in PHP

北城余情 提交于 2019-11-29 03:14:10
I've been using rails, merb, django and asp.net mvc applications in the past. What they have common (that is relevant to the question) is that they have code that sets up the framework. This usually means creating objects and state that is persisted until the web server is recycled (like setting up routing, or checking which controllers are available, etc). As far as I know PHP is more like a CGI script that gets compiled to some bytecode each time it's run, and after the request it's discarded. Of course you can have sessions, to persist data between requests from the same user, and as I see

EntityManager persist() method does not insert record to database

巧了我就是萌 提交于 2019-11-29 02:56:42
问题 I have problem with using EntityManager.persist(Object) method. Now when i get rid of other problems, by app work without Exception but object is not put in my database. my entity class: @Entity @Table(name ="Chain") public class Chain implements Serializable{ @Id @Column(name = "id") private Long id; @Column(name = "date") private Date date; @Column(name = "name") private String name; //setters and getters } my dao class: @Transactional @Repository("ChainDao") public class ChainDaoImpl