function _init() { // FIELD DEFINITION self::$fields = array('id' => ORM::field('auto[11]'), 'location_name' => ORM::field('char[255]', array('required')), 'denomination' => ORM::field('char[255]', array('required')), 'address' => ORM::field('char[255]', array('required')), 'city' => ORM::field('char[255]', array('required')), 'state' => ORM::field('char[255]', array('required')), 'zip' => ORM::field('char[255]', array('required', 'min_length[5]', 'max_length[5]', 'numeric')), 'user_id' => ORM::field('int[11]'), 'location_phone' => ORM::field('char[255]', array('required')), 'twilio_number' => ORM::field('char[255]', array('required')), 'created_at' => ORM::field('datetime'), 'updated_at' => ORM::field('datetime')); // // SETUP DATETIME ASSOCIATION $this->ts_fields = array('updated_at', '[created_at]'); }
function _init() { // FIELD DEFINITION self::$fields = array('id' => ORM::field('auto[11]'), 'campaign' => ORM::field('varchar[35]'), 'location_id' => ORM::field('int[11]'), 'created_at' => ORM::field('datetime'), 'updated_at' => ORM::field('datetime')); // // SETUP DATETIME ASSOCIATION $this->ts_fields = array('updated_at', '[created_at]'); }
function _init() { // FIELD DEFINITION self::$fields = array('id' => ORM::field('auto[11]'), 'first_name' => ORM::field('char[255]', array('required')), 'last_name' => ORM::field('char[255]', array('required')), 'username' => ORM::field('email', array('required', 'is_unique[users.username]')), 'password' => ORM::field('string', array('required')), 'role' => ORM::field('char[255]'), 'status' => ORM::field('char[255]'), 'created_at' => ORM::field('datetime'), 'updated_at' => ORM::field('datetime')); // // SETUP DATETIME ASSOCIATION $this->ts_fields = array('updated_at', '[created_at]'); }
function _init() { // Relationship definition self::$relationships = array('reply' => ORM::has_many('\\Model\\Reply')); // FIELD DEFINITION self::$fields = array('id' => ORM::field('auto[11]'), 'feedback' => ORM::field('text'), 'customer_number' => ORM::field('char[255]'), 'location_id' => ORM::field('int[11]'), 'created_at' => ORM::field('datetime'), 'updated_at' => ORM::field('datetime')); // // SETUP DATETIME ASSOCIATION $this->ts_fields = array('updated_at', '[created_at]'); }
function _init() { // Relationship definition self::$relationships = array('feedback' => ORM::belongs_to('\\Model\\Feedback')); // FIELD DEFINITION self::$fields = array('id' => ORM::field('auto[11]'), 'reply' => ORM::field('text'), 'feedback_id' => ORM::field('int[11]'), 'user_id' => ORM::field('int[11]'), 'created_at' => ORM::field('datetime'), 'updated_at' => ORM::field('datetime')); // // SETUP DATETIME ASSOCIATION $this->ts_fields = array('updated_at', '[created_at]'); }
function _init() { self::$relationships = array('blog' => ORM::has_many('\\Model\\Blog'), 'passphrase' => ORM::has_one('\\Model\\User_passphrase')); self::$fields = array('id' => ORM::field('auto[10]'), 'email' => ORM::field('char[64]'), 'modified' => ORM::field('datetime'), 'created' => ORM::field('datetime')); $this->ts_fields = array('modified', '[created]'); }
function _init() { self::$fields = array('idadministrador' => ORM::field('auto[11]'), 'adm_email' => ORM::field('varchar[90]'), 'adm_password' => ORM::field('varchar[100]'), 'adm_estado' => ORM::field('tinyint[1]'), 'adm_img' => ORM::field('varchar[100]')); }
function _init() { self::$fields = array('idprovincia' => ORM::field('varchar[2]'), 'pro_descripcion' => ORM::field('varchar[85]'), 'iddepartamento' => ORM::field('varchar[2]'), 'pro_estado' => ORM::field('tinyint[1]')); }
function _init() { // Define relationships self::$relationships = array('user' => ORM::belongs_to('\\Model\\User'), 'job' => ORM::belongs_to('\\Model\\Job')); // Define fields definition self::$fields = array('id' => ORM::field('auto[3]'), 'user_id' => ORM::field('int[3]'), 'job_id' => ORM::field('int[3]')); }
function _init() { self::$relationships = array('post' => ORM::has_many('\\Model\\Post\\Media => \\Model\\Post'), 'file' => ORM::belongs_to('\\Model\\File')); self::$fields = array('id' => ORM::field('auto[11]'), 'file_id' => ORM::field('numeric', array(), 'INT'), 'type' => ORM::field('string', array('required'), 'ENUM'), 'span' => ORM::field('numeric', array(), 'INT'), 'alt' => ORM::field('char[3,55]', array('required', 'max_length[55]')), 'modified' => ORM::field('datetime'), 'created' => ORM::field('datetime')); $this->ts_fields = array('modified', '[created]'); }
function _init() { self::$relationships = array(); self::$fields = array('id' => ORM::field('auto[11]'), 'slug' => ORM::field('char[2,155]', array('required', 'max_length[155]')), 'controller' => ORM::field('char[2,155]', array('required', 'max_length[155]')), 'created' => ORM::field('datetime')); $this->ts_fields = array('[created]'); }
/** * Synchronize models state with database * * @param object Models * @return void */ public static final function syncdb(ORM $gas) { $table = $gas->validate_table()->table; $primary_key = $gas->primary_key; $foreign_key = $gas->foreign_key; // Check table existence if (self::driver('sqlite')) { return Core::$db->truncate($table); } elseif (Core::$db->table_exists($table)) { return Core::$db->truncate($table); } //Build the new one now foreach ($gas->meta->get('fields') as $field => $rule) { $annotation = $rule['annotations']; $fields[$field] = Core::identify_annotation($annotation); } // Add the field annotations self::forge()->add_field($fields); // Add primay key if exists if (!empty($primary_key)) { self::forge()->add_key($primary_key, TRUE); } // Add composite keys if exists if (!empty($foreign_key)) { foreach ($foreign_key as $key) { self::forge()->add_key($key, TRUE); } } // Create those table if necessary if (!Core::$db->table_exists($table)) { self::forge()->create_table($table); } }
function _init() { // Define relationships self::$relationships = array('user' => ORM::belongs_to('\\Model\\User'), 'role' => ORM::belongs_to('\\Model\\Role')); // Define fields definition self::$fields = array('u_id' => ORM::field('int[3]'), 'r_id' => ORM::field('int[3]')); }
function _init() { // Define relationships self::$relationships = array('wife' => ORM::has_one('\\Model\\Wife', array('select:id,name')), 'kid' => ORM::has_many('\\Model\\Kid', array('select:id,name')), 'job' => ORM::has_many('\\Model\\Job\\User => \\Model\\Job', array('select:id,name')), 'role' => ORM::has_many('\\Model\\Role\\User => \\Model\\Role', array('select:id,name'))); // Define fields definition self::$fields = array('id' => ORM::field('auto[3]'), 'name' => ORM::field('char[40]'), 'email' => ORM::field('email[40]'), 'username' => ORM::field('char[10]', array('required', 'callback_username_check'))); }
function _init() { // Define relationships self::$relationships = array('user' => ORM::belongs_to('\\Model\\User')); // Define fields definition self::$fields = array('id' => ORM::field('auto[3]'), 'user_id' => ORM::field('int[3]'), 'name' => ORM::field('char[40]'), 'hair_color' => ORM::field('email[20]')); }
function _init() { self::$fields = array('idCategoria' => ORM::field('auto[10]'), 'nomeCategoria' => ORM::field('char[45]')); self::$relationships = array('produtos' => ORM::has_many('\\Model\\Produtos')); }
function _init() { self::$relationships = array('post' => ORM::belongs_to('\\Model\\Post'), 'media' => ORM::belongs_to('\\Model\\Media')); self::$fields = array('id' => ORM::field('auto[11]'), 'invoice_id' => ORM::field('numeric', array(), 'INT'), 'reservation_id' => ORM::field('numeric', array(), 'INT'), 'created' => ORM::field('datetime', array(), 'TIMESTAMP')); $this->ts_fields = array('[created]'); }
function _init() { self::$relationships = array('user' => ORM::belongs_to('\\Model\\Blog'), 'route' => ORM::belongs_to('\\Model\\Route'), 'media' => ORM::has_many('\\Model\\Post\\Media => \\Model\\Media')); self::$fields = array('id' => ORM::field('auto[11]'), 'title' => ORM::field('char[3,155]', array('required', 'max_length[155]')), 'summary' => ORM::field('string', array(), 'LONGTEXT'), 'content_raw' => ORM::field('string', array(), 'LONGTEXT'), 'content' => ORM::field('string', array(), 'LONGTEXT'), 'modified' => ORM::field('datetime'), 'created' => ORM::field('datetime')); $this->ts_fields = array('modified', '[created]'); }
function _init() { // Define relationships self::$relationships = array('user' => ORM::belongs_to('\\Model\\User', array('select:id,name,username'))); // Define fields definition self::$fields = array('id' => ORM::field('auto[3]'), 'user_id' => ORM::field('int[3]'), 'name' => ORM::field('char[40]'), 'age' => ORM::field('int[3]')); }
function _init() { self::$relationships = array('media' => ORM::has_one('\\Model\\Media')); self::$fields = array('id' => ORM::field('auto[11]'), 'mime_id' => ORM::field('numeric', array(), 'INT'), 'name' => ORM::field('char[3,155]', array('required', 'max_length[155]')), 'path' => ORM::field('char[3,255]', array('required', 'max_length[255]')), 'modified' => ORM::field('datetime'), 'created' => ORM::field('datetime')); $this->ts_fields = array('modified', '[created]'); }
function _init() { self::$fields = array('idProduto' => ORM::field('auto[10]'), 'nomeProduto' => ORM::field('char[45]')); self::$relationships = array('categoria' => ORM::belongs_to('\\Model\\Categorias')); }
function _init() { // Define relationships self::$relationships = array('user' => ORM::has_many('\\Model\\Role\\User => \\Model\\User', array('select:id,name,username'))); // Define fields definition self::$fields = array('id' => ORM::field('auto[3]'), 'name' => ORM::field('char[40]'), 'description' => ORM::field('char[100]')); }
function _init() { self::$fields = array('idcliente' => ORM::field('auto[11]'), 'cli_nomyape' => ORM::field('varchar[90]'), 'cli_sexo' => ORM::field('varchar[15]'), 'cli_nacionalidad' => ORM::field('varchar[25]'), 'cli_edad' => ORM::field('int[11]'), 'cli_email' => ORM::field('varchar[90]'), 'cli_estado' => ORM::field('tinyint[1]'), 'cli_password' => ORM::field('varchar[100]')); }