Пример #1
0
 /**
  *
  * @return Atrox_Core_Data_Source
  */
 public static function getDataSource()
 {
     $dataSource = new Atrox_Core_Data_MySql_Source("TempBlogComment");
     $dataSource->setRecordClassName("Mock_BlogComment");
     $dataSource->addProperty(new Atrox_Core_Data_Property("Id", Atrox_Core_Data_Property::TYPE_INTEGER, "Id", true))->setStorage(Atrox_Core_Data_Property::STORE_NEVER);
     $dataSource->addProperty(new Atrox_Core_Data_Property("BlogId", Atrox_Core_Data_Property::TYPE_RELATION, "Blog Id"))->setRelation("Mock_Blog");
     $dataSource->addProperty(new Atrox_Core_Data_Property("Comment", Atrox_Core_Data_Property::TYPE_STRING, "Comment"))->addValidator(new Atrox_Core_Data_Validator_Required())->addValidator(new Atrox_Core_Data_Validator_MaxLength(1000));
     $dataSource->addProperty(new Atrox_Core_Data_Property("DateCreated", Atrox_Core_Data_Property::TYPE_DATE, "Date Created"))->setStorage(Atrox_Core_Data_Property::STORE_NEVER);
     return $dataSource;
 }
Пример #2
0
 /**
  *
  * @return Atrox_Core_Data_Source
  */
 public static function getDataSource()
 {
     static $dataSource;
     if (!$dataSource) {
         $dataSource = new Atrox_Core_Data_MySql_Source("TempBlog");
         $dataSource->setRecordClassName("Mock_MySql_Blog");
         $dataSource->addProperty(new Atrox_Core_Data_Property("Id", Atrox_Core_Data_Property::TYPE_INTEGER, "Id", true))->setStorage(Atrox_Core_Data_Property::STORE_NEVER);
         $dataSource->addProperty(new Atrox_Core_Data_Property("Title", Atrox_Core_Data_Property::TYPE_STRING, "Title"))->addValidator(new Atrox_Core_Data_Validator_Required())->addValidator(new Atrox_Core_Data_Validator_MaxLength(50))->setDefault("This is the default title");
         $dataSource->addProperty(new Atrox_Core_Data_Property("Description", Atrox_Core_Data_Property::TYPE_STRING, "Description", true))->addValidator(new Atrox_Core_Data_Validator_Required())->addValidator(new Atrox_Core_Data_Validator_MaxLength(1000));
         $dataSource->addProperty(new Atrox_Core_Data_Property("DateCreated", Atrox_Core_Data_Property::TYPE_DATE, "Date Created"))->setStorage(Atrox_Core_Data_Property::STORE_NEVER);
         $dataSource->addProperty(new Atrox_Core_Data_Property("Active", Atrox_Core_Data_Property::TYPE_BOOLEAN, "Active"))->setDefault(true);
     }
     return $dataSource;
 }