Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ArrayIterator committed Jul 14, 2024
1 parent 11e9c79 commit ed51ad4
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 33 deletions.
36 changes: 19 additions & 17 deletions Entities/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,16 @@
columns: ['slug', 'site_id']
)]
#[Index(
name: 'index_type_status_id_site_id',
columns: [
'type',
'status',
'site_id',
'id',
],
name: 'index_type_status_id_site_id'
]
)]
#[Index(
name: 'index_like_search_sorting',
columns: [
'title',
'site_id',
Expand All @@ -93,32 +94,31 @@
'created_at',
'deleted_at',
'password_protected',
],
name: 'index_like_search_sorting'
]
)]
#[Index(
columns: ['published_at', 'created_at'],
name: 'index_published_at_created_at'
name: 'index_published_at_created_at',
columns: ['published_at', 'created_at']
)]
#[Index(
columns: ['site_id'],
name: 'relation_posts_site_id_sites_id'
name: 'relation_posts_site_id_sites_id',
columns: ['site_id']
)]
#[Index(
columns: ['category_id'],
name: 'index_category_id'
name: 'index_category_id',
columns: ['category_id']
)]
#[Index(
columns: ['category_id', 'site_id'],
name: 'relation_posts_category_id_post_categories_id_site_id'
name: 'relation_posts_category_id_post_categories_id_site_id',
columns: ['category_id', 'site_id']
)]
#[Index(
columns: ['parent_id'],
name: 'relation_posts_parent_id_posts_id'
name: 'relation_posts_parent_id_posts_id',
columns: ['parent_id']
)]
#[Index(
columns: ['user_id'],
name: 'relation_posts_user_id_admins_id'
name: 'relation_posts_user_id_admins_id',
columns: ['user_id']
)]
#[HasLifecycleCallbacks]
class Post extends AbstractEntity implements AvailabilityStatusEntityInterface
Expand Down Expand Up @@ -740,10 +740,12 @@ public function checkDataEvent(
$qb->set('x.category_id', ':cat_id');
$args['cat_id'] = null;
}
foreach ($args as $key => $value) {
$qb->setParameter($key, $value);
}
// use query builder to make sure updated_at still same
$qb
->where('x.id = :id')
->setParameters($args)
->getQuery()
->execute();
}
Expand Down
20 changes: 10 additions & 10 deletions Entities/PostCategory.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,24 +58,24 @@
columns: ['slug', 'site_id']
)]
#[Index(
columns: ['id', 'site_id'],
name: 'index_id_site_id'
name: 'index_id_site_id',
columns: ['id', 'site_id']
)]
#[Index(
columns: ['name', 'site_id'],
name: 'index_name_site_id'
name: 'index_name_site_id',
columns: ['name', 'site_id']
)]
#[Index(
columns: ['site_id'],
name: 'relation_post_categories_site_id_sites_id'
name: 'relation_post_categories_site_id_sites_id',
columns: ['site_id']
)]
#[Index(
columns: ['parent_id'],
name: 'relation_post_categories_parent_id_post_categories_id'
name: 'relation_post_categories_parent_id_post_categories_id',
columns: ['parent_id']
)]
#[Index(
columns: ['user_id'],
name: 'relation_post_categories_user_id_admins_id'
name: 'relation_post_categories_user_id_admins_id',
columns: ['user_id']
)]
#[HasLifecycleCallbacks]
class PostCategory extends AbstractEntity
Expand Down
13 changes: 7 additions & 6 deletions Entities/PostMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace ArrayAccess\TrayDigita\App\Modules\Posts\Entities;

use AllowDynamicProperties;
use ArrayAccess\TrayDigita\Database\Entities\Abstracts\AbstractBasedMeta;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping\Column;
Expand All @@ -14,7 +15,7 @@
use Doctrine\ORM\Mapping\ManyToOne;
use Doctrine\ORM\Mapping\Table;

#[Entity]
#[AllowDynamicProperties] #[Entity]
#[Table(
name: self::TABLE_NAME,
options: [
Expand All @@ -29,12 +30,12 @@
]
)]
#[Index(
columns: ['name'],
name: 'index_name'
name: 'index_name',
columns: ['name']
)]
#[Index(
columns: ['post_id'],
name: 'relation_post_meta_post_id_posts_id'
name: 'relation_post_meta_post_id_posts_id',
columns: ['post_id']
)]
#[HasLifecycleCallbacks]
/**
Expand Down Expand Up @@ -74,7 +75,7 @@ class PostMeta extends AbstractBasedMeta
cascade: [
"persist",
"remove",
"merge",
// "merge",
"detach"
],
fetch: 'EAGER'
Expand Down

0 comments on commit ed51ad4

Please sign in to comment.