We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi! Please help me, how to search at the same time in some entities.
my tables:
items:
'id' => ['type' => 'integer', 'autoincrement' => true, 'primary' => true, 'unsigned' => true, 'unique' => true, 'default' => null], 'status' => ['type' => 'integer', 'default' => 0], 'avaible' => ['type' => 'integer', 'default' => 0], 'created_by' => ['type' => 'integer', 'unsigned' => true, 'unique' => false, 'default' => null], 'updated_by' => ['type' => 'integer', 'default' => null, 'unsigned' => true, 'unique' => false], 'created_at' => ['type' => 'datetime', 'value' => new \DateTime()], 'updated_at' => ['type' => 'datetime', 'value' => new \DateTime()],
relations:
'price' => $mapper->hasOne($entity, ItemPrice::class, 'item')->order(['created_at' => 'DESC']), 'image' => $mapper->hasOne($entity, Images::class, 'item'), 'hu' => $mapper->hasOne($entity, ItemContent::class, 'item')->where(['lang' => 'hu']), 'en' => $mapper->hasOne($entity, ItemContent::class, 'item')->where(['lang' => 'en']), 'item_box' => $mapper->belongsTo($entity, ItemBox::class, 'box'), 'categories' => $mapper->hasManyThrough($entity, Category::class, ItemCategory::class, 'category_id', 'item_id'), 'created_user' => $mapper->belongsTo($entity, Admin::class, 'created_by'), 'updated_user' => $mapper->belongsTo($entity, Admin::class, 'updated_by'), 'search' => $mapper->hasOne($entity, ItemTitleSearch::class, 'item'), 'getitem' => $mapper->hasOne($entity, ItemContent::class, 'item'),
item_contents:
'id' => ['type' => 'integer', 'autoincrement' => true, 'primary' => true, 'unsigned' => true, 'unique' => true], 'item' => ['type' => 'integer', 'default' => null, 'unsigned' => true, 'unique' => false], 'lang' => ['type' => 'string', 'required' => true], 'title' => ['type' => 'string', 'required' => true], 'description' => ['type' => 'text', 'default' => '']
'hu' => $mapper->belongsTo($entity, Items::class, 'item'), 'en' => $mapper->belongsTo($entity, Items::class, 'item'),
item_categories:(manytomany), hasManyThrough
'id' => ['type' => 'integer', 'autoincrement' => true, 'primary' => true, 'unsigned' => true, 'unique' => true, 'default' => null], 'item_id' => ['type' => 'integer', 'default' => 0, 'unsigned' => true, 'unique' => false], 'category_id' => ['type' => 'integer', 'default' => 0, 'unsigned' => true, 'unique' => false],
'item' => $mapper->belongsTo($entity, Items::class, 'item_id'), 'category' => $mapper->belongsTo($entity, Category::class, 'category_id'),
category:
'category_id' => ['type' => 'integer', 'default' => 0,'primary' => true, 'unsigned' => true, 'unique' => true], 'image' => ['type' => 'string'], 'parent_id' => ['type' => 'integer', 'default' => 0, 'unsigned' => true, 'unique' => false], 'status' => ['type' => 'integer', 'default' => 0],
'hu' => $mapper->hasOne($entity, CategoryDescription::class, 'category_id')->where(['language_id' => 3]), 'en' => $mapper->hasOne($entity, CategoryDescription::class, 'category_id')->where(['language_id' => 1]), 'parentcategory' => $mapper->belongsTo($entity, Category::class, 'parent_id'), 'items' => $mapper->hasManyThrough($entity, Items::class, ItemCategory::class, 'category_id', 'item_id')
ItemTitleSearch:
'id' => array('type' => 'integer', 'serial' => true), 'item' => array('type' => 'integer', 'primary' => true,'index' => true, 'required' => true), 'title' => array('type' => 'text', 'required' => true, 'fulltext' => true),
'getitem' => $mapper->hasOne($entity, Items::class, 'id'),
so, a make a search:
$searchText = 'stringintext'; $allItems = $this->entity->mapper(Items\ItemTitleSearch::class); $allItems = $allItems->where(['title :like' => '%' . $allItems . '%'])
its working good!
But i want search in titles and categories, how can i do it? Thanks!
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi!
Please help me, how to search at the same time in some entities.
my tables:
items:
relations:
item_contents:
relations:
item_categories:(manytomany), hasManyThrough
relations:
category:
relations:
ItemTitleSearch:
relations:
so, a make a search:
its working good!
But i want search in titles and categories, how can i do it?
Thanks!
The text was updated successfully, but these errors were encountered: