|
12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
-
- namespace Lc\SovBundle\Field\Filter;
-
-
- /**
- * @author La clic ! <contact@laclic.fr>
- */
- trait FilterTrait
- {
-
- public function getFieldPropertySnake(string $fieldName): string
- {
- return str_replace('.', '_', $fieldName);
- }
-
- public function getFieldPropertyBase(string $fieldName): string
- {
- return str_replace('_', '.', $fieldName);
- }
-
- public function isRelationField(string $fieldName, string $needle = "."): bool
- {
- return strpos($fieldName, $needle) !== false;
- }
-
- public function getFieldPropertyWithoutRelation(string $fieldName, string $needle = '.'): string
- {
- return substr($fieldName, strpos($fieldName, $needle) + 1);
- }
-
- public function getFieldPropertyRelationAlias(string $fieldName, string $needle = '.'): string
- {
- return substr($fieldName, 0, strpos($fieldName, $needle));
- }
-
- }
|