Browse Source

ZF-11238: Documentation, improved example for Zend_Validate_Db_*

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@23832 44c647ce-9c0f-0410-b52a-842ac1e357ba
bittarman 15 years ago
parent
commit
6612a07de7
1 changed files with 8 additions and 7 deletions
  1. 8 7
      documentation/manual/en/module_specs/Zend_Validate-Db.xml

+ 8 - 7
documentation/manual/en/module_specs/Zend_Validate-Db.xml

@@ -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>