-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(prettyblocks): installer will now use doctrine without sql with …
…prefix
- Loading branch information
Showing
3 changed files
with
41 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Evolutive\Library\Doctrine; | ||
|
||
use Doctrine\ORM\Mapping\DefaultNamingStrategy; | ||
|
||
class CustomTablePrefixNamingStrategy extends DefaultNamingStrategy | ||
{ | ||
private string $prefix; | ||
|
||
public function __construct(string $prefix) | ||
{ | ||
$this->prefix = $prefix; | ||
} | ||
|
||
/** | ||
* Applique le préfixe à toutes les tables | ||
*/ | ||
public function classToTableName($className): string | ||
{ | ||
return $this->prefix . parent::classToTableName($className); | ||
} | ||
|
||
/** | ||
* Applique le préfixe aux tables des associations (join tables) | ||
*/ | ||
public function joinTableName($sourceEntity, $targetEntity, $propertyName = null): string | ||
{ | ||
return $this->prefix . parent::joinTableName($sourceEntity, $targetEntity, $propertyName); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters