Skip to content

Commit

Permalink
fixing model attribute bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jturbide committed Feb 24, 2024
1 parent 03489dc commit 297e304
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Mvc/Model/Attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@

namespace Zemit\Mvc\Model;

use Phalcon\Mvc\ModelInterface;
use Phalcon\Mvc\EntityInterface;
use Zemit\Mvc\Model\AbstractTrait\AbstractEntity;
use Zemit\Mvc\Model\AbstractTrait\AbstractMetaData;
use Zemit\Support\Helper;

trait Attribute
{
use AbstractMetaData;
use AbstractEntity;

/**
* Method to get attribute from getters or the readAttribute
Expand All @@ -26,7 +28,7 @@ trait Attribute
*/
public function getAttribute(string $attribute)
{
assert($this instanceof ModelInterface);
assert($this instanceof EntityInterface);
if ($this->getModelsMetaData()->hasAttribute($this, $attribute)) {

$method = 'get' . ucfirst(Helper::camelize($attribute));
Expand All @@ -48,7 +50,7 @@ public function getAttribute(string $attribute)
*/
public function setAttribute(string $attribute, $value): void
{
assert($this instanceof ModelInterface);
assert($this instanceof EntityInterface);
if ($this->getModelsMetaData()->hasAttribute($this, $attribute)) {

$method = 'set' . ucfirst(Helper::camelize($attribute));
Expand Down

0 comments on commit 297e304

Please sign in to comment.