Skip to content

Commit

Permalink
continued refactors/upgrades across backend/DB
Browse files Browse the repository at this point in the history
  • Loading branch information
utarsuno committed Jul 28, 2019
1 parent 3815bee commit 369861b
Show file tree
Hide file tree
Showing 149 changed files with 2,608 additions and 1,883 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
<?php declare(strict_types=1);
/**
* Created by PhpStorm.
* User: utarsuno
* Date: 2019-04-21
* Time: 21:46
*/

namespace CodeManager\Command;

use CodeManager\Service\CodeBuilderService;
use CodeManager\Service\DBService;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,65 @@

namespace CodeManager\Entity\Abstractions;

use CodeManager\Entity\Abstractions\Traits\MetaData\FieldID;
use QuasarSource\SQL\Doctrine\Fields\EnumFields;
use QuasarSource\Utils\DataType\UtilsString as STR;
use RuntimeException;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\Id;

/**
* Class AbstractEntity
* @package CodeManager\Entity\Abstractions
* @method int getID()
*/
abstract class AbstractEntity {
use FieldID;

/** @var string $sort_field_time */
public static $sort_field_time;

/** @var string $db_table_name */
public static $db_table_name;

/** @var array $func_aliases */
protected static $func_aliases = [];

/**
* @var int $id
* @Id
* @Column(type="integer", nullable=false, unique=true)
* @GeneratedValue(strategy="IDENTITY")
*/
protected $id;

/**
* @return int
*/
public function getID(): int {
return $this->id;
}

/**
* @param $name
* @param $arguments
* @return mixed
*/
public function __call($name, $arguments) {
switch (STR::get_starts_with_match($name, EnumFields::MAGIC_METHODS)) {
case '':
throw new RuntimeException('Invalid function{' . $name . '} called to Entity!');
case EnumFields::MAGIC_GET;
$func_name = 'get' . static::$func_aliases[STR::remove($name, EnumFields::MAGIC_GET)];
break;
case EnumFields::MAGIC_SET:
$func_name = 'set' . static::$func_aliases[STR::remove($name, EnumFields::MAGIC_SET)];
break;
default:
throw new RuntimeException('Invalid function{' . $name . '} called to Entity!');
}
if ($arguments !== null && is_array($arguments) && count($arguments) !== 0) {
return $this->$func_name($arguments[0]);
}
return $this->$func_name();
}

}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 369861b

Please sign in to comment.