From be2ff1cd273dae14917d32c0f63b9d8843c8dc96 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 12 Mar 2017 22:40:21 +0100 Subject: [PATCH] PhpUnit fixes --- Admin/Installer.php | 6 +++--- Models/Client.php | 8 ++++---- Models/ClientMapper.php | 11 ++++++++--- info.json | 4 +++- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/Admin/Installer.php b/Admin/Installer.php index bc1984e..7e18bb2 100644 --- a/Admin/Installer.php +++ b/Admin/Installer.php @@ -50,11 +50,11 @@ class Installer extends InstallerAbstract 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'clientmgmt_client` ( `clientmgmt_client_id` int(11) NOT NULL AUTO_INCREMENT, `clientmgmt_client_no` int(11) NOT NULL, - `clientmgmt_client_no_reverse` int(11) NOT NULL, + `clientmgmt_client_no_reverse` varchar(25) DEFAULT NULL, `clientmgmt_client_status` tinyint(2) NOT NULL, `clientmgmt_client_type` tinyint(2) NOT NULL, - `clientmgmt_client_taxid` varchar(50) NOT NULL, - `clientmgmt_client_info` text NOT NULL, + `clientmgmt_client_taxid` varchar(50) DEFAULT NULL, + `clientmgmt_client_info` text DEFAULT NULL, `clientmgmt_client_created_at` datetime NOT NULL, `clientmgmt_client_account` int(11) NOT NULL, PRIMARY KEY (`clientmgmt_client_id`), diff --git a/Models/Client.php b/Models/Client.php index 17854b1..b63f43f 100644 --- a/Models/Client.php +++ b/Models/Client.php @@ -128,7 +128,7 @@ class Client public function setInfo(string $info) /* : void */ { - return $this->info; + $this->info = $info; } public function getCreatedAt() : \DateTime @@ -136,14 +136,14 @@ class Client return $this->createdAt; } - public function getProfile() : Account + public function getProfile() : Profile { return $this->profile; } - public function setProfile(Account $account) /* : void */ + public function setProfile(Profile $profile) /* : void */ { - $this->profile = $account; + $this->profile = $profile; } public function getFiles() : array diff --git a/Models/ClientMapper.php b/Models/ClientMapper.php index 0db0148..87c7864 100644 --- a/Models/ClientMapper.php +++ b/Models/ClientMapper.php @@ -42,7 +42,7 @@ class ClientMapper extends DataMapperAbstract 'clientmgmt_client_type' => ['name' => 'clientmgmt_client_type', 'type' => 'int', 'internal' => 'type'], 'clientmgmt_client_taxid' => ['name' => 'clientmgmt_client_taxid', 'type' => 'string', 'internal' => 'taxId'], 'clientmgmt_client_info' => ['name' => 'clientmgmt_client_info', 'type' => 'string', 'internal' => 'info'], - 'clientmgmt_client_at' => ['name' => 'clientmgmt_client_at', 'type' => 'DateTime', 'internal' => 'createdAt'], + 'clientmgmt_client_created_at' => ['name' => 'clientmgmt_client_created_at', 'type' => 'DateTime', 'internal' => 'createdAt'], 'clientmgmt_client_account' => ['name' => 'clientmgmt_client_account', 'type' => 'int', 'internal' => 'profile'], ]; @@ -68,7 +68,7 @@ class ClientMapper extends DataMapperAbstract * @var string * @since 1.0.0 */ - protected static $createdAt = 'clientmgmt_client_at'; + protected static $createdAt = 'clientmgmt_client_created_at'; /** * Has one relation. @@ -90,7 +90,7 @@ class ClientMapper extends DataMapperAbstract 'dst' => 'clientmgmt_client_media_dst', 'src' => 'clientmgmt_client_media_src', ], - 'contact' => [ + 'contactElements' => [ 'mapper' => ContactElementMapper::class, 'table' => 'clientmgmt_client_contactelement', 'dst' => 'clientmgmt_client_contactelement_dst', @@ -113,6 +113,11 @@ class ClientMapper extends DataMapperAbstract { try { $objId = parent::create($obj, $relations); + + if($objId === null || !is_scalar($objId)) { + return $objId; + } + $query = new Builder(self::$db); $query->prefix(self::$db->getPrefix()) diff --git a/info.json b/info.json index ee5b7e5..6b60090 100644 --- a/info.json +++ b/info.json @@ -17,7 +17,9 @@ "description": "The buisness module.", "directory": "ClientManagement", "dependencies": { - "Admin" : "1.0.0" + "Admin" : "1.0.0", + "Profile" : "1.0.0", + "Media" : "1.0.0" }, "providing": { "Navigation": "*"