eZ Publish  [4.0]
ezuseraccountkey.php
Go to the documentation of this file.
00001 <?php
00002 //
00003 // Definition of eZUserAccountKey class
00004 //
00005 // Created on: <22-Mar-2003 14:52:37 bf>
00006 //
00007 // ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
00008 // SOFTWARE NAME: eZ Publish
00009 // SOFTWARE RELEASE: 4.0.x
00010 // COPYRIGHT NOTICE: Copyright (C) 1999-2008 eZ Systems AS
00011 // SOFTWARE LICENSE: GNU General Public License v2.0
00012 // NOTICE: >
00013 //   This program is free software; you can redistribute it and/or
00014 //   modify it under the terms of version 2.0  of the GNU General
00015 //   Public License as published by the Free Software Foundation.
00016 //
00017 //   This program is distributed in the hope that it will be useful,
00018 //   but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 //   GNU General Public License for more details.
00021 //
00022 //   You should have received a copy of version 2.0 of the GNU General
00023 //   Public License along with this program; if not, write to the Free
00024 //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00025 //   MA 02110-1301, USA.
00026 //
00027 //
00028 // ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
00029 //
00030 
00031 /*! \file ezuseraccountkey.php
00032 */
00033 
00034 /*!
00035   \class eZUserAccountKey ezuseraccountkey.php
00036   \ingroup eZDatatype
00037   \brief The class eZUserAccountKey does
00038 
00039 */
00040 
00041 //include_once( "kernel/classes/ezpersistentobject.php" );
00042 
00043 class eZUserAccountKey extends eZPersistentObject
00044 {
00045     /*!
00046      Constructor
00047     */
00048     function eZUserAccountKey( $row = array() )
00049     {
00050         $this->eZPersistentObject( $row );
00051     }
00052 
00053     static function definition()
00054     {
00055         return array( "fields" => array( "id" => "ID",
00056                                          "user_id" => "UserID",
00057                                          "hash_key" => "HashKey",
00058                                          "time" => "Time"
00059                                          ),
00060                       "keys" => array( "id" ),
00061                       "increment_key" => "id",
00062                       "sort" => array( "id" => "asc" ),
00063                       "class_name" => "eZUserAccountKey",
00064                       "name" => "ezuser_accountkey" );
00065     }
00066 
00067     static function createNew( $userID, $hashKey, $time)
00068     {
00069         return new eZUserAccountKey( array( "user_id" => $userID,
00070                                             "hash_key" => $hashKey,
00071                                             "time" => $time ) );
00072     }
00073 
00074     static function fetchByKey( $hashKey )
00075     {
00076         return eZPersistentObject::fetchObject( eZUserAccountKey::definition(),
00077                                                 null,
00078                                                 array( "hash_key" => $hashKey ),
00079                                                 true );
00080     }
00081 
00082     /*!
00083      Remove account keys belonging to user \a $userID
00084     */
00085     static function removeByUserID( $userID )
00086     {
00087         eZPersistentObject::removeObject( eZUserAccountKey::definition(),
00088                                           array( 'user_id' => $userID ) );
00089     }
00090 
00091 }
00092 
00093 ?>