Jarves\Configuration\Bundle::getPropertyFilePath PHP Method

getPropertyFilePath() public method

public getPropertyFilePath ( $property )
    public function getPropertyFilePath($property)
    {
        if (!isset($this->imported[$property])) {
            $path = $this->getBundleClass()->getPath() . '/Resources/config/' . (@static::$propertyToFile[$property] ?: 'jarves.xml');
            $root = realpath($this->getJarves()->getRootDir() . '/../');
            return substr($path, strlen($root) + 1);
        } else {
            return $this->imported[$property];
        }
    }

Usage Example

コード例 #1
0
    /**
     * @param Bundle $bundle
     * @param $property
     * @return bool
     */
    public function saveFileBased(Bundle $bundle, $property)
    {
        $xml = $bundle->exportFileBased($property);
        $xmlFile = $bundle->getPropertyFilePath($property);
        $emptyXml = '<config>
  <bundle/>
</config>';
        if ($xml == $emptyXml) {
            if ($this->localFilesystem->has($xmlFile)) {
                return $this->localFilesystem->delete($xmlFile);
            } else {
                return true;
            }
        } else {
            return $this->localFilesystem->write($xmlFile, $xml);
        }
    }