Message from discussion
Doctrine_Record::hasValue()
Received: by 10.151.132.4 with SMTP id j4mr172269ybn.6.1246069406511;
Fri, 26 Jun 2009 19:23:26 -0700 (PDT)
Return-Path: <adam.hutt...@fracturedatlas.org>
Received: from cepheus.geminisbs.net (cepheus.geminisbs.net [206.71.147.202])
by gmr-mx.google.com with ESMTP id 15si343111gxk.4.2009.06.26.19.23.26;
Fri, 26 Jun 2009 19:23:26 -0700 (PDT)
Received-SPF: pass (google.com: domain of adam.hutt...@fracturedatlas.org designates 206.71.147.202 as permitted sender) client-ip=206.71.147.202;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of adam.hutt...@fracturedatlas.org designates 206.71.147.202 as permitted sender) smtp.mail=adam.hutt...@fracturedatlas.org
Received: from localhost (localhost.localdomain [127.0.0.1])
by cepheus.geminisbs.net (Postfix) with ESMTP id E630E4520002
for <doctrine-dev@googlegroups.com>; Fri, 26 Jun 2009 22:19:41 -0400 (EDT)
X-Virus-Scanned: amavisd-new at cepheus.geminisbs.net
Received: from cepheus.geminisbs.net ([127.0.0.1])
by localhost (cepheus.geminisbs.net [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id i0JaZO6ilLdT for <doctrine-dev@googlegroups.com>;
Fri, 26 Jun 2009 22:19:41 -0400 (EDT)
Received: from cepheus.geminisbs.net (cepheus.geminisbs.net [206.71.147.202])
by cepheus.geminisbs.net (Postfix) with ESMTP id 98C9C67940E
for <doctrine-dev@googlegroups.com>; Fri, 26 Jun 2009 22:19:41 -0400 (EDT)
From: "Adam Huttler" <adam.hutt...@fracturedatlas.org>
To: <doctrine-dev@googlegroups.com>
Subject: Doctrine_Record::hasValue()
Date: Fri, 26 Jun 2009 22:19:41 -0400 (EDT)
Message-ID: <000801c9f6ce$3c061fe0$b4125fa0$@huttler@fracturedatlas.org>
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_NextPart_000_0009_01C9F6AC.B4F47FE0"
X-Mailer: Microsoft Office Outlook 12.0
X-Mailer: Zimbra 5.0.16_GA_2921.RHEL5 (ZimbraConnectorForOutlook/5.0.2988.16)
Content-Language: en-us
Thread-Index: Acn2zjuMeupuUju9SkWLjn/2D5LK2g==
This is a multi-part message in MIME format.
------=_NextPart_000_0009_01C9F6AC.B4F47FE0
Content-Type: multipart/alternative;
boundary="----=_NextPart_001_000A_01C9F6AC.B4F47FE0"
------=_NextPart_001_000A_01C9F6AC.B4F47FE0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
Attached is a patch to add Doctrine_Record::hasValue().
Would anyone object to adding this? There's already
Doctrine_Table::hasField() and Doctrine_Record::hasRelation(), but there's
currently no public interface for determining if a custom property has
been defined.
It could alternately be named hasMappedValue(), but that seems awkward to
me.
Thanks,
Adam
------=_NextPart_001_000A_01C9F6AC.B4F47FE0
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns=3D"http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin-top:0in;
margin-right:0in;
margin-bottom:10.0pt;
margin-left:0in;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
.MsoPapDefault
{mso-style-type:export-only;
margin-bottom:10.0pt;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=3DEN-US link=3Dblue vlink=3Dpurple>
<div class=3DSection1>
<p class=3DMsoNormal>Attached is a patch to add =
Doctrine_Record::hasValue().<o:p></o:p></p>
<p class=3DMsoNormal>Would anyone object to adding this? There’s =
already
Doctrine_Table::hasField() and Doctrine_Record::hasRelation(), but =
there’s
currently no public interface for determining if a custom property has =
been
defined.<o:p></o:p></p>
<p class=3DMsoNormal>It could alternately be named hasMappedValue(), but =
that
seems awkward to me.<o:p></o:p></p>
<p class=3DMsoNormal>Thanks,<br>
Adam<o:p></o:p></p>
</div>
</body>
</html>
------=_NextPart_001_000A_01C9F6AC.B4F47FE0--
------=_NextPart_000_0009_01C9F6AC.B4F47FE0
Content-Type: text/plain;
name="diff.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="diff.txt"
Index: Doctrine/Record.php
===================================================================
--- Doctrine/Record.php (revision 5906)
+++ Doctrine/Record.php (working copy)
@@ -2188,6 +2188,16 @@
}
/**
+ * tests whether a mapped value exists
+ * @param string $name the name of the property
+ * @return boolean
+ */
+ public function hasValue($name)
+ {
+ return array_key_exists($name, $this->_values);
+ }
+
+ /**
* gets a related component
*
* @param string $name
------=_NextPart_000_0009_01C9F6AC.B4F47FE0--