public function listColumns()
    {
        if (!is_null($this->listColumns)) {
            return $this->listColumns;
        }

        // We use this method to load the annotation classes, because the annotation Library Doctrine does not
        AnnotationManager::autoLoadAnnotation();

        // Set the list of properties, an array to contain the list of columns and a boolean to check if the class has several indexes
        $properties = $this->reflection->getProperties();
        $haveIndex = false;
        $columns = array();

        foreach ($properties as $property) {
            // For each properties, get the list of annotations
            $propertyAnnotation = $this->annotationReader->getPropertyAnnotations($property);
            // Check the property has a Column Annotation
            if (($columnAnnotation = self::haveAnnotation(self::$ColumnAnnotation, $propertyAnnotation)) !== false) {
                $columnAnnotation->check();
                $column = array(
                    'type' => $columnAnnotation->type,
                    'strict' => $columnAnnotation->strict
                );
                // Check the property has an Index Annotation
                if (($indexAnnotation = self::haveAnnotation(self::$IndexAnnotation, $propertyAnnotation)) !== false) {
                    $indexAnnotation->check();
                    // Verify that the class have a unique index annotation
                    if ($haveIndex == true) {
                        throw new InvalidAnnotationException($indexAnnotation, $property->getName(), 'Class ' . $this->className . ' have already an index when he read the annotation of ' . $property->getName());
                    }
                    $column['index'] = true;
                    $haveIndex = true;
                } else {
                    $column['index'] = false;
                }

                // If is an entity Column, check entityRelationAnnotation
                if ($column['type'] == 'entity') {
                    if (($relationAnnotation = self::haveAnnotation(self::$entityRelationAnnotation, $propertyAnnotation)) !== false) {
                        $relationAnnotation->check();
                        try {
                            $annotationClassOfRelation = EntityAnalyzer::get($relationAnnotation->classname)->getClassAnnotation();
                        } catch (InvalidEntityException $e) {
                            throw new InvalidAnnotationException($relationAnnotation, 'classname', 'The class ' . $relationAnnotation->classname . ' is not an Entity');
                        }

                        $column['relation'] = array(
                            'classname' => $relationAnnotation->classname,
                            'multi' => $relationAnnotation->multi,
                            'ignore_errors' => $relationAnnotation->ignore_errors
                        );
                    } else {
                        throw new InvalidAnnotationException(null, null, 'A Entity Column must have a EntityRelation annotations');
                    }
                }

                $columns[$property->getName()] = $column;
            }
        }

        $this->listColumns = $columns;
        return $columns;
    }
public function listColumns()
    {
        if (!is_null($this->listColumns)) {
            return $this->listColumns;
        }

        // We use this method to load the annotation classes, because the annotation Library Doctrine does not
        AnnotationManager::autoLoadAnnotation();

        // Set the list of properties, an array to contain the list of columns and a boolean to check if the class has several indexes
        $properties = $this->reflection->getProperties();
        $haveIndex = false;
        $columns = array();

        foreach ($properties as $property) {
            // For each properties, get the list of annotations
            $propertyAnnotation = $this->annotationReader->getPropertyAnnotations($property);
            // Check the property has a Column Annotation
            if (($columnAnnotation = self::haveAnnotation(self::$ColumnAnnotation, $propertyAnnotation)) !== false) {
                $columnAnnotation->check();
                $column = array(
                    'type' => $columnAnnotation->type,
                    'strict' => $columnAnnotation->strict
                );
                // Check the property has an Index Annotation
                if (($indexAnnotation = self::haveAnnotation(self::$IndexAnnotation, $propertyAnnotation)) !== false) {
                    $indexAnnotation->check();
                    // Verify that the class have a unique index annotation
                    if ($haveIndex == true) {
                        throw new InvalidAnnotationException($indexAnnotation, $property->getName(), 'Class ' . $this->className . ' have already an index when he read the annotation of ' . $property->getName());
                    }
                    $column['index'] = true;
                    $haveIndex = true;
                } else {
                    $column['index'] = false;
                }

                // If is an entity Column, check entityRelationAnnotation
                if ($column['type'] == 'entity') {
                    if (($relationAnnotation = self::haveAnnotation(self::$entityRelationAnnotation, $propertyAnnotation)) !== false) {
                        $relationAnnotation->check();
                        try {
                            $annotationClassOfRelation = EntityAnalyzer::get($relationAnnotation->classname)->getClassAnnotation();
                        } catch (InvalidEntityException $e) {
                            throw new InvalidAnnotationException($relationAnnotation, 'classname', 'The class ' . $relationAnnotation->classname . ' is not an Entity');
                        }

                        $column['relation'] = array(
                            'classname' => $relationAnnotation->classname,
                            'multi' => $relationAnnotation->multi,
                            'ignore_errors' => $relationAnnotation->ignore_errors
                        );
                    } else {
                        throw new InvalidAnnotationException(null, null, 'A Entity Column must have a EntityRelation annotations');
                    }
                }

                $columns[$property->getName()] = $column;
            }
        }

        $this->listColumns = $columns;
        return $columns;
    }
public function listColumns ( ) { if ( ! is_null ( $ this -> listColumns ) ) { return $ this -> listColumns ; } // We use this method to load the annotation classes, because the annotation Library Doctrine does not AnnotationManager :: autoLoadAnnotation ( ) ; // Set the list of properties, an array to contain the list of columns and a boolean to check if the class has several indexes $ properties = $ this -> reflection -> getProperties ( ) ; $ haveIndex = false ; $ columns = array ( ) ; foreach ( $ properties as $ property ) { // For each properties, get the list of annotations $ propertyAnnotation = $ this -> annotationReader -> getPropertyAnnotations ( $ property ) ; // Check the property has a Column Annotation if ( ( $ columnAnnotation = self :: haveAnnotation ( self :: $ ColumnAnnotation , $ propertyAnnotation ) ) !== false ) { $ columnAnnotation -> check ( ) ; $ column = array ( 'type' => $ columnAnnotation -> type , 'strict' => $ columnAnnotation -> strict ) ; // Check the property has an Index Annotation if ( ( $ indexAnnotation = self :: haveAnnotation ( self :: $ IndexAnnotation , $ propertyAnnotation ) ) !== false ) { $ indexAnnotation -> check ( ) ; // Verify that the class have a unique index annotation if ( $ haveIndex == true ) { throw new InvalidAnnotationException ( $ indexAnnotation , $ property -> getName ( ) , 'Class ' . $ this -> className . ' have already an index when he read the annotation of ' . $ property -> getName ( ) ) ; } $ column [ 'index' ] = true ; $ haveIndex = true ; } else { $ column [ 'index' ] = false ; } // If is an entity Column, check entityRelationAnnotation if ( $ column [ 'type' ] == 'entity' ) { if ( ( $ relationAnnotation = self :: haveAnnotation ( self :: $ entityRelationAnnotation , $ propertyAnnotation ) ) !== false ) { $ relationAnnotation -> check ( ) ; try { $ annotationClassOfRelation = EntityAnalyzer :: get ( $ relationAnnotation -> classname ) -> getClassAnnotation ( ) ; } catch ( InvalidEntityException $ e ) { throw new InvalidAnnotationException ( $ relationAnnotation , 'classname' , 'The class ' . $ relationAnnotation -> classname . ' is not an Entity' ) ; } $ column [ 'relation' ] = array ( 'classname' => $ relationAnnotation -> classname , 'multi' => $ relationAnnotation -> multi , 'ignore_errors' => $ relationAnnotation -> ignore_errors ) ; } else { throw new InvalidAnnotationException ( null , null , 'A Entity Column must have a EntityRelation annotations' ) ; } } $ columns [ $ property -> getName ( ) ] = $ column ; } } $ this -> listColumns = $ columns ; return $ columns ; }
List the Ldap Columns of an Entity Class
@return array
@throws \OpenLdapObject\Annotations\InvalidAnnotationException
List the Ldap Columns of an Entity Class