當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DataModel::Type方法代碼示例

本文整理匯總了PHP中DataModel::Type方法的典型用法代碼示例。如果您正苦於以下問題:PHP DataModel::Type方法的具體用法?PHP DataModel::Type怎麽用?PHP DataModel::Type使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DataModel的用法示例。


在下文中一共展示了DataModel::Type方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: DataModel

<?php

require_once "datamodel.class.php";
require_once "database.inc.php";
$_MODEL = new DataModel($_MYSQLI);
$_MODEL->defineEntityModel("user", array("user_id" => DataModel::Type("PrimaryKey"), "user_firstname" => DataModel::Type("NotEmptyString"), "user_lastname" => DataModel::Type("NotEmptyString"), "user_email" => DataModel::Type("Email"), "user_password" => DataModel::Type("NotEmptyString"), "user_address" => DataModel::Type("NotEmptyString"), "user_phone" => DataModel::Type("Phone"), "user_rank" => DataModel::Type("Rank")), "users");
$_MODEL->defineEntityModel("object", array("object_id" => DataModel::Type("PrimaryKey"), "object_name" => DataModel::Type("NotEmptyString"), "object_description" => DataModel::Type("NotEmptyString"), "object_picture_url" => DataModel::Type("NotEmptyString"), "object_minimal_price" => DataModel::Type("UnsignedFloat"), "object_seller_user_id" => DataModel::Type("ForeignKey"), "object_start_date" => DataModel::Type("Timestamp"), "object_end_date" => DataModel::Type("Timestamp"), "object_statut" => DataModel::Type("UnsignedInt")), "objects");
$_MODEL->defineEntityModel("bid", array("bid_id" => DataModel::Type("PrimaryKey"), "bid_object_id" => DataModel::Type("ForeignKey"), "bid_bidder_user_id" => DataModel::Type("ForeignKey"), "bid_price" => DataModel::Type("UnsignedFloat"), "bid_date" => DataModel::Type("Timestamp")), "bids");
/*
	
$_POST = array("usr" => "chuck", "family" => "noris", "email" => "Carlos@boris.com", "password" => "catonkeyboard", "addr" => "42 rue Internet", "tel" => "0351235139", "rank" => "7");
$result = $_MODEL->createEntity("user", $_POST, array(
					"usr"	=>	"user_firstname",
					"family"	=>	"user_lastname",
					"email"	=>	"user_email",
					"password"	=>	"user_password",
					"addr"	=>	"user_address",
					"tel"	=>	"user_phone",
					"rank"	=>	"user_rank"
					));
					
if($result->validEntity) {
	// $_MODEL->store($result->entity);
}
else {
	print_r($result->errors);
}	
	
	
	
$user_entities = $_MODEL->getEntities("user")
開發者ID:benjaminchazelle,項目名稱:StarWarsMarket,代碼行數:31,代碼來源:model.inc.php


注:本文中的DataModel::Type方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。