Neos\Flow\Reflection\ReflectionService::isPropertyPrivate PHP Метод

isPropertyPrivate() публичный Метод

Tells if the specified property is private
public isPropertyPrivate ( string $className, string $propertyName ) : boolean
$className string Name of the class containing the method
$propertyName string Name of the property to analyze
Результат boolean TRUE if the property is private, otherwise FALSE
    public function isPropertyPrivate($className, $propertyName)
    {
        $className = $this->prepareClassReflectionForUsage($className);
        return isset($this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName][self::DATA_PROPERTY_VISIBILITY]) && $this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName][self::DATA_PROPERTY_VISIBILITY] === self::VISIBILITY_PRIVATE;
    }

Usage Example

 /**
  * After returning advice, generates the value hash for the object
  *
  * @param JoinPointInterface $joinPoint The current join point
  * @return void
  * @Flow\After("Neos\Flow\Persistence\Aspect\PersistenceMagicAspect->isNonEmbeddedValueObject && method(.*->__construct()) && filter(Neos\Flow\Persistence\Doctrine\Mapping\Driver\FlowAnnotationDriver)")
  */
 public function generateValueHash(JoinPointInterface $joinPoint)
 {
     $proxy = $joinPoint->getProxy();
     $proxyClassName = get_class($proxy);
     $hashSourceParts = [];
     $classSchema = $this->reflectionService->getClassSchema($proxyClassName);
     foreach ($classSchema->getProperties() as $property => $propertySchema) {
         // Currently, private properties are transient. Should this behaviour change, they need to be included
         // in the value hash generation
         if ($classSchema->isPropertyTransient($property) || $this->reflectionService->isPropertyPrivate($proxyClassName, $property)) {
             continue;
         }
         $propertyValue = ObjectAccess::getProperty($proxy, $property, true);
         if (is_object($propertyValue) === true) {
             // The persistence manager will return NULL if the given object is unknown to persistence
             $propertyValue = $this->persistenceManager->getIdentifierByObject($propertyValue) ?: $propertyValue;
         }
         $hashSourceParts[$property] = $propertyValue;
     }
     ksort($hashSourceParts);
     $hashSourceParts['__class_name__'] = $proxyClassName;
     $serializedSource = $this->useIgBinary === true ? igbinary_serialize($hashSourceParts) : serialize($hashSourceParts);
     $proxy = $joinPoint->getProxy();
     ObjectAccess::setProperty($proxy, 'Persistence_Object_Identifier', sha1($serializedSource), true);
 }
All Usage Examples Of Neos\Flow\Reflection\ReflectionService::isPropertyPrivate
ReflectionService