Project

General

Profile

Actions

Bug #66425

closed

`DataMapFactory::resolveTableName()`: `$classNameParts` limited to 6

Added by Artus Kolanowski over 9 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
Start date:
2015-04-15
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
no-brainer
Is Regression:
No
Sprint Focus:

Description

I'm currently hit a broken dataMap generated for a class with more then six parts. This leads to MySQL syntax error for all queries generated for this class:

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 '\author.* FROM tx_blog_domain_model_post_comment\author WHERE tx_blog_domain_mo' at line 1" (226 chars)

So this means currently you have only one subnamespace for your models in extbase which is insufficient IMO:

// After this only two class parts are left
namespace Vendor\Extension\Domain\Model;

// This left one possible subnamespace part open
namespace Vendor\Extension\Domain\Model;
class Foo [...]

// This is the possible maximum currently: only one subnamespace in the model
namespace Vendor\Extension\Domain\Model\Foo;
class Bar [...]

// This already leads to a MySQL syntax error
namespace Vendor\Extension\Domain\Model\Foo\Bar;
class Baz [...]

My concrete scenario is a simple blog extension with posts which have comments which have authors, so a legit naming approach is:

namespace Vendor\Blog\Domain\Model\Post\Comment;
class Author [...]

Another legit naming approach for this case could be:

namespace Vendor\Blog\Domain\Model\Post;
class CommentAuthor [...]

But that approach wont help when your model hierarchy gets deeper and also brings a general restriction for naming conventions.

So the first naming approach doesn't work because of the current implementation of \TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory::resolveTableName():

$classNameParts = explode('\\', $className, 6);

Is there any specific reason for this restriction? And if there are no side effects could we remove this limitation?

Actions

Also available in: Atom PDF