function __construct($args = array(), $isSimpleInstance = false) { $this->setWithTable("test_i005_recipiente"); $this->addAttribute("material", Datatypes::TEXT); $this->addAttribute("capacidad", Datatypes::FLOAT_NUMBER); $this->addAttribute("tieneTapa", Datatypes::BOOLEAN); $this->addConstraints("material", array(Constraint::maxLength(30), Constraint::blank(false))); $this->addConstraints("capacidad", array(Constraint::between(0.0, 10.0))); $this->addConstraints("tieneTapa", array(Constraint::nullable(true))); /* $this->constraints = array ( "material" => array ( Constraint :: maxLength(30), Constraint :: blank(false) ), "capacidad" => array ( Constraint :: between(0.0, 10.0) ), "tieneTapa" => array ( Constraint :: nullable(true) ) ); */ parent::__construct($args, $isSimpleInstance); }
function __construct($args = array(), $isSimpleInstance = false) { $this->setWithTable("test_i006_vaso1"); $this->addAttribute("marca", Datatypes::TEXT); // TODO: seria bueno probar una Constraint de que el volumen // del contenido no pueda ser mayor que la capacidad del recipiente. $this->addHasOne("contenido", "Contenido1"); parent::__construct($args, $isSimpleInstance); // WARNING: // para definir una restriccion sobre un atributo de la superclase, // debe inicializarse la superclase primero. $this->addConstraints("material", array(Constraint::maxLength(30), Constraint::blank(false), Constraint::inList(array("vidrio", "plastico")))); $this->addConstraints("marca", array(Constraint::nullable(true))); /* $this->constraints = array ( "material" => array ( Constraint :: maxLength(30), Constraint :: blank(false), Constraint :: inList( array("vidrio","plastico") ) // TODO: probar si se verifican estas restricciones para Vaso o si se verifican las de Recipiente... ), "marca" => array ( Constraint :: nullable(true) ) ); */ // WARNING: atributos del padre se inicializan luego de inicializar el padre! // Supongo que estos vasos no tienen tapa $this->setTieneTapa(false); }
function __construct($args = array(), $isSimpleInstance = false) { $this->setWithTable("hello_world_persona"); $this->addAttribute("nombre", Datatypes::TEXT); $this->addAttribute("edad", Datatypes::INT_NUMBER); $this->addConstraints("nombre", array(Constraint::maxLength(30), Constraint::blank(false))); $this->addConstraints("edad", array(Constraint::between(10, 100))); parent::__construct($args, $isSimpleInstance); }
function __construct($args = array(), $isSimpleInstance = false) { $this->setWithTable("test_001_botella"); $this->addAttribute("material", Datatypes::TEXT); $this->addAttribute("capacidad", Datatypes::FLOAT_NUMBER); $this->addAttribute("tapaRosca", Datatypes::BOOLEAN); $this->addConstraints("material", array(Constraint::maxLength(30), Constraint::blank(false))); $this->addConstraints("capacidad", array(Constraint::between(0.0, 10.0))); $this->addConstraints("tapaRosca", array(Constraint::nullable(true))); parent::__construct($args, $isSimpleInstance); }
function __construct($args = array(), $isSimpleInstance = false) { $this->setWithTable("test_a004_pagina"); $this->addAttribute("titulo", Datatypes::TEXT); $this->addAttribute("contenido", Datatypes::TEXT); // Pagina padre $this->addHasOne('owner', 'Pagina'); // Paginas hijas $this->addHasMany('subpages', 'Pagina'); $this->addConstraints("titulo", array(Constraint::maxLength(255))); $this->addConstraints("contenido", array(Constraint::maxLength(100000))); $this->addConstraints("owner", array(Constraint::nullable(true))); parent::__construct($args, $isSimpleInstance); }
function __construct($args = array(), $isSimpleInstance = false) { $this->setWithTable(self::TABLE); // message data $this->addAttribute('text', Datatypes::TEXT); $this->addAttribute('createdOn', Datatypes::DATETIME); // associations $this->addHasOne('createdBy', 'TUser'); // the user that creates this twitter message // default values $this->setCreatedOn(date("Y-m-d H:i:s")); // Ya con formato de MySQL! // constraints $this->addConstraints('text', array(Constraint::maxLength(160), Constraint::nullable(false), Constraint::blank(false))); parent::__construct($args, $isSimpleInstance); }
function __construct($args = array(), $isSimpleInstance = false) { $this->setWithTable(self::TABLE); // user data $this->addAttribute('name', Datatypes::TEXT); $this->addAttribute('email', Datatypes::TEXT); // auth $this->addAttribute('username', Datatypes::TEXT); $this->addAttribute('password', Datatypes::TEXT); // associations $this->addHasMany('following', 'TUser', PersistentObject::HASMANY_SET); // users I follow, is a set // constraints $this->addConstraints('name', array(Constraint::minLength(1), Constraint::maxLength(255), Constraint::nullable(false), Constraint::blank(false))); $this->addConstraints('username', array(Constraint::blank(false))); $this->addConstraints('password', array(Constraint::minLength(4))); $this->addConstraints('email', array(Constraint::email())); parent::__construct($args, $isSimpleInstance); }
function __construct($args = array(), $isSimpleInstance = false) { $this->setWithTable("test_i005_contenido"); $this->addAttribute("elemento", Datatypes::TEXT); $this->addAttribute("volumen", Datatypes::FLOAT_NUMBER); $this->addConstraints("elemento", array(Constraint::maxLength(30), Constraint::blank(false))); $this->addConstraints("volumen", array(Constraint::between(0.0, 10.0))); /* $this->constraints = array ( "elemento" => array ( Constraint :: maxLength(30), Constraint :: blank(false) ), "volumen" => array ( Constraint :: between(0.0, 10.0) ) ); */ parent::__construct($args, $isSimpleInstance); }
function __construct($args = array(), $isSimpleInstance = false) { $this->setWithTable("test_i006_contenido1"); $this->belongsTo = array('Vaso1'); // La unica diferencia con respecto al test i005 $this->addAttribute("elemento", Datatypes::TEXT); $this->addAttribute("volumen", Datatypes::FLOAT_NUMBER); $this->addConstraints("elemento", array(Constraint::maxLength(30), Constraint::blank(false))); $this->addConstraints("volumen", array(Constraint::between(0.0, 10.0))); /* $this->constraints = array ( "elemento" => array ( Constraint :: maxLength(30), Constraint :: blank(false) ), "volumen" => array ( Constraint :: between(0.0, 10.0) ) ); */ parent::__construct($args, $isSimpleInstance); }