I have this model
namespace Project\Models;
use Phalcon\Mvc\Model;
use Project\Behaviors\xBehvior;
class X extends Model
{
// ... opted-out code
public method initialize()
{
$this-addBehavior(new xBehavior());
}
// ... opted-out code
}
And a behavior
namepsace Project\Behaviors;
use Phalcon\Mvc\Model\Behavior;
use Phalcon\Mvc\Model\BehaviorInterface;
class xBehavior extends Behavior implements BehaviorInterface
{
// ... opted-out code
public function any()
{
return ['val1', 'val2', 'val3'];
}
// ... opted-out code
}
And a repository
namespace Project\Repositories;
use Project\Models\X;
class xRepository extends X
{
public function doOperation()
{
$result = self::find();
return $result->any();
}
}
When I call ($xRepository->doOperation()) it should return ['val1', 'val2', 'val3']
, but it throws an exception that method any() is undefined.
Do I did something wrong ?