src/xPDO/xPDO.php
public function newObject($className, $fields= array ()) {
        $instance= null;
        if ($className = $this->loadClass($className)) {
            $className = self::getPlatformClass($className);
            /** @var Om\xPDOObject $instance */
            if ($instance = new $className($this)) {
                if (is_array($fields) && !empty($fields)) {
                    $instance->fromArray($fields);
                }
            }
        }
        return $instance;
    }
public function newObject($className, $fields= array ()) {
        $instance= null;
        if ($className = $this->loadClass($className)) {
            $className = self::getPlatformClass($className);
            /** @var Om\xPDOObject $instance */
            if ($instance = new $className($this)) {
                if (is_array($fields) && !empty($fields)) {
                    $instance->fromArray($fields);
                }
            }
        }
        return $instance;
    }
public function newObject ( $ className , $ fields = array ( ) ) { $ instance = null ; if ( $ className = $ this -> loadClass ( $ className ) ) { $ className = self :: getPlatformClass ( $ className ) ; /** @var Om\xPDOObject $instance */ if ( $ instance = new $ className ( $ this ) ) { if ( is_array ( $ fields ) && ! empty ( $ fields ) ) { $ instance -> fromArray ( $ fields ) ; } } } return $ instance ; }
Creates a new instance of a specified class.

All new objects created with this method are transient until {@link
xPDOObject::save()} is called the first time and is reflected by the
{@link xPDOObject::$_new} property.

@param string $className Name of the class to get a new instance of.
@param array $fields An associated array of field names/values to
populate the object with.
@return Om\xPDOObject|null A new instance of the specified class, or null if a
new object could not be instantiated.
Creates a new instance of a specified class .