revolution icon indicating copy to clipboard operation
revolution copied to clipboard

Delete user error (Could not get table class or name for class: modAccess)

Open pixelchutes opened this issue 10 years ago • 23 comments

When deleting multiple Users at a time (via the User grid, and performing Bulk Actions > Delete Selected), the users appear to be deleted as expected, but the following errors are logged.

Seems like a missing table (or invalid table reference)?

NOTE: This was tested using [2.3].

[2014-04-11 15:11:40] (ERROR @ /connectors/index.php) Could not get table class for class: modAccess
[2014-04-11 15:11:40] (ERROR @ /connectors/index.php) Could not get table name for class: modAccess
[2014-04-11 15:11:40] (ERROR @ /connectors/index.php) Error 42000 executing statement: 
Array
(
    [0] => 42000
    [1] => 1064
    [2] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS `modAccess` WHERE `modAccess`.`principal` = 3' at line 1
)

[2014-04-11 15:11:40] (ERROR @ /connectors/index.php) Could not get table class for class: modAccess
[2014-04-11 15:11:40] (ERROR @ /connectors/index.php) Could not get table name for class: modAccess
[2014-04-11 15:11:40] (ERROR @ /connectors/index.php) Error 42000 executing statement: 
Array
(
    [0] => 42000
    [1] => 1064
    [2] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS `modAccess` WHERE `modAccess`.`principal` = 4' at line 1
)

[2014-04-11 15:11:40] (ERROR @ /connectors/index.php) Could not get table class for class: modAccess
[2014-04-11 15:11:40] (ERROR @ /connectors/index.php) Could not get table name for class: modAccess
[2014-04-11 15:11:40] (ERROR @ /connectors/index.php) Error 42000 executing statement: 
Array
(
    [0] => 42000
    [1] => 1064
    [2] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS `modAccess` WHERE `modAccess`.`principal` = 5' at line 1
)

pixelchutes avatar Apr 11 '14 21:04 pixelchutes

Seems to happen when deleting even a single user, not specific to Bulk Actions > Delete.

pixelchutes avatar Apr 12 '14 15:04 pixelchutes

This is the result of an abstract relation to modAccess, which all modAccess* classes extend. This has been a problem since the beginning and likely needs some attention deep inside xPDO. It is harmless, but annoying.

opengeek avatar Apr 12 '14 15:04 opengeek

Good to know, thanks Jason. Worth leaving this issue open?

pixelchutes avatar Apr 12 '14 15:04 pixelchutes

Yes, lest we forget about it.

opengeek avatar Apr 12 '14 15:04 opengeek

Is this fixed?

OptimusCrime avatar May 27 '14 12:05 OptimusCrime

not yet fixed

opengeek avatar May 27 '14 12:05 opengeek

@opengeek may be just remove extending between modPrincipal and modUser? Since User is not a Principal itself but only through modUserGroup.

argnist avatar Dec 09 '14 03:12 argnist

modUser is a principal, it's just not implemented in the ACL tables yet, so that is not a valid solution.

opengeek avatar Dec 09 '14 13:12 opengeek

There's still problem with removing users (i'm using extUser class instead of normal modUser). Just a small reminder :)

jakub-gawryl avatar May 11 '15 12:05 jakub-gawryl

Still an issue in 2.4.0-pl

sottwell avatar Aug 25 '15 11:08 sottwell

Getting these in 2.4.2 when doing just about anything with users.

sottwell avatar Oct 25 '15 06:10 sottwell

How To fix

[2016-02-11 00:10:43] (ERROR @ /inc/index.php) Could not get table class for class: modAccess
[2016-02-11 00:10:43] (ERROR @ /inc/index.php) Could not get table name for class: modAccess
[2016-02-11 00:10:43] (ERROR @ /inc/index.php) Error 42000 executing statement: 
Array
(
    [0] => 42000
    [1] => 1064
    [2] => You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'AS `modAccess` WHERE `modAccess`.`principal` = 111' at line 1
)

TITAN-UZ avatar Feb 10 '16 19:02 TITAN-UZ

Also got this error when deleting one user (MODX 2.5.0):

[2016-10-10 11:41:13](ERROR @ /home/mySite/public_html/core/xpdo/xpdo.class.php : 1318) Could not get table class for class: modAccess [2016-10-10 11:41:13](ERROR @ /home/mySite/public_html/core/xpdo/xpdo.class.php : 1287) Could not get table name for class: modAccess [2016-10-10 11:41:13](ERROR @ /home/mySite/public_html/core/xpdo/om/xpdoobject.class.php : 240) Error 42000 executing statement: Array ( [0] => 42000 [1] => 1064 [2] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS modAccess WHERE modAccess.principal = 35' at line 1 )

9thwave avatar Oct 10 '16 11:10 9thwave

Ah, I've just come across this when creating a user-centric extra. (MODX 2.5.6) The error does not occur when using the core user management panel however. Is it known what exactly is setting it off?

muzzwood avatar Apr 23 '17 01:04 muzzwood

Still an issue in 2.6.0-pl

Lefthandmedia avatar Dec 08 '17 12:12 Lefthandmedia

Just bit me in 2.7.2.

This is a workaround:

$modx->runProcessor('security/user/delete',
                            array('id' => $userId));

[Update] This does not work reliably.

BobRay avatar Dec 02 '19 04:12 BobRay

Just bit me in 2.7.2.

This is a workaround:

$modx->runProcessor('security/user/delete',
                            array('id' => $userId));

@opengeek Is this a solution?

Ibochkarev avatar Dec 18 '19 17:12 Ibochkarev

Sorry, I thought that was a solution, but it doesn't actually work.

BobRay avatar Dec 18 '19 20:12 BobRay

This issue has been mentioned on MODX Community. There might be relevant details there:

https://community.modx.com/t/register-mail-to-cc/5894/18

rthrash avatar Oct 17 '22 10:10 rthrash

I've just gotten this error in 2.8.4 during a call to createObjectContainer(). Debugging the process shows that the table name is really not being found, and because of this, createObjectContainer() fails. Not sure if this is related to this issue or not.

BobRay avatar Feb 27 '23 04:02 BobRay

Just hit this again in a unit test. The ten-year anniversary of this issue was last week ;)

BobRay avatar Apr 19 '24 20:04 BobRay

Let's not make it 20. Which unit test?

rthrash avatar Apr 19 '24 22:04 rthrash

One of my own for CustomSearch. It creates, then later deletes several users.

BobRay avatar Apr 20 '24 05:04 BobRay