|
|
@@ -172,12 +172,12 @@ if ($validator->isValid($username)) {
|
|
|
</para>
|
|
|
|
|
|
<programlisting language="php"><![CDATA[
|
|
|
-$post_id = $post->getId();
|
|
|
-$clause = $db->quoteInto('post_id = ?', $category_id);
|
|
|
+$email = 'user@example.com';
|
|
|
+$clause = $db->quoteInto('email = ?', $email);
|
|
|
$validator = new Zend_Validate_Db_RecordExists(
|
|
|
array(
|
|
|
- 'table' => 'posts_categories',
|
|
|
- 'field' => 'post_id',
|
|
|
+ 'table' => 'users',
|
|
|
+ 'field' => 'username',
|
|
|
'exclude' => $clause
|
|
|
)
|
|
|
);
|
|
|
@@ -194,9 +194,10 @@ if ($validator->isValid($username)) {
|
|
|
]]></programlisting>
|
|
|
|
|
|
<para>
|
|
|
- The above example will check the 'posts_categories' table
|
|
|
- to ensure that a record with the 'post_id' has a value
|
|
|
- matching <varname>$category_id</varname>
|
|
|
+ The above example will check the 'users' table
|
|
|
+ to ensure that only a record with both the username
|
|
|
+ <varname>$username</varname> and with the email
|
|
|
+ <varname>$email</varname> is valid.
|
|
|
</para>
|
|
|
</sect3>
|
|
|
|