LeanMapper\IMapper::getImplicitFilters PHP Method

getImplicitFilters() public method

Gets filters that should be used used every time when given entity is loaded from database
public getImplicitFilters ( string $entityClass, Caller $caller = null ) : array | ImplicitFilters
$entityClass string
$caller Caller
return array | ImplicitFilters
    public function getImplicitFilters($entityClass, Caller $caller = null);

Usage Example

Esempio n. 1
0
 /**
  * @return Fluent
  */
 protected function createFluent()
 {
     $table = $this->getTable();
     $statement = $this->connection->select('%n.*', $table)->from($table);
     $filters = $this->mapper->getImplicitFilters($this->mapper->getEntityClass($table), new Caller($this));
     if (!empty($filters)) {
         $funcArgs = func_get_args();
         if (!$filters instanceof ImplicitFilters) {
             $filters = new ImplicitFilters($filters);
         }
         $targetedArgs = $filters->getTargetedArgs();
         foreach ($filters->getFilters() as $filter) {
             $args = [$filter];
             if (is_string($filter) and array_key_exists($filter, $targetedArgs)) {
                 $args = array_merge($args, $targetedArgs[$filter]);
             }
             if (!empty($funcArgs)) {
                 $args = array_merge($args, $funcArgs);
             }
             call_user_func_array([$statement, 'applyFilter'], $args);
         }
     }
     return $statement;
 }
All Usage Examples Of LeanMapper\IMapper::getImplicitFilters