protected function findByFilterComponentsDatabase( array $filterComponents, $source )
    {

        // hit the database and find something
        $query = $this->buildQuery( $this->db, $filterComponents );

        // get records from database
        $result = $this->db->query( $query )->fetch( Result::FLATTEN_PREVENT );

        $isChangedFilterCallback = $this->getFilterByIsChangedCallback($source);

        $output = $this->initByDatas( $result )
            ->filter($isChangedFilterCallback)
            ->each(function($entity){
                $entity->startDataInitialStore();
            });

        // add records from child tables if they exist
        if( $source & self::WITH_CHILDREN ) {
            foreach ( $this->children as $child ) {
                $childRepo = $this->entityManager->getRepository($child);
                $output->add(
                    $childRepo->findByFilterComponentsDatabase(
                        $filterComponents,
                        $source
                    )
                );
            }
        }

        return $output;

    }
protected function findByFilterComponentsDatabase( array $filterComponents, $source )
    {

        // hit the database and find something
        $query = $this->buildQuery( $this->db, $filterComponents );

        // get records from database
        $result = $this->db->query( $query )->fetch( Result::FLATTEN_PREVENT );

        $isChangedFilterCallback = $this->getFilterByIsChangedCallback($source);

        $output = $this->initByDatas( $result )
            ->filter($isChangedFilterCallback)
            ->each(function($entity){
                $entity->startDataInitialStore();
            });

        // add records from child tables if they exist
        if( $source & self::WITH_CHILDREN ) {
            foreach ( $this->children as $child ) {
                $childRepo = $this->entityManager->getRepository($child);
                $output->add(
                    $childRepo->findByFilterComponentsDatabase(
                        $filterComponents,
                        $source
                    )
                );
            }
        }

        return $output;

    }
protected function findByFilterComponentsDatabase ( array $ filterComponents , $ source ) { // hit the database and find something $ query = $ this -> buildQuery ( $ this -> db , $ filterComponents ) ; // get records from database $ result = $ this -> db -> query ( $ query ) -> fetch ( Result :: FLATTEN_PREVENT ) ; $ isChangedFilterCallback = $ this -> getFilterByIsChangedCallback ( $ source ) ; $ output = $ this -> initByDatas ( $ result ) -> filter ( $ isChangedFilterCallback ) -> each ( function ( $ entity ) { $ entity -> startDataInitialStore ( ) ; } ) ; // add records from child tables if they exist if ( $ source & self :: WITH_CHILDREN ) { foreach ( $ this -> children as $ child ) { $ childRepo = $ this -> entityManager -> getRepository ( $ child ) ; $ output -> add ( $ childRepo -> findByFilterComponentsDatabase ( $ filterComponents , $ source ) ) ; } } return $ output ; }
Find a entity having been passed the filters.

@param array $filterComponents
@return Base|Container
Find a entity having been passed the filters .