<?php

/**
 * BaseUser
 * 
 * This class has been auto-generated by the Doctrine ORM Framework
 * 
 * @property string $username
 * @property string $name
 * @property string $email
 * @property string $address
 * @property string $email_check
 * @property string $email_change
 * @property string $email_change_check
 * @property enum $social
 * @property string $phone
 * @property string $phone_check
 * @property string $phone_change
 * @property string $salt
 * @property string $password
 * @property string $password_recovery
 * @property boolean $is_active
 * @property boolean $is_blocked
 * @property boolean $is_super_admin
 * @property timestamp $last_login
 * @property Doctrine_Collection $UserPermissions
 * @property Doctrine_Collection $UserGroup
 * @property Doctrine_Collection $UserGroupUsers
 * @property Doctrine_Collection $UserLog
 * @property Doctrine_Collection $Session
 * @property Doctrine_Collection $Export
 * 
 * @method string              getUsername()           Returns the current record's "username" value
 * @method string              getName()               Returns the current record's "name" value
 * @method string              getEmail()              Returns the current record's "email" value
 * @method string              getAddress()            Returns the current record's "address" value
 * @method string              getEmailCheck()         Returns the current record's "email_check" value
 * @method string              getEmailChange()        Returns the current record's "email_change" value
 * @method string              getEmailChangeCheck()   Returns the current record's "email_change_check" value
 * @method enum                getSocial()             Returns the current record's "social" value
 * @method string              getPhone()              Returns the current record's "phone" value
 * @method string              getPhoneCheck()         Returns the current record's "phone_check" value
 * @method string              getPhoneChange()        Returns the current record's "phone_change" value
 * @method string              getSalt()               Returns the current record's "salt" value
 * @method string              getPassword()           Returns the current record's "password" value
 * @method string              getPasswordRecovery()   Returns the current record's "password_recovery" value
 * @method boolean             getIsActive()           Returns the current record's "is_active" value
 * @method boolean             getIsBlocked()          Returns the current record's "is_blocked" value
 * @method boolean             getIsSuperAdmin()       Returns the current record's "is_super_admin" value
 * @method timestamp           getLastLogin()          Returns the current record's "last_login" value
 * @method Doctrine_Collection getUserPermissions()    Returns the current record's "UserPermissions" collection
 * @method Doctrine_Collection getUserGroup()          Returns the current record's "UserGroup" collection
 * @method Doctrine_Collection getUserGroupUsers()     Returns the current record's "UserGroupUsers" collection
 * @method Doctrine_Collection getUserLog()            Returns the current record's "UserLog" collection
 * @method Doctrine_Collection getSession()            Returns the current record's "Session" collection
 * @method Doctrine_Collection getExport()             Returns the current record's "Export" collection
 * @method User                setUsername()           Sets the current record's "username" value
 * @method User                setName()               Sets the current record's "name" value
 * @method User                setEmail()              Sets the current record's "email" value
 * @method User                setAddress()            Sets the current record's "address" value
 * @method User                setEmailCheck()         Sets the current record's "email_check" value
 * @method User                setEmailChange()        Sets the current record's "email_change" value
 * @method User                setEmailChangeCheck()   Sets the current record's "email_change_check" value
 * @method User                setSocial()             Sets the current record's "social" value
 * @method User                setPhone()              Sets the current record's "phone" value
 * @method User                setPhoneCheck()         Sets the current record's "phone_check" value
 * @method User                setPhoneChange()        Sets the current record's "phone_change" value
 * @method User                setSalt()               Sets the current record's "salt" value
 * @method User                setPassword()           Sets the current record's "password" value
 * @method User                setPasswordRecovery()   Sets the current record's "password_recovery" value
 * @method User                setIsActive()           Sets the current record's "is_active" value
 * @method User                setIsBlocked()          Sets the current record's "is_blocked" value
 * @method User                setIsSuperAdmin()       Sets the current record's "is_super_admin" value
 * @method User                setLastLogin()          Sets the current record's "last_login" value
 * @method User                setUserPermissions()    Sets the current record's "UserPermissions" collection
 * @method User                setUserGroup()          Sets the current record's "UserGroup" collection
 * @method User                setUserGroupUsers()     Sets the current record's "UserGroupUsers" collection
 * @method User                setUserLog()            Sets the current record's "UserLog" collection
 * @method User                setSession()            Sets the current record's "Session" collection
 * @method User                setExport()             Sets the current record's "Export" collection
 * 
 * @package    sf
 * @subpackage model
 * @author     Atma
 * @version    SVN: $Id: Builder.php 7490 2010-03-29 19:53:27Z jwage $
 */
abstract class BaseUser extends sfDoctrineRecord
{
    public function setTableDefinition()
    {
        $this->setTableName('user');
        $this->hasColumn('username', 'string', 255, array(
             'type' => 'string',
             'notnull' => true,
             'unique' => true,
             'length' => 255,
             ));
        $this->hasColumn('name', 'string', 255, array(
             'type' => 'string',
             'notnull' => true,
             'length' => 255,
             ));
        $this->hasColumn('email', 'string', 128, array(
             'type' => 'string',
             'length' => 128,
             ));
        $this->hasColumn('address', 'string', 255, array(
             'type' => 'string',
             'length' => 255,
             ));
        $this->hasColumn('email_check', 'string', 255, array(
             'type' => 'string',
             'length' => 255,
             ));
        $this->hasColumn('email_change', 'string', 128, array(
             'type' => 'string',
             'notnull' => true,
             'length' => 128,
             ));
        $this->hasColumn('email_change_check', 'string', 255, array(
             'type' => 'string',
             'length' => 255,
             ));
        $this->hasColumn('social', 'enum', null, array(
             'type' => 'enum',
             'values' => 
             array(
              0 => 'vk',
              1 => 'fb',
              2 => 'google',
              3 => 'apple',
             ),
             ));
        $this->hasColumn('phone', 'string', 11, array(
             'type' => 'string',
             'length' => 11,
             ));
        $this->hasColumn('phone_check', 'string', 255, array(
             'type' => 'string',
             'length' => 255,
             ));
        $this->hasColumn('phone_change', 'string', 11, array(
             'type' => 'string',
             'notnull' => true,
             'length' => 11,
             ));
        $this->hasColumn('salt', 'string', 128, array(
             'type' => 'string',
             'length' => 128,
             ));
        $this->hasColumn('password', 'string', 128, array(
             'type' => 'string',
             'length' => 128,
             ));
        $this->hasColumn('password_recovery', 'string', 255, array(
             'type' => 'string',
             'length' => 255,
             ));
        $this->hasColumn('is_active', 'boolean', null, array(
             'type' => 'boolean',
             'default' => false,
             'notnull' => true,
             ));
        $this->hasColumn('is_blocked', 'boolean', null, array(
             'type' => 'boolean',
             'default' => false,
             'notnull' => true,
             ));
        $this->hasColumn('is_super_admin', 'boolean', null, array(
             'type' => 'boolean',
             'default' => false,
             ));
        $this->hasColumn('last_login', 'timestamp', null, array(
             'type' => 'timestamp',
             ));


        $this->index('name_idx', array(
             'fields' => 
             array(
              0 => 'username',
             ),
             'unique' => true,
             ));
    }

    public function setUp()
    {
        parent::setUp();
        $this->hasMany('Permission as UserPermissions', array(
             'refClass' => 'UserPermissions',
             'local' => 'user_id',
             'foreign' => 'permission_id',
             'onDelete' => 'CASCADE'));

        $this->hasMany('UserGroup', array(
             'refClass' => 'UserGroupUsers',
             'local' => 'user_id',
             'foreign' => 'user_group_id',
             'onDelete' => 'CASCADE'));

        $this->hasMany('UserGroupUsers', array(
             'local' => 'id',
             'foreign' => 'user_id'));

        $this->hasMany('UserLog', array(
             'local' => 'id',
             'foreign' => 'user_id'));

        $this->hasMany('Session', array(
             'local' => 'id',
             'foreign' => 'user_id'));

        $this->hasMany('Export', array(
             'local' => 'id',
             'foreign' => 'user_id'));

        $timestampable0 = new Doctrine_Template_Timestampable();
        $softdelete0 = new Doctrine_Template_SoftDelete();
        $this->actAs($timestampable0);
        $this->actAs($softdelete0);
    }
}