Hi, Sorry for my English.
There are tables :
catalog_parametrs_names(id, name) | catalog_parametrs_values(id, value) | catalog_parametrs_names_values(id, id_name, id_value) | catalog_parametrs_products(id, id_prod, id_parametrs, id_categories)
Connection between catalog_parametrs_names => catalog_parametrs_values => catalog_parametrs_names_values working, but how to make the connection between the catalog_parametrs_names_values and catalog_parametrs_products and how to access it.
Please help.
namespace Ashanty\Models;
class CatalogParametersValues extends \Phalcon\Mvc\Model
{
public $id;
public $value;
public function initialize()
{
$this->hasManyToMany(
'id',
__NAMESPACE__ .'\CatalogParametersNamesValues',
'id_value',
'id_name',
__NAMESPACE__ .'\CatalogParametersNames',
'id',
array('alias' => 'value')
);
}
}
namespace Ashanty\Models;
class CatalogParametersNames extends \Phalcon\Mvc\Model
{
public $id;
public $name;
public function initialize()
{
$this->hasManyToMany(
'id',
__NAMESPACE__ .'\CatalogParametersNamesValues',
'id_name',
'id_value',
__NAMESPACE__ .'\CatalogParametersValues',
'id',
array('alias' => 'name')
);
}
}
namespace Ashanty\Models;
class CatalogParametersNamesValues extends \Phalcon\Mvc\Model
{
public $id;
public $id_name;
public $id_value;
public function initialize()
{
$this->hasManyToMany(
'id',
__NAMESPACE__ .'\CatalogParametersProducts',
'id_parameters',
'id',
__NAMESPACE__ .'\CatalogParametersNamesValues',
'id',
array('alias' => 'values')
);
$this->belongsTo('id_name', __NAMESPACE__.'\CatalogParametersNames', 'id', array('alias' => 'name'));
$this->belongsTo('id_value', __NAMESPACE__.'\CatalogParametersValues', 'id', array('alias' => 'value'));
}
}
namespace Ashanty\Models;
class CatalogParametersProducts extends \Phalcon\Mvc\Model
{
public $id;
public $id_prod;
public $id_parameters;
public $id_categories;
public function initialize()
{
$this->belongsTo('id_prod', __NAMESPACE__ . '\CatalogProducts', 'id', array('alias' => 'products'));
$this->belongsTo('id_parametrs', __NAMESPACE__ . '\CatalogParametersNamesValues', 'id', array('alias' => 'parameters'));
$this->belongsTo('id_categories', __NAMESPACE__ . '\CatalogCategories', 'id', array('alias' => 'categories'));
}
}