/**
  * {@inheritDoc}
  */
 public function injectFile($obj, PropertyMapping $mapping)
 {
     $path = $this->storage->resolvePath($obj, $mapping->getFilePropertyName());
     if ($path !== null) {
         $mapping->setFile($obj, new File($path, false));
     }
 }
 /**
  * {@inheritDoc}
  */
 public function injectFiles($obj)
 {
     $mappings = $this->factory->fromObject($obj);
     foreach ($mappings as $mapping) {
         if ($mapping->getInjectOnLoad()) {
             $field = $mapping->getProperty()->getName();
             try {
                 $path = $this->storage->resolvePath($obj, $field);
             } catch (\InvalidArgumentException $e) {
                 continue;
             }
             $mapping->getProperty()->setValue($obj, new File($path, false));
         }
     }
 }
 /**
  * Gets the public path for the file associated with the
  * object.
  * 
  * @param object $obj The object.
  * @param string $field The field.
  * @return string The public asset path.
  */
 public function asset($obj, $field)
 {
     $path = $this->storage->resolvePath($obj, $field);
     $index = strpos($path, $this->webDirName);
     return substr($path, $index + strlen($this->webDirName));
 }