PhalconPHP Model Extend Issue

How do i extend an model to custom class. i'am unable to find solution still iam new to phalconphp.

Example: Database Model:

Folder path: app/models/

<?php 

namespace Ecommerce\Models;

class ProductsList extends \Phalcon\Mvc\Model
{
   public $one ....
   public $tow ....
   public function ...
}

To Custom Class app/ExtendModels

<?php 

namespace Ecommerce\ExtendedModels;

class ProductsListExtended extends \Ecommerce\Models\ProductsList
{
    public function __construct()
    {
        parent::__construct();
    }

    public function onConstruct()
    {
        parent::onConstruct();
    }

    public function initialize()
    {
        parent::initialize();
    }
}

Problem is if i call like this.

$test = new ProductsListExtended();
var_dump($test);
//returns false (empty);

but if i var_dump(new ProductsList());
// it shows bunch of array data


4.0k
edited Jul '15

Try register namespace or directory:

$loader->registerNamespaces(
    array(
        'Ecommerce\ExtendedModels' => '<path_to_app_ExtendModels_dir>',
    )
);
// or
$loader->registerDirs(array(
    '<path_to_app_ExtendModels_dir>'
))->register();