| @@ 13-40 (lines=28) @@ | ||
| 10 | * @TODO this class is a workaround and should be removed after implementation of |
|
| 11 | * entity name representation configuration. |
|
| 12 | */ |
|
| 13 | class LeadEntityNameProvider implements EntityNameProviderInterface |
|
| 14 | { |
|
| 15 | const CLASS_NAME = 'OroCRM\Bundle\SalesBundle\Entity\Lead'; |
|
| 16 | ||
| 17 | /** |
|
| 18 | * {@inheritdoc} |
|
| 19 | */ |
|
| 20 | public function getName($format, $locale, $entity) |
|
| 21 | { |
|
| 22 | if ($format === EntityNameProviderInterface::FULL && is_a($entity, self::CLASS_NAME)) { |
|
| 23 | return $entity->getName(); |
|
| 24 | } |
|
| 25 | ||
| 26 | return false; |
|
| 27 | } |
|
| 28 | ||
| 29 | /** |
|
| 30 | * {@inheritdoc} |
|
| 31 | */ |
|
| 32 | public function getNameDQL($format, $locale, $className, $alias) |
|
| 33 | { |
|
| 34 | if ($format === EntityNameProviderInterface::FULL && $className === self::CLASS_NAME) { |
|
| 35 | return sprintf('%s.name', $alias); |
|
| 36 | } |
|
| 37 | ||
| 38 | return false; |
|
| 39 | } |
|
| 40 | } |
|
| 41 | ||
| @@ 7-37 (lines=31) @@ | ||
| 4 | ||
| 5 | use Oro\Bundle\EntityBundle\Provider\EntityNameProviderInterface; |
|
| 6 | ||
| 7 | class SalesFunnelEntityNameProvider implements EntityNameProviderInterface |
|
| 8 | { |
|
| 9 | const CLASS_NAME = 'OroCRM\Bundle\SalesBundle\Entity\SalesFunnel'; |
|
| 10 | ||
| 11 | /** |
|
| 12 | * {@inheritdoc} |
|
| 13 | */ |
|
| 14 | public function getName($format, $locale, $entity) |
|
| 15 | { |
|
| 16 | if ($format === EntityNameProviderInterface::FULL && is_a($entity, self::CLASS_NAME)) { |
|
| 17 | return $entity->getFirstName(); |
|
| 18 | } |
|
| 19 | ||
| 20 | return false; |
|
| 21 | } |
|
| 22 | ||
| 23 | /** |
|
| 24 | * {@inheritdoc} |
|
| 25 | */ |
|
| 26 | public function getNameDQL($format, $locale, $className, $alias) |
|
| 27 | { |
|
| 28 | if ($format === EntityNameProviderInterface::FULL && $className === self::CLASS_NAME) { |
|
| 29 | return sprintf( |
|
| 30 | 'CONCAT(\'Sales Funnel \', %s.id)', |
|
| 31 | $alias |
|
| 32 | ); |
|
| 33 | } |
|
| 34 | ||
| 35 | return false; |
|
| 36 | } |
|
| 37 | } |
|
| 38 | ||