Invalid path alias: #mdm/admin/messages in Yii2? - yii2

Here is my common\config\main.php file where i adding two modules.
'modules' => [
'admin' => [
'class' => 'mdm\admin\Module',
'layout' => '//rbac/main-rbac',
],
'audit' => [
'class' => 'bedezign\yii2\audit\Audit',
'layout' => '//audit/main-audit',
'accessUsers' => [1, 2], //static id to test
],
This work fine in my local wamp server but both of them thrown error on my Ubuntu server after installation through docker.
Here the errors:
Invalid path alias: #bedezign/yii2/audit/web/assets on click the
audit module
Invalid path alias: #mdm/admin/messages on click the
rbac module
Here my vendor/yiisoft/extension.php
<?php
$vendorDir = dirname(__DIR__);
return array (
'yiisoft/yii2-swiftmailer' =>
array (
'name' => 'yiisoft/yii2-swiftmailer',
'version' => '9999999-dev',
'alias' =>
array (
'#yii/swiftmailer' => $vendorDir . '/yiisoft/yii2-swiftmailer/src',
),
),
'2amigos/yii2-chartjs-widget' =>
array (
'name' => '2amigos/yii2-chartjs-widget',
'version' => '2.1.2.0',
'alias' =>
array (
'#dosamigos/chartjs' => $vendorDir . '/2amigos/yii2-chartjs-widget/src',
),
),
'bedezign/yii2-audit' =>
array (
'name' => 'bedezign/yii2-audit',
'version' => '9999999-dev',
'alias' =>
array (
'#bedezign/yii2/audit' => $vendorDir . '/bedezign/yii2-audit/src',
),
'bootstrap' => 'bedezign\\yii2\\audit\\Bootstrap',
),
'kartik-v/yii2-krajee-base' =>
array (
'name' => 'kartik-v/yii2-krajee-base',
'version' => '9999999-dev',
'alias' =>
array (
'#kartik/base' => $vendorDir . '/kartik-v/yii2-krajee-base/src',
),
),
'kartik-v/yii2-widget-select2' =>
array (
'name' => 'kartik-v/yii2-widget-select2',
'version' => '9999999-dev',
'alias' =>
array (
'#kartik/select2' => $vendorDir . '/kartik-v/yii2-widget-select2/src',
),
),
'yii2mod/yii2-enum' =>
array (
'name' => 'yii2mod/yii2-enum',
'version' => '9999999-dev',
'alias' =>
array (
'#yii2mod/enum' => $vendorDir . '/yii2mod/yii2-enum',
),
),
'yii2mod/yii2-editable' =>
array (
'name' => 'yii2mod/yii2-editable',
'version' => '9999999-dev',
'alias' =>
array (
'#yii2mod/editable' => $vendorDir . '/yii2mod/yii2-editable',
),
),
'yii2mod/yii2-moderation' =>
array (
'name' => 'yii2mod/yii2-moderation',
'version' => '1.2.0.0',
'alias' =>
array (
'#yii2mod/moderation' => $vendorDir . '/yii2mod/yii2-moderation',
),
),
'yii2mod/yii2-behaviors' =>
array (
'name' => 'yii2mod/yii2-behaviors',
'version' => '9999999-dev',
'alias' =>
array (
'#yii2mod/behaviors' => $vendorDir . '/yii2mod/yii2-behaviors',
),
),
'paulzi/yii2-sortable' =>
array (
'name' => 'paulzi/yii2-sortable',
'version' => '1.0.2.0',
'alias' =>
array (
'#paulzi/sortable' => $vendorDir . '/paulzi/yii2-sortable',
),
),
'paulzi/yii2-adjacency-list' =>
array (
'name' => 'paulzi/yii2-adjacency-list',
'version' => '2.2.0.0',
'alias' =>
array (
'#paulzi/adjacencyList' => $vendorDir . '/paulzi/yii2-adjacency-list',
),
),
'asofter/yii2-imperavi-redactor' =>
array (
'name' => 'asofter/yii2-imperavi-redactor',
'version' => '9999999-dev',
'alias' =>
array (
'#yii/imperavi' => $vendorDir . '/asofter/yii2-imperavi-redactor/yii/imperavi',
),
),
'yii2mod/yii2-comments' =>
array (
'name' => 'yii2mod/yii2-comments',
'version' => '9999999-dev',
'alias' =>
array (
'#yii2mod/comments' => $vendorDir . '/yii2mod/yii2-comments',
),
),
'mdmsoft/yii2-admin' =>
array (
'name' => 'mdmsoft/yii2-admin',
'version' => '9999999-dev',
'alias' =>
array (
'#mdm/admin' => $vendorDir . '/mdmsoft/yii2-admin',
),
),
'linslin/yii2-curl' =>
array (
'name' => 'linslin/yii2-curl',
'version' => '9999999-dev',
'alias' =>
array (
'#linslin/yii2/curl' => $vendorDir . '/linslin/yii2-curl',
),
),
'yiisoft/yii2-faker' =>
array (
'name' => 'yiisoft/yii2-faker',
'version' => '9999999-dev',
'alias' =>
array (
'#yii/faker' => $vendorDir . '/yiisoft/yii2-faker/src',
),
),
'darkdrim/yii2-simplehtmldom' =>
array (
'name' => 'darkdrim/yii2-simplehtmldom',
'version' => '9999999-dev',
'alias' =>
array (
'#darkdrim/simplehtmldom' => $vendorDir . '/darkdrim/yii2-simplehtmldom',
),
),
'insolita/yii2-migration-generator' =>
array (
'name' => 'insolita/yii2-migration-generator',
'version' => '3.1.0.0',
'alias' =>
array (
'#insolita/migrik' => $vendorDir . '/insolita/yii2-migration-generator',
),
'bootstrap' => 'insolita\\migrik\\Bootstrap',
),
'kartik-v/yii2-widget-fileinput' =>
array (
'name' => 'kartik-v/yii2-widget-fileinput',
'version' => '9999999-dev',
'alias' =>
array (
'#kartik/file' => $vendorDir . '/kartik-v/yii2-widget-fileinput/src',
),
),
'kartik-v/yii2-widget-datepicker' =>
array (
'name' => 'kartik-v/yii2-widget-datepicker',
'version' => '9999999-dev',
'alias' =>
array (
'#kartik/date' => $vendorDir . '/kartik-v/yii2-widget-datepicker/src',
),
),
'yiisoft/yii2-httpclient' =>
array (
'name' => 'yiisoft/yii2-httpclient',
'version' => '9999999-dev',
'alias' =>
array (
'#yii/httpclient' => $vendorDir . '/yiisoft/yii2-httpclient/src',
),
),
'himiklab/yii2-recaptcha-widget' =>
array (
'name' => 'himiklab/yii2-recaptcha-widget',
'version' => '9999999-dev',
'alias' =>
array (
'#himiklab/yii2/recaptcha' => $vendorDir . '/himiklab/yii2-recaptcha-widget/src',
'#himiklab/yii2/recaptcha/tests' => $vendorDir . '/himiklab/yii2-recaptcha-widget/tests',
),
),
'yiisoft/yii2-imagine' =>
array (
'name' => 'yiisoft/yii2-imagine',
'version' => '2.1.1.0',
'alias' =>
array (
'#yii/imagine' => $vendorDir . '/yiisoft/yii2-imagine/src',
),
),
'yii2tech/file-storage' =>
array (
'name' => 'yii2tech/file-storage',
'version' => '9999999-dev',
'alias' =>
array (
'#yii2tech/filestorage' => $vendorDir . '/yii2tech/file-storage/src',
),
),
'yii2tech/ar-file' =>
array (
'name' => 'yii2tech/ar-file',
'version' => '9999999-dev',
'alias' =>
array (
'#yii2tech/ar/file' => $vendorDir . '/yii2tech/ar-file',
),
),
'yii2mod/yii2-markdown' =>
array (
'name' => 'yii2mod/yii2-markdown',
'version' => '9999999-dev',
'alias' =>
array (
'#yii2mod/markdown' => $vendorDir . '/yii2mod/yii2-markdown',
),
),
'rmrevin/yii2-fontawesome' =>
array (
'name' => 'rmrevin/yii2-fontawesome',
'version' => '3.9999999.9999999.9999999-dev',
'alias' =>
array (
'#rmrevin/yii/fontawesome' => $vendorDir . '/rmrevin/yii2-fontawesome',
),
),
'yii2mod/yii2-cms' =>
array (
'name' => 'yii2mod/yii2-cms',
'version' => '9999999-dev',
'alias' =>
array (
'#yii2mod/cms' => $vendorDir . '/yii2mod/yii2-cms',
),
'bootstrap' => 'yii2mod\\cms\\Bootstrap',
),
'yiisoft/yii2-queue' =>
array (
'name' => 'yiisoft/yii2-queue',
'version' => '9999999-dev',
'alias' =>
array (
'#yii/queue' => $vendorDir . '/yiisoft/yii2-queue/src',
'#yii/queue/amqp' => $vendorDir . '/yiisoft/yii2-queue/src/drivers/amqp',
'#yii/queue/amqp_interop' => $vendorDir . '/yiisoft/yii2-queue/src/drivers/amqp_interop',
'#yii/queue/beanstalk' => $vendorDir . '/yiisoft/yii2-queue/src/drivers/beanstalk',
'#yii/queue/db' => $vendorDir . '/yiisoft/yii2-queue/src/drivers/db',
'#yii/queue/file' => $vendorDir . '/yiisoft/yii2-queue/src/drivers/file',
'#yii/queue/gearman' => $vendorDir . '/yiisoft/yii2-queue/src/drivers/gearman',
'#yii/queue/redis' => $vendorDir . '/yiisoft/yii2-queue/src/drivers/redis',
'#yii/queue/sync' => $vendorDir . '/yiisoft/yii2-queue/src/drivers/sync',
'#yii/queue/sqs' => $vendorDir . '/yiisoft/yii2-queue/src/drivers/sqs',
),
),
'yiisoft/yii2-bootstrap' =>
array (
'name' => 'yiisoft/yii2-bootstrap',
'version' => '9999999-dev',
'alias' =>
array (
'#yii/bootstrap' => $vendorDir . '/yiisoft/yii2-bootstrap/src',
),
),
'yiisoft/yii2-redis' =>
array (
'name' => 'yiisoft/yii2-redis',
'version' => '9999999-dev',
'alias' =>
array (
'#yii/redis' => $vendorDir . '/yiisoft/yii2-redis/src',
),
),
'yiisoft/yii2-debug' =>
array (
'name' => 'yiisoft/yii2-debug',
'version' => '9999999-dev',
'alias' =>
array (
'#yii/debug' => $vendorDir . '/yiisoft/yii2-debug/src',
),
),
'yiisoft/yii2-gii' =>
array (
'name' => 'yiisoft/yii2-gii',
'version' => '9999999-dev',
'alias' =>
array (
'#yii/gii' => $vendorDir . '/yiisoft/yii2-gii/src',
),
),
'froala/yii2-froala-editor' =>
array (
'name' => 'froala/yii2-froala-editor',
'version' => '2.9.3.0',
'alias' =>
array (
'#froala/froalaeditor' => $vendorDir . '/froala/yii2-froala-editor/src',
),
),
);
here is my htacces file
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ backend/web/$1 [L]
</IfModule>
# Deny accessing below extensions
<Files ~ "(.json|.lock|.git)">
Order allow,deny
Allow from all
</Files>
# Deny accessing dot files
RewriteRule (^\.|/\.) - [F]

Basically the composer update was not generated the extension.php
properly. There was the alias issue which worked after delet the
vendor folder on server and update the composer again.

We can set aliases in config/web.php
'aliases' => [
'#bower' => '#vendor/bower-asset',
'#npm' => '#vendor/npm-asset',
'#mdm/admin/mail' => '#app/modules/admin/mail',
'#mdm/admin/messages' => '#app/modules/admin/messages',
],

Try this aliases
#bedezign/yii2-audit/web/assets
#mdmsoft/yii2-admin/messages
Documentation says https://www.yiiframework.com/doc/guide/2.0/en/concept-aliases#extension-aliases that alias is a name of composer package.

Related

Cakephp Multiple Table search in container behaviour

hello I want to get results from multiple tables using the keyword which user has typed. The problem I am having is I don't know how can I do search on that table which is getting through contain
Here's my query
public function getGigPostBasedOnSearch($keyword){
$this->Behaviors->attach('Containable');
return $this->find('all', array(
'contain' => array(
'User','UserInfo', 'GigPostAndCategory.Category','Location','GigPostAndCalender'
),
'conditions' => array(
'AND' => array(
'GigPost.active' => 1,
'OR' => array(
array('GigPost.title LIKE' => '%'.$keyword.'%'),
array('GigPost.description LIKE' => '%'.$keyword.'%'),
array('Location.location_string LIKE' => '%'.$keyword.'%'),
)
)
//'OrderGigPost.request' => 0
),
'order' => 'GigPost.gig_post_id DESC',
'recursive' => 0
));
}
This query works fine. I want to search keyword in category table also.I want to do something like this
array('Category.cat_name LIKE' => '%'.$keyword.'%')
Please help me how can I search in Category table as well
Thank you
Model GigPost.php
<?php
class GigPost extends AppModel
{
public $useTable = 'gig_post';
public $primaryKey = 'gig_post_id';
public $hasAndBelongsToMany = array(
'Category' =>
array(
'className' => 'Category',
'joinTable' => 'gigpost_category',
'foreignKey' => 'gig_post_id',
'associationForeignKey' => 'cat_id',
'unique' => true,
)
);
public $hasOne = array(
'Location' => array(
'className' => 'Location',
'foreignKey' => 'gig_post_id',
'conditions' => array('GigPost.gig_post_id = Location.gig_post_id')
));
public $belongsTo = array(
'User' => array(
'className' => 'User',
'foreignKey' => 'user_id',
'fields' => array('User.user_id','User.email','User.active')
),
'UserInfo' => array(
'className' => 'UserInfo',
'foreignKey' => 'user_id',
)
);
public function getGigPostBasedOnSearch($keyword){
$this->Behaviors->attach('Containable');
return $this->find('all', array(
'contain' => array(
'User','UserInfo', 'GigPostAndCategory.Category'=>array(
'conditions'=>array(
'OR' => array(
array('Category.cat_name' => '%'.$keyword.'%'),
),
)
),'Location','GigPostAndCalender'
),
'conditions' => array(
'AND' => array(
'GigPost.active' => 1,
'OR' => array(
array('GigPost.title LIKE' => '%'.$keyword.'%'),
array('GigPost.description LIKE' => '%'.$keyword.'%'),
array('Location.location_string LIKE' => '%'.$keyword.'%'),
// array('Category.cat_name LIKE' => '%'.$keyword.'%'),
)
)
//'OrderGigPost.request' => 0
),
'order' => 'GigPost.gig_post_id DESC',
'recursive' => 0
));
}
}
Your issue is that the relationship between GigPost and Category is HABTM, so when you use contain Cake has to do a separate query to retrieve the related categories as there is not a one-on-one association. To get round this you need to manually perform a join rather than contain the categories:-
$this->find('all', array(
'contain' => array(
'User', 'UserInfo', 'GigPostAndCategory.Category', 'Location', 'GigPostAndCalender'
),
'joins' => array(
array(
'table' => 'gigpost_category',
'alias' => 'GigPostCategory',
'type' => 'INNER',
'conditions' => 'GigPost.id = GigPostCategory.gig_post_id'
),
array(
'table' => 'categories',
'alias' => 'Category',
'type' => 'INNER',
'conditions' => 'Category.id = GigPostCategory.cat_id'
)
),
'conditions' => array(
'AND' => array(
'GigPost.active' => 1,
'OR' => array(
array('GigPost.title LIKE' => '%'.$keyword.'%'),
array('GigPost.description LIKE' => '%'.$keyword.'%'),
array('Location.location_string LIKE' => '%'.$keyword.'%'),
array('Category.cat_name LIKE' => '%'.$keyword.'%'),
)
)
),
'order' => 'GigPost.gig_post_id DESC',
'group' => 'GigPost.id',
'recursive' => 0
));
This ensures that the categories will be included with the data returned by the primary query.
You will probably need to modify the joins array a bit as you don't appear to be using Cake naming conventions for your table so I am not sure what you have named things. However, this should put you on the right track.

Finding all with a JOIN query giving a single result instead of multiple

I have the following CakePHP code; I want it to return all rows (two in this case)
public function orderdetails($orderId)
{
$Productsaleslist = $this->Productsales->find('all', array(
'joins' => array(
array(
'table' => 'product',
'alias' => 'prod',
'type' => 'INNER',
'conditions' => array(
'prod.id = Productsales.product_id'
)
),
array(
'table' => 'sales_order_address',
'alias' => 'sod',
'type' => 'INNER',
'conditions' => array(
'sod.id = Productsales.sales_order_address_id'
)
),
),
'fields' => array(
'Productsales.*',
'prod.name',
'prod.image_url',
'sod.*'
),
'conditions' => array(
'Productsales.product_sales_slno' => $orderId
)
)
);
$this->set('Productsaleslist', $Productsaleslist);
}
$orderId comes from a URL parameter, and it contains the value of product_sales_slno (RAJ201701211485025418). This should retrieve two integers, but I'm only getting one as shown below.
How can I fix this?

GROUP and COUNT() multiple fields in CakePHP

This is my database:
week, subbizname, devicetype
20141203, common, PC
20141203, unknown, PC
20141210, KRsinKD, SP
20141210, unknown, PC
20141217, Unknown, SP
20141217, Chintai, TAB
....
I am trying to get the number of records for each unique couple devicetype/week.
Ex:
array(
20141203 => array(
'PC'=>2,
'TAB'=>0,
'SP'=>0
),
20141210 => array(
'PC'=>1,
'TAB'=>0,
'SP'=>1
),
...
.....
)
UPDATE:
I have used query:
$data = $this->Test->find('all', array(
'conditions'=>array(
'OR'=>array(
array('devicetype'=>'PC'),
array('devicetype'=>'SP'),
array('devicetype'=>'TAB'),
)
),
'fields'=>"devicetype,week,COUNT(devicetype) AS countDevice",
'group'=>"week,devicetype"
));
Thing is, it returns something like this:
(int) 0 => array(
'Test' => array(
'devicetype' => 'PC',
'week' => '20141126'
),
(int) 0 => array(
'countDevice' => '34844'
)
),
(int) 1 => array(
'Test' => array(
'devicetype' => 'SP',
'week' => '20141126'
),
(int) 0 => array(
'countDevice' => '32401'
)
),
(int) 2 => array(
'Test' => array(
'devicetype' => 'TAB',
'week' => '20141126'
),
(int) 0 => array(
'countDevice' => '4256'
)
),
(int) 3 => array(
'Test' => array(
'devicetype' => 'PC',
'week' => '20141203'
),
(int) 0 => array(
'countDevice' => '96564'
)
),
(int) 4 => array(
'Test' => array(
'devicetype' => 'SP',
'week' => '20141203'
),
(int) 0 => array(
'countDevice' => '97450'
)
),
But I do not manage to get the expected result.
Surely there must be a better way.
How can I fix this?
Using your $data variable, you can do:
$d = array();
foreach ($data as $value) {
$week = $value['Test']['week'];
if (isset($d[$week])) {
$d[$week][$value['Test']['devicetype']] = $value[0]['countDevice'];
} else {
$d[$week] = array($value['Test']['devicetype'] => $value[0]['countDevice']);
}
}
print_r($d); // $d will contain the data in your required format

MySQL error "Query execution was interrupted" after query_posts

I use query_posts in long search query.
My query:
<?php $args = array(
'tag_slug__in' => $cat_id,
'posts_per_page' => 15,
'paged' => $page,
'meta_query' => array(
array(
'key' => 'Пол',
'value' => $value_sex,
'compare' => 'EXISTS',
'type' => 'CHAR',
),
array(
'key' => 'Английский',
'value' => $english,
'compare' => 'EXISTS',
'type' => 'CHAR',
),
array(
'key' => 'Французский',
'value' => $france,
'compare' => 'EXISTS',
'type' => 'CHAR',
),
array(
'key' => 'Немецкий',
'value' => $germany,
'compare' => 'EXISTS',
'type' => 'CHAR',
),
array(
'key' => 'Итальянский',
'value' => $italy,
'compare' => 'EXISTS',
'type' => 'CHAR',
),
array(
'key' => 'Испанский',
'value' => $spain,
'compare' => 'EXISTS',
'type' => 'CHAR',
),
array(
'key' => 'Китайский',
'value' => $chine,
'compare' => 'EXISTS',
'type' => 'CHAR',
),
array(
'key' => 'Длина волос',
'value' => $hair_length,
'compare' => 'EXISTS',
'type' => 'CHAR',
),
array(
'key' => 'Цвет волос',
'value' => $hair_color,
'compare' => 'EXISTS',
'type' => 'CHAR',
),
array(
'key' => 'Удобные дни работы',
'value' => $value_days,
'compare' => 'EXISTS',
'type' => 'CHAR',
),
array(
'key' => 'Удобное время работы',
'value' => $value_time,
'compare' => 'IN',
'type' => 'CHAR',
),
array(
'key' => 'Рост (см)',
'value' => array( $value_height, $value_height_max ),
'type' => 'numeric',
'compare' => 'BETWEEN',
),
array(
'key' => 'Размер одежды',
'value' => array( $value_dress, $value_dress_max ),
'type' => 'numeric',
'compare' => 'BETWEEN',
),
array(
'key' => 'Размер бюста',
'value' => array( $value_bust, $value_bust_max ),
'type' => 'numeric',
'compare' => 'BETWEEN',
),
)
);
?>
<?php query_posts($args); ?>
This code is good work in new installed wordpress, but the old site is crashes.
I have "Query execution was interrupted", "Lost connection to MySQL server during query" and "MySQL server has gone away" errors in error.log
Key and value in meta_query in Russian. I'm sorry for my English. Please help.
link to error.log
It might be a timeout problem, in which case you should tinker with your my.cnf, or maybe your mysql just becomes unresponsive due to excessive load, in which case raising the timeout limit won't help you.
There isn't much room to optimize wordpress default functions, but you could write your own query using $wpdb->query() method, and maybe give a look at current db indexes for the post's metadata.
Put this line in after query_posts
<?php wp_reset_query(); ?>

cakephp lot of queries inside a query

I have a site developed in cakephp 2.x
I have a query with contain with a very lot of table relationed. I know that the most efficient way to do this big query is to make the join query manually. But I wanted to try with contain. I have selected only the field that I need but at the end I print how much queries inside are created: 5000 queries!! The database take 6-10 second to elaborate this query and I want to optimize time. Has cakephp a method to optimize? I don't want to use join now because there are a lot of join to create. Is possible? I know that is a crazy query with a lot of data but is the main page of the product with a lot of data.
This is the query:
$this->set('product',$this->Product->find('all', array(
'contain' => array(
'Origin' => array(
'fields'=>array('id','diet_id'),
'OriginAlias' => array(
'fields'=>array('id','origin_id','language','alias'),
'conditions' => array('OriginAlias.language' => $lang)
),
'Diet' => array(
'fields'=>array('id'),
'DietAlias' => array(
'fields'=>array('id','diet_id','language','alias'),
'conditions' => array('DietAlias.language' => $lang)
),
)
),
'ProductAlias' => array(
'conditions' => array('ProductAlias.alias' => $alias),
'User' => array(
'fields'=>array('id','username'),
'Profile' => array(
'fields'=>array('id','user_id','country','sex','diet','show_diet'),
),
'UserOptions' => array ('fields' => array ('avatar_type')),
'Avatar' => array ('fields' => array ('filename'))
),
'User2' => array(
'fields'=>array('id','username'),
'Profile' => array(
'fields'=>array('id','user_id','country','sex','diet','show_diet'),
),
'UserOptions' => array ('fields' => array ('avatar_type')),
'Avatar' => array ('fields' => array ('filename'))
)
),
'ProductImage'=> array(
'limit' => 1,
'ProductImageVote'=> array(
'order' => 'ProductImageVote.vote desc'
),
'User' => array(
'fields'=>array('id','username'),
'Profile' => array(
'fields'=>array('id','user_id','country','sex','diet','show_diet'),
),
)
),
'ProductGroupProduct' => array(
'fields'=>array('id','user_id','product_id','product_group_id'),
'ProductGroup'=> array(
'fields'=>array('id','text','language'),
),
),
'ProductIngredientVersion' => array(
'conditions' => $cond_version,
'limit' => 1,
'ProductIngredient' => array(
/*'Product' => array(
'ProductAlias' => array()
),*/
'Ingredient' => array(
'fields'=>array('id','user_id','origin_id','active'),
'IngredientAlias' => array(
'fields'=>array('id','user_id','ingredient_id','edit_user_id','alias'),
),
),
),
),
'ProductVersion' => array(
'conditions' => array('ProductVersion.active' => '1', 'ProductVersion.product_id' => $id),
'limit' => 1,
'ProductProperty' => array(
'Property' => array(
'fields'=>array('id','user_id','group_id','unit_id'),
'PropertyAlias' => array(
'fields'=>array('id','user_id','property_id','alias','language'),
'conditions' => array('PropertyAlias.language' => $lang)
),
'Unit' => array(
'fields'=>array('id','user_id','symbol','active'),
),
'PropertyGroup' => array(
'fields'=>array('id','user_id'),
'PropertyGroupAlias' => array(
'fields'=>array('id','user_id','group_id','alias'),
'conditions' => array('PropertyGroupAlias.language' => $lang)
)
)
),
),
),
'Manufacturer' => array(
'fields'=>array('id','text'),
),
'Brand' => array(
'fields'=>array('id','text'),
),
'UserProductLike' => array(
'conditions' => array('UserProductLike.product_id' => $id),
),
'UserProductHate' => array(
'conditions' => array('UserProductHate.product_id' => $id),
),
),
'conditions' => array('Product.id' => $id)
)));