能够说出的委屈,便不算委屈;能够抢走的爱人,便不算爱人。——《开到荼蘼》
March 17, 2016

Symfony Sonata 添加 Query 字段

不指定 | Category : PHP相关 | Posted by at 19:18 | Comments:0

$repos = $this->container->get("doctrine")->getEntityManager()->getRepository("EmnBaseBundle:Advertiser");

$c = $repos->createQueryBuilder("p");

$c->where("p.userType = " . User::TYPE_ADVERTISER);

if($this->getCurrentUser()->isEmployee()) {

$c->andWhere("p.employe = " . $this->getCurrentUser()->getId());

}

$formMapper             ->add('affliate',"entity",array("class"=>"Emn\\BaseBundle\\Entity\\Advertiser",'label'=>'Advertiser','required'=>true,"query_builder"=>$c))

January 5, 2016

In Doctrine you shouldn't to declare relation columns as fields.

AppBundle\Entity\Province:

    type: entity
    table: eto_province
    repositoryClass: AppBundle\Entity\ProvinceRepository
    id:
        id:
            type: integer
            id: true
            generator:
                strategy: AUTO
    fields:
        defaultName:
            type: string
            length: 255
            column: default_name
        code:
            type: string
            length: '10'
    lifecycleCallbacks: {  }
    manyToOne:
        countryId:
            targetEntity: AppBundle\Entity\Country
            joinColumn:
                name: country_id
                referencedColumnName: country_id

 

December 31, 2015

 注册服务: 

 

 

etommer.management.user.login:

    class: eTommerManagementBundle\EventListener\TokenListener
    tags:

 =========================================

class TokenListener implements  EventSubscriberInterface
{
    private $tokens;
    public function __construct($router =null, $container = null) {
 
    }
 
    public static function getSubscribedEvents() {
        return array(
            SecurityEvents::INTERACTIVE_LOGIN => 'fsoUserInteractiveLogin',
        );
    }
 
    public function fsoUserInteractiveLogin(InteractiveLoginEvent  $event) {
        $event->getRequest()->request->add(array("_target_path"=>'admin_dashboard_index'));
    }
}
January 26, 2014

sublime snippet for php doc

不指定 | Category : PHP相关 | Posted by at 22:14 | Comments:0
<snippet>
    <content><![CDATA[
/**
 * @desc   ${1:}
 * @author Guz
 * @param  ${2:}
 * @return ${3:null}
 * @issue  ${4:issueTitle}
 * @throws   
 * @todo
 * @modified Guz
 * @static
 * @var
 * @const
 * @deprecated
 * @final
 */
]]></content>
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
    <tabTrigger>phpdoc</tabTrigger>
    <!-- Optional: Set a scope to limit where the snippet will trigger -->
    <scope>source.php</scope>
</snippet>
 
October 19, 2013
       $update = $this->getLayout()->getUpdate();
        $update->addHandle('default');
        $update->addHandle('catalog_product_view');
        $this->loadLayoutUpdates();
分页: 1/32 第一页 1 2 3 4 5 6 7 8 9 10 下页 最后页 [ 显示模式: 摘要 | 列表 ]