/** * Creates a new Managed Object instance with the class type specified by the entity * * This creates a new instance of an MManagedObject subclass specified in entity, * inserts it into this context and returns it. * * @param MEntityDescription $entity The entity to create a new instance of * @param int $objectID An optional ID to use for the object. This should only * be used when manullay constructing a representation of the object from the * data store. * * @return MManagedObject The new MManagedObject subclass instance */ public function newObjectForEntity(MEntityDescription $entity, $objectID = MManagedObject::UNKNOWN_ID) { MAssertTypes('int', $objectID); return MObject::newInstanceOfClassWithParameters($entity->entityClassName(), A(array($entity, $this, $objectID))); }