1. Go to this page and download the library: Download 4k1r0/ormega 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/ */
if( $oUser->getGenderId() == \Ormega\Database\Enum\Enumgender::MAN ){
// Do stuff if man
}
namespace Ormega\Database\Enum;
class Enumgroup implements \Ormega\EnumInterface {
/**
* @var int man gender id
*/
const MAN = 1;
/**
* @var int woman gender id
*/
const WOMAN = 2;
// ...
}
/**
* Get the "Label" associated to an ID
* @param int $nId
* @return string
*/
public static function getLabel( $nId ){
// ...
}
/**
* Get the "Constant" associated to an ID
* @param int $nId
* @return string
* @author Ormegagenerator_lib
*/
public static function getConstant( $nId ){
// ...
}
**
* Get all the constants in a array form
* @return array
* @author Ormegagenerator_lib
*/
public static function getArray(){
return array(
"QUALITE" => array(
"id" => "1",
"label" => "man gender id",
"constant" => "MAN",
),
"MANAGER" => array(
"id" => "2",
"label" => "woman gender id",
"constant" => "WOMAN",
),
);
}
**
* Get an ID from a string constant
* @param string $sConstant
* @return int
* @author Ormegagenerator_lib
*/
public static function getId( $sConstant ){
// ...
}
// Test results
if( $oUserCollection->isEmpty() ){
// No results
}
// browse each result
foreach( $oUserCollection as $oUserEntity ){
/**
* @var \Ormega\Entity\User $oUserEntity
*/
}
// Get all primary key (ex : to use it within a `WHERE field IN()` sql statement)
$aIds = $oUserCollection->getArrayKeys()
$oUserEntity = new Ormega\Database\Entity\User();
$oProfilEntity = new Ormega\Database\Entity\Profil();
$oProfilEntity->setUser( $oUserEntity );
$oProfilEntity->setFkUserId( $oUserEntity->getId() ); // this 2 lines do the same stuff
// Same way for getters :
$oProfilEntity = new Ormega\Database\Entity\Profil();
$oUserEntity = $oProfilEntity->getUser();