From 5ce3a63878772f8aece0ce2c85c6675321e80617 Mon Sep 17 00:00:00 2001 From: Deon George Date: Wed, 18 Jun 2025 22:18:55 +1000 Subject: [PATCH] Revert c56df8d3d and remove adding Objects directly - taking a different approach to add template actions --- app/Http/Controllers/HomeController.php | 3 +-- app/Ldap/Entry.php | 16 ++-------------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index e5e72952..a6d4ad73 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -64,8 +64,7 @@ class HomeController extends Controller ->filter(fn($item)=>$item->names_lc->intersect($template->attributes->map('strtolower'))->count()) ->sortBy(fn($item)=>Arr::get($template->order,$item->name)) as $ao) { - $o->addObjectItem($ao->name, - Factory::create(dn: '',attribute: $ao->name,values: [Entry::TAG_NOTAG=>''],oc: $o->objectclass)); + $o->{$ao->name} = [Entry::TAG_NOTAG=>'']; } } diff --git a/app/Ldap/Entry.php b/app/Ldap/Entry.php index d0a86ccf..21ef355c 100644 --- a/app/Ldap/Entry.php +++ b/app/Ldap/Entry.php @@ -130,7 +130,7 @@ class Entry extends Model $o = $this->objects->get($attribute) ?: Factory::create($this->dn ?: '',$attribute,[],Arr::get($this->attributes,'objectclass',[])); $o->values = collect($value); - $this->addObjectItem($key,$o); + $this->objects->put($key,$o); return $this; } @@ -211,19 +211,7 @@ class Entry extends Model $o = $this->objects->get($attribute) ?: Attribute\Factory::create($this->dn ?: '',$attribute,[]); $o->addValue($tag,[$value]); - $this->addObjectItem($attribute,$o); - } - - /** - * Add a new object item directly - * - * @param string $name - * @param Attribute $o - * @return void - */ - public function addObjectItem(string $name,Attribute $o): void - { - $this->objects->put($name,$o); + $this->objects->put($key,$o); } /**