Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace OpenbravoBundle\Manager;
- /**
- * Author: Muhammad Surya Ihsanuddin<surya.kejawen@gmail.com>
- * Url: http://blog.khodam.org
- */
- use Doctrine\ORM\EntityManagerInterface;
- use Doctrine\ORM\Query\ResultSetMapping;
- use JMS\DiExtraBundle\Annotation\Service;
- use JMS\DiExtraBundle\Annotation\Inject;
- use JMS\DiExtraBundle\Annotation\InjectParams;
- /**
- * @Service("openbravo.manager.product_category")
- */
- class ProductCategoryManager extends AbstractManager implements ManagerInterface
- {
- /**
- * @InjectParams({
- * "entityManager" = @Inject("doctrine.orm.openbravo_entity_manager")
- * })
- *
- * @param EntityManagerInterface $entityManager
- */
- public function __construct(EntityManagerInterface $entityManager)
- {
- parent::__construct($entityManager);
- }
- protected function getResultMapping()
- {
- $resultMapping = new ResultSetMapping();
- $resultMapping->addScalarResult('value', 'code');
- $resultMapping->addScalarResult('name', 'name');
- $resultMapping->addScalarResult('description', 'description');
- return $resultMapping;
- }
- protected function getSQL()
- {
- $sql = '
- SELECT
- value,
- name,
- description
- FROM
- m_product_category
- WHERE
- isactive = :active
- AND
- name IN (:name)
- ';
- $this->parameters['active'] = 'Y';
- $this->parameters['name'] = array(
- 'VINOTI FINISH GOODS ACCESSORIES',
- 'VINOTI FINISH GOODS ARTWORK',
- 'VINOTI FINISH GOODS OFFICE FURNITURE',
- 'VINOTI FINISH GOODS PARCEL',
- 'VINOTI FINISH GOODS RESIDENTIAL FURNITURE',
- 'Vinoti Service',
- );
- return $sql;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement