PHP code example of cscfa_tool_division / csr3-dto
1. Go to this page and download the library: Download cscfa_tool_division/csr3-dto 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/ */
cscfa_tool_division / csr3-dto example snippets
use CSDT\CSR3\CSR3GenericDTO;
$dto = new CSR3GenericDTO();
// ...
if (isset($user) && !empty($user)) {
$dto['user_instance'] = $user;
}
// ...
if (isset($dto['user_instance']) {
$user = $dto['user_instance'];
if ($user->isLocked()) {
unset($dto['user_instance']);
}
}
use CSDT\CSR3\Abstracts\AbstractCSR3DTO;
class ContextDTO extends AbstractCSR3DTO
{
public function setContext($context)
{
$this['context'] = $context;
}
public function getContext($context)
{
return $this['context'] ?? [];
}
}
use CSDT\CSR3\Abstracts\AbstractCSR3DTO;
class ContextDTO extends AbstractCSR3DTO
{
protected $context = [];
public function setContext($context)
{
$this->context = $context;
}
public function getContext($context)
{
return $this->context;
}
}
use CSDT\CSR3\Abstracts\AbstractCSR3DTO;
class ContextDTO extends AbstractCSR3PropertyDTO
{
protected $context = [];
public function setContext($context)
{
$this->['context'] = $context;
}
public function getContext($context)
{
return $this['context'];
}
}
use CSDT\CSR3\Abstracts\AbstractCSR3DTO;
class ContextDTO extends AbstractCSR3PropertyDTO
{
private $context = [];
protected function getProperties() : array
{
return array_merge(
parent::getProperties(),
['context']
);
}
protected function setProperty(string $propertyName, $propertyValue)
{
if ($propertyName == 'context') {
$this->setContext($propertyValue);
return $this;
}
return parent::setProperty($propertyName, $propertyValue);
}
protected function getProperty(string $propertyName)
{
if (propertyName == 'context') {
return $this->getContext();
}
return parent::getProperty($propertyName);
}
public function setContext($context)
{
$this->context = $context;
}
public function getContext($context)
{
return $this->context;
}
}
use CSDT\CSR3\Traits\CSR3DTOTrait;
class AttributeDTO
{
use CSR3DTOTrait;
private $attributes = [];
private $traversingPosition = 0;
}
use CSDT\CSR3\Traits\CSR3DTOPropertyTrait;
class ContextDTO
{
use CSR3DTOPropertyTrait;
private $attributes = [];
private $traversingPosition = 0;
private $context = [];
protected function getProperties() : array
{
return array_merge(
parent::getProperties(),
['context']
);
}
protected function setProperty(string $propertyName, $propertyValue)
{
if ($propertyName == 'context') {
$this->setContext($propertyValue);
return $this;
}
return parent::setProperty($propertyName, $propertyValue);
}
protected function getProperty(string $propertyName)
{
if (propertyName == 'context') {
return $this->getContext();
}
return parent::getProperty($propertyName);
}
public function setContext($context)
{
$this->context = $context;
}
public function getContext($context)
{
return $this->context;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.