ForeignChangeAction.class.php

Go to the documentation of this file.
00001 <?php
00002 /***************************************************************************
00003  *   Copyright (C) 2006-2007 by Konstantin V. Arkhipov                     *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU Lesser General Public License as        *
00007  *   published by the Free Software Foundation; either version 3 of the    *
00008  *   License, or (at your option) any later version.                       *
00009  *                                                                         *
00010  ***************************************************************************/
00011 
00015     final class ForeignChangeAction extends Enumeration
00016     {
00017         const NO_ACTION     = 0x01;
00018         const RESTRICT      = 0x02;
00019         const CASCADE       = 0x03;
00020         const SET_NULL      = 0x04;
00021         const SET_DEFAULT   = 0x05;
00022         
00023         protected $names = array(
00024             self::NO_ACTION     => 'NO ACTION', // default one
00025             self::RESTRICT      => 'RESTRICT',
00026             self::CASCADE       => 'CASCADE',
00027             self::SET_NULL      => 'SET NULL',
00028             self::SET_DEFAULT   => 'SET DEFAULT'
00029         );
00030         
00034         public static function noAction()
00035         {
00036             return new self(self::NO_ACTION);
00037         }
00038         
00042         public static function restrict()
00043         {
00044             return new self(self::RESTRICT);
00045         }
00046         
00050         public static function cascade()
00051         {
00052             return new self(self::CASCADE);
00053         }
00054         
00058         public static function setNull()
00059         {
00060             return new self(self::SET_NULL);
00061         }
00062         
00066         public static function setDefault()
00067         {
00068             return new self(self::SET_DEFAULT);
00069         }
00070     }
00071 ?>