HosipLan

Untitled

Mar 29th, 2011
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.49 KB | None | 0 0
  1.  
  2. Delivered-To: [email protected]
  3. Received: by 10.220.13.71 with SMTP id b7cs129152vca;
  4. Tue, 29 Mar 2011 02:57:36 -0700 (PDT)
  5. Return-Path: <[email protected]>
  6. Received-SPF: pass (google.com: domain of [email protected] designates 10.223.74.85 as permitted sender) client-ip=10.223.74.85;
  7. Authentication-Results: mr.google.com; spf=pass (google.com: domain of [email protected] designates 10.223.74.85 as permitted sender) smtp.mail=doctrine-user+bncCJbc0OqdHhCH2sbsBBoEIHL0fg@googlegroups.com; dkim=pass header.i=doctrine-user+bncCJbc0OqdHhCH2sbsBBoEIHL0fg@googlegroups.com
  8. Received: from mr.google.com ([10.223.74.85])
  9. by 10.223.74.85 with SMTP id t21mr1907042faj.17.1301392655801 (num_hops = 1);
  10. Tue, 29 Mar 2011 02:57:35 -0700 (PDT)
  11. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
  12. d=googlegroups.com; s=beta;
  13. h=domainkey-signature:x-beenthere:received-spf:to:subject
  14. :mime-version:date:from:in-reply-to:references:message-id:x-sender
  15. :user-agent:x-original-sender:x-original-authentication-results
  16. :reply-to:precedence:mailing-list:list-id:x-google-group-id
  17. :list-post:list-help:list-archive:sender:list-unsubscribe
  18. :content-type;
  19. bh=qV9rDKxNYG0wY7AW9RBKqIUZ3AVGoEI7foYmQWMAeTE=;
  20. b=OLa9CiP2KVxqwiXPSQg9a9YdUn9P9RPoXwt7vPiWwLrO83D/9ROkBUQQSJCcRNUQPB
  21. YXofBDQMuH3iuff5v4rTZYyRSkcybD+2r8OPHU6F3zBy05OKXiVfHgUp//ldAihSYDAQ
  22. MuSmR9P9iz+FF+MkdXA134bP0l5zXOaAa0WLk=
  23. DomainKey-Signature: a=rsa-sha1; c=nofws;
  24. d=googlegroups.com; s=beta;
  25. h=x-beenthere:received-spf:to:subject:mime-version:date:from
  26. :in-reply-to:references:message-id:x-sender:user-agent
  27. :x-original-sender:x-original-authentication-results:reply-to
  28. :precedence:mailing-list:list-id:x-google-group-id:list-post
  29. :list-help:list-archive:sender:list-unsubscribe:content-type;
  30. b=c/X8XZZq14LhTwJHyML5uztiZoFtCZ7xh+w6ZL5TY4stSj2IMBNSSc3L8LZd9DUjOC
  31. JbrFjCo47aVhfCfd2KbZMnGr8UreEDWuz2ZxqeOqcJJY0tvVXARJ6TbKu413P51WNGCh
  32. mxzDbTylneutCrvPS6caS5kIjDSDV1a+Ugf3g=
  33. Received: by 10.223.74.85 with SMTP id t21mr549673faj.17.1301392648533;
  34. Tue, 29 Mar 2011 02:57:28 -0700 (PDT)
  35. X-BeenThere: [email protected]
  36. Received: by 10.223.15.10 with SMTP id i10ls1406705faa.1.p; Tue, 29 Mar 2011
  37. 02:57:26 -0700 (PDT)
  38. Received: by 10.223.144.68 with SMTP id y4mr593740fau.24.1301392646614;
  39. Tue, 29 Mar 2011 02:57:26 -0700 (PDT)
  40. Received: by 10.223.144.68 with SMTP id y4mr593739fau.24.1301392646599;
  41. Tue, 29 Mar 2011 02:57:26 -0700 (PDT)
  42. Received: from beberlei.de (lvps178-77-98-152.dedicated.hosteurope.de [178.77.98.152])
  43. by gmr-mx.google.com with ESMTP id p7si76128faa.9.2011.03.29.02.57.25;
  44. Tue, 29 Mar 2011 02:57:25 -0700 (PDT)
  45. Received-SPF: neutral (google.com: 178.77.98.152 is neither permitted nor denied by best guess record for domain of [email protected]) client-ip=178.77.98.152;
  46. Received: by beberlei.de (Postfix, from userid 33)
  47. id 6B06C6E090ED; Tue, 29 Mar 2011 11:57:25 +0200 (CEST)
  48. Subject: Re: [doctrine-user] Checking existance of a one to one relation
  49. MIME-Version: 1.0
  50. Date: Tue, 29 Mar 2011 11:57:25 +0200
  51. From: Benjamin Eberlei <[email protected]>
  52. In-Reply-To: <[email protected]>
  53. References: <0e0d2d69-214e-4d5c-9bc2-6903f485e18b@d28g2000yqc.googlegroups.com> <[email protected]>
  54. Message-ID: <[email protected]>
  55. User-Agent: RoundCube Webmail/0.3.1
  56. X-Original-Sender: [email protected]
  57. X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com:
  58. 178.77.98.152 is neither permitted nor denied by best guess record for domain
  59. Precedence: list
  60. Mailing-list: list [email protected]; contact [email protected]
  61. List-ID: <doctrine-user.googlegroups.com>
  62. X-Google-Group-Id: 52941642618
  63. List-Post: <http://groups.google.com/group/doctrine-user/post?hl=en_US>, <mailto:[email protected]>
  64. List-Help: <http://groups.google.com/support/?hl=en_US>, <mailto:[email protected]>
  65. List-Archive: <http://groups.google.com/group/doctrine-user?hl=en_US>
  66. List-Unsubscribe: <http://groups.google.com/group/doctrine-user/subscribe?hl=en_US>,
  67. Content-Type: text/plain; charset=ISO-8859-1
  68.  
  69. Besides the isset/private problem Marco already wrote,
  70.  
  71. your @OneToOne has two owning sides, which means two foreign keys are
  72. created. You want to look into "mappedBy" and "inversedBy" to restrict this
  73. to one foreign key only.
  74.  
  75. On Tue, 29 Mar 2011 11:41:39 +0200, Marco Pivetta <[email protected]>
  76. wrote:
  77. > First of all, it's a private var, and you don't have any getters or
  78. setters
  79. > defined.
  80. > Supposing you have User#getProfile() { return $this->profile; } you
  81. should
  82. > just check
  83. > if(empty($user->getProfile()) { /* OMG! */ }
  84. > Marco Pivetta
  85. > @Ocramius <http://twitter.com/Ocramius>
  86. > http://marco-pivetta.com
  87. >
  88. >
  89. >
  90. > On 29 March 2011 11:38, Ivo Roes <[email protected]> wrote:
  91. >
  92. >> I have a simple example:
  93. >>
  94. >> class User {
  95. >> /**
  96. >> * @var integer $id
  97. >> */
  98. >> private $id
  99. >>
  100. >> /**
  101. >> * @var text $name
  102. >> */
  103. >> private $name
  104. >>
  105. >> /**
  106. >> * @OneToOne(targetEntity="Profile")
  107. >> * @JoinColumn(name="id", referencedColumnName="id")
  108. >> */
  109. >> private $profile;
  110. >>
  111. >> }
  112. >>
  113. >> class Profile {
  114. >> /**
  115. >> * @var integer $id
  116. >> */
  117. >> private $id
  118. >>
  119. >> /**
  120. >> * @var text $info
  121. >> */
  122. >> private $info
  123. >>
  124. >> /**
  125. >> * @OneToOne(targetEntity="User")
  126. >> * @JoinColumn(name="id", referencedColumnName="id")
  127. >> */
  128. >> private $user;
  129. >>
  130. >> }
  131. >>
  132. >> Now in my case it is possible that a user doesnt have a profile, but
  133. >> if he does have one, it can be atmost one. So actually its a 0 to 1
  134. >> relationship. I want to test for a certain user if he has a related
  135. >> profile. So I use:
  136. >>
  137. >> $u = $entityManager->find("User",1);
  138. >> var_dump(isset($u->profile));
  139. >>
  140. >> But this always returns false. Is there a way to check if a related
  141. >> entity exists?
  142. >>
  143. >> --
  144. >> You received this message because you are subscribed to the Google
  145. Groups
  146. >> "doctrine-user" group.
  147. >> To post to this group, send email to [email protected].
  148. >> To unsubscribe from this group, send email to
  149. >> For more options, visit this group at
  150. >> http://groups.google.com/group/doctrine-user?hl=en.
  151. >>
  152. >>
  153.  
  154. --
  155. You received this message because you are subscribed to the Google Groups "doctrine-user" group.
  156. To post to this group, send email to [email protected].
  157. To unsubscribe from this group, send email to [email protected].
  158. For more options, visit this group at http://groups.google.com/group/doctrine-user?hl=en.
Advertisement
Add Comment
Please, Sign In to add comment