entities

Symfony2 filling all fields of table related to a Entity

懵懂的女人 提交于 2019-12-11 20:37:51
问题 I have a Entity of TeamMembers. And the TeamMember can have a Specification with a value. So I have three Entities: TeamMember, Specifications, SpecificationValues. In the SpecificationValue table I want to store the TeamMember_id, the Specification_id and the value that is just for that TeamMember. The Specifications and TeamMembers Entities are working. But now I want to show all the Specifications, if I go to the edit route (see code example) of a TeamMember, and have to possibility over

set Doctrine2 entity property without retrieving entire associated object

一世执手 提交于 2019-12-11 03:32:33
问题 I have a table Object that has 2 fields that are foreign keys (user_id and teacher_id). After generating the Entities for the X table, the entity only contain the $user and $teacher properties, which forces me to use the associated objects instead of id. So supposing I know the user_id and teacher_id for my object, instead of doing: $object->setUserId(1) I have to do: $user = $this->getDoctrine()->getRepository('MyBundle:Users')->find(2); $object->setUser($user) is there no way to work

Linq to Entities with Subselect in select part

こ雲淡風輕ζ 提交于 2019-12-11 02:39:06
问题 We are starting with a MVC project using EF. We will need write a lot of queries in LINQ using subselect and don't have figured out yet how this could be done. The most simple case of these is in this form: select p.Id, p.Title, (select count(*) from Comments c where c.PostId = p.Id ) as CommentCount from Post p where p.UserId = 'John'; Reading the "101 page" of examples from Microsoft and Stack Overflow I couldn't find a example like this. I found examples using join and group, but in some

JPA entities as a shareable jar not working in a WAR file unde Tomcat 7.0.27

房东的猫 提交于 2019-12-11 02:37:42
问题 i tried to share my entities in a JPA 2.0 project in eclipse Juno, ´cause i´m creating a test project and i need to access then there to make my tests and if i create any other project a can reuse those entities. The biggest problem is that hibernate ( 4.1.9 ) can find my jar in a relative path, but the most strange is that in my test project using only Spring 3 hibernate read my entities jar and hbm files perfectly. But when i try to do the same with the real project using tomcat 7.0.27 it

Overriding Doctrine Entities

…衆ロ難τιáo~ 提交于 2019-12-11 00:43:16
问题 I'm trying to create an application on Symfony2 with Doctrine 2 entities. My problem is that I should have a main application which contains the mainly used functions and other applications which are gonna extend it on need. For example i have a UserInterface and also a User which implements UserInterface in the main App. All the other applications should be able to use this User, but in case one of the apps needs to add more properties to this User he is able to override the user class

Insert html-entities in xslt

一个人想着一个人 提交于 2019-12-10 22:41:25
问题 I have some XMLs that contain character hex codes, e.g. it like this: <char hex="AB"/> Now I want to XSLT transform to display in the browser: <xsl:value-of select="concat('&#x', /char/@hex, ';', '')"/> However, the output in the browser is &#xAB; and not as I expected « so the browser does not display the character for that code (which would be « ) but only the literal string « How can I get the XSL not to escape the ampersand? 回答1: This can be accomplished if you set the output method to

PHP simplexml Entities

删除回忆录丶 提交于 2019-12-10 20:58:24
问题 What's going one here? $string = <<<XML <?xml version="1.0" encoding="UTF-8"?> <album> <img src="002.jpg" caption="wássup?" /> </album> XML; $xml = simplexml_load_string($string); // $xmlobj = simplexml_load_file("xml.xml"); // same thing echo "<pre>"; var_dump($xml); echo "</pre>"; Error: Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 5: parser error : Entity 'aacute' not defined 回答1: &aacute is not an XML entity - you're thinking about HTML. Special

Naming convention: singular vs plural for classes describing entities in PHP

◇◆丶佛笑我妖孽 提交于 2019-12-10 19:54:05
问题 I think that the standard practice to name tables in MySQL is to use plural names. The classes refering to those tables should also be plural? For example, imagine that you have a table called Users, that is used for authentication purposes. This table would be described in an entity class more or less like this using the doctrine ORM: namespace Company\BlogBundle\Entity; use Doctrine\ORM\Mapping as ORM; /** * @ORM\Entity * @ORM\Table(name="Users") */ class Users { /** * @ORM\Id * @ORM\Column

What are JPA entities?

别来无恙 提交于 2019-12-10 17:27:25
问题 I am starting to use JPA and I always get confused with the term of entities and their usage, I have read a lot but I still don't quite get it. I read the Oracle documentation of it but it does not really explain its role in the transaction. What are JPA enities? does they actually hold the data for each row, I mean, are they stored instances that hold the row data? or they just map tables of the db and then insert and delete in them? for example if I use this: entity.setUserName("michel");

Cant find base path for bundle

心已入冬 提交于 2019-12-10 14:24:36
问题 I'm using Symfony2 and want to generate getters and setters for the entities by running: $ php app/console doctrine:generate:entities TestBundle The Console returns me the following message: [RuntimeException] Can't find base path for "TestBundle" (path: "C:\xampp\htdocs\ProjectX\src\Namespace\TestBundle", destination: "C:/xampp/htdocs/ProjectX/src/Namespace/TestBundle"). The Bundle exists at this location: C:\xampp\htdocs\ProjectX\src\Namespace\TestBundle Whats wrong? 回答1: Just to add