Skip to content
New issue

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

This extension is pure shit and should be deleted !!! #67

Closed
Ziggizag opened this issue Aug 6, 2021 · 2 comments
Closed

This extension is pure shit and should be deleted !!! #67

Ziggizag opened this issue Aug 6, 2021 · 2 comments

Comments

@Ziggizag
Copy link

Ziggizag commented Aug 6, 2021

This extension rape through all methods prefixed with "get" and abuse them. This method clears link table records and creates new - effectively messing in more complex relations. This is pure VIRUS and the author should be ashamed!

@mootensai
Copy link
Owner

How so? could you explain what you did and show the Model that use it?

@Ziggizag
Copy link
Author

Ziggizag commented Aug 6, 2021

Models are complex with many relations.

But your overall code is piece of shit.

First of all - not each and every instance of ActiveQuery is a relation!!!

Looka at your code - first of all - you effectively rip through all "get" queries here:

try {
$rel = call_user_func(array($this, $method->name));
if ($rel instanceof ActiveQuery) {
$name = lcfirst(preg_replace('/^get/', '', $method->name));
$stack[$name]['name'] = lcfirst(preg_replace('/^get/', '', $method->name));
$stack[$name]['method'] = $method->name;
$stack[$name]['ismultiple'] = $rel->multiple;
$stack[$name]['modelClass'] = $rel->modelClass;
$stack[$name]['link'] = $rel->link;
$stack[$name]['via'] = $rel->via;
}
} catch (ErrorException $exc) {

then - you fuck delete all records as a madman:

if (!$isNewRecord) {
//DELETE WITH 'NOT IN' PK MODEL & REL MODEL
if ($isManyMany) {
// Many Many
$query = ['and', $notDeletedFK];
foreach ($notDeletedPK as $attr => $value) {
$notIn = ['not in', $attr, $value];
array_push($query, $notIn);
}
try {
$relModel->deleteAll($query);
} catch (IntegrityException $exc) {
$this->addError($name, "Data can't be deleted because it's still used by another data.");
$error = true;
}
} else {
// Has Many
$query = ['and', $notDeletedFK, ['not in', $relPKAttr[0], $notDeletedPK]];
if (!empty($notDeletedPK)) {
try {
$relModel->deleteAll($query);
} catch (IntegrityException $exc) {
$this->addError($name, "Data can't be deleted because it's still used by another data.");
$error = true;
}
}
}
}

You are a criminal - your fucking plugin nearly killed my database!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants