1. Go to this page and download the library: Download remithomas/rt-object library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
namespace Application\Entity\Entity;
use RtObject\RtObject\RtObject;
class MyObject extends RtObject{
public function __construct() {
parent::__construct("myobject", "myobject_data", "myobjectid");
}
}
$myObject = new \Application\Entity\MyObject();
$myObject->install();
// if you need extra columns to your object, add into your *module/Application/src/Application/Entity/MyObject.php* this code
public function install($extraColumnObject = array(), $extraColumnDataObject = array(), $extraTableObject = '', $extraTableDataObject = '') {
parent::install(array(
'extra_one' => "int(11) NOT NULL DEFAULT '1'",
'extra_two' => "varchar(512) CHARACTER SET utf8 NOT NULL",
));
}
// extra columns to object data
public function install($extraColumnObject = array(), $extraColumnDataObject = array(), $extraTableObject = '', $extraTableDataObject = '') {
parent::install(array(
'extra_one' => "int(11) NOT NULL DEFAULT '1'",
'extra_two' => "varchar(512) CHARACTER SET utf8 NOT NULL",
),
array(
'extra_one' => "int(11) NOT NULL DEFAULT '1'",
'extra_two' => "varchar(512) CHARACTER SET utf8 NOT NULL",
));
}
$myObject = new \Application\Entity\MyObject();
$myObject->createObject();
$myObjectId = $myObject->getObjectId();
$myObject = new \Application\Entity\MyObject();
$myObject ->setObjectId(1);
$myObjectInfo = $myObject->getObject();
$myObject = new \Application\Entity\MyObject();
$myObject ->setObjectId(1);
->insertData("mycategory","mykey", "myvalue", "text");
// using extra column (to object data)
$myObject = new \Application\Entity\MyObject();
$myObject ->setObjectId(1);
->insertData("mycategory","mykey", "myvalue", "text", array("extra_one"=>1234));
$myObject = new \Application\Entity\MyObject();
$myObject ->setObjectId(1);
$myObjectData = $myObject->getObjectData();
// get some data
$myObjectData = $myObject->getObjectData("mycategory", "mykey");
$myObject = new \Application\Entity\MyObject();
$aMyObjects = $myObject->searchValue("myvalue","text",100,0);// limit=100 && offset=0
$myObject = new \Application\Entity\MyObject();
$myObject ->setObjectId(1);
$bMyObject = $myObject->isExisting();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.