-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
159 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
/** | ||
* This file is part of the Zemit Framework. | ||
* | ||
* (c) Zemit Team <contact@zemit.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Zemit\Models; | ||
|
||
use Zemit\Models\Abstracts\AbstractFeature; | ||
use Zemit\Models\Interfaces\FeatureInterface; | ||
|
||
class Feature extends AbstractFeature implements FeatureInterface | ||
{ | ||
protected $deleted = self::NO; | ||
|
||
public function initialize(): void | ||
{ | ||
parent::initialize(); | ||
// @todo relationships | ||
} | ||
|
||
public function validation(): bool | ||
{ | ||
$validator = $this->genericValidation(); | ||
|
||
// @todo validations | ||
|
||
return $this->validate($validator); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
/** | ||
* This file is part of the Zemit Framework. | ||
* | ||
* (c) Zemit Team <contact@zemit.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Zemit\Models\Interfaces; | ||
|
||
interface FeatureInterface extends AbstractInterface | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
/** | ||
* This file is part of the Zemit Framework. | ||
* | ||
* (c) Zemit Team <contact@zemit.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Zemit\Models\Interfaces; | ||
|
||
interface JobInterface extends AbstractInterface | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
/** | ||
* This file is part of the Zemit Framework. | ||
* | ||
* (c) Zemit Team <contact@zemit.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Zemit\Models\Interfaces; | ||
|
||
interface UserFeatureInterface extends AbstractInterface | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
/** | ||
* This file is part of the Zemit Framework. | ||
* | ||
* (c) Zemit Team <contact@zemit.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Zemit\Models; | ||
|
||
use Zemit\Models\Abstracts\AbstractJob; | ||
use Zemit\Models\Interfaces\JobInterface; | ||
|
||
class Job extends AbstractJob implements JobInterface | ||
{ | ||
protected $deleted = self::NO; | ||
|
||
public function initialize(): void | ||
{ | ||
parent::initialize(); | ||
// @todo relationships | ||
} | ||
|
||
public function validation(): bool | ||
{ | ||
$validator = $this->genericValidation(); | ||
|
||
// @todo validations | ||
|
||
return $this->validate($validator); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
/** | ||
* This file is part of the Zemit Framework. | ||
* | ||
* (c) Zemit Team <contact@zemit.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE.txt | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Zemit\Models; | ||
|
||
use Zemit\Models\Abstracts\AbstractUserFeature; | ||
use Zemit\Models\Interfaces\UserFeatureInterface; | ||
|
||
/** | ||
* @property User $UserEntity | ||
* @method User getUserEntity(?array $params = null) | ||
* | ||
* @property Feature $FeatureEntity | ||
* @method Feature getFeatureEntity(?array $params = null) | ||
*/ | ||
class UserFeature extends AbstractUserFeature implements UserFeatureInterface | ||
{ | ||
protected $deleted = self::NO; | ||
protected $position = self::NO; | ||
|
||
public function initialize(): void | ||
{ | ||
parent::initialize(); | ||
|
||
$this->hasOne('userId', User::class, 'id', ['alias' => 'User']); | ||
$this->hasOne('featureId', Feature::class, 'id', ['alias' => 'Feature']); | ||
} | ||
|
||
public function validation(): bool | ||
{ | ||
$validator = $this->genericValidation(); | ||
|
||
$this->addUniquenessValidation($validator, ['userId', 'featureId']); | ||
$this->addUnsignedIntValidation($validator, 'userId', false); | ||
$this->addUnsignedIntValidation($validator, 'featureId', false); | ||
|
||
return $this->validate($validator); | ||
} | ||
} |