westdc-core/Westdc/Metadata/Attachments.php

61 lines
1.4 KiB
PHP
Raw Normal View History

2015-02-08 14:12:08 +00:00
<?php
/**
* Created by PhpStorm.
* User: liujin834
* Date: 15/2/8
* Time: 下午7:45
*/
namespace Westdc\Metadata;
use Zend\ServiceManager\ServiceManager;
use Zend\ServiceManager\ServiceManagerAwareInterface;
use Westdc\EventModel\AbstractEventManager;
use Zend\Db\TableGateway\TableGateway;
use Westdc\Db\Db;
use Zend\Db\Sql\Where;
class Attachments extends AbstractEventManager implements ServiceManagerAwareInterface{
protected $serviceManager;
private $tableGateway;
private $where = NULL;
public function setServiceManager(ServiceManager $serviceManager)
{
$this->serviceManager = $serviceManager;
return $this;
}
public function getTableGateway()
{
$this->tableGateway = new TableGateway('attachments',Db::getInstance());
return $this->tableGateway;
}
private function getWhereObject(){
if(empty($this->where))
$this->where = new Where;
return $this->where;
}
public function getWhere()
{
return $this->getWhereObject();
}
public function setQueryKeyword($keyword){
2015-02-08 14:18:01 +00:00
$this->getWhereObject()->nest()
->OR->like("realname",'%'.$keyword.'%')
->OR->like("realname",'%'.strtolower($keyword).'%')
2015-02-08 14:12:08 +00:00
->OR->like("realname",'%'.strtoupper($keyword).'%');
}
public function setQueryType($type){
$this->getWhereObject()->AND->equalTo("filetype",$type);
}
}