Skip to content
This repository has been archived by the owner on Jun 11, 2021. It is now read-only.

I can's save document in document set #5

Closed
SvetlovD opened this issue Jun 13, 2010 · 3 comments
Closed

I can's save document in document set #5

SvetlovD opened this issue Jun 13, 2010 · 3 comments

Comments

@SvetlovD
Copy link

Hi!

I write this code:
class Application_Model_User extends Shanty_Mongo_Document
{
protected static $_dbName = 'fin';
protected static $_collectionName = 'user';

 protected $_requirements = array(
    'once' => 'DocumentSet',
    'weekly' => 'DocumentSet',
    'monthly' => 'DocumentSet');

}

And this:
$amount = $this->user->once->new();
$amount->name = 'blah-blah';
$amount->save();

When I execute this code i have an error:
"Shanty_Mongo_Document::$_dbName is null."

@coen-hyde
Copy link
Owner

Hi SvetlovD,

Yes this is a bug, it has been fixed in my working code and will most likely be up on github in a day or two along with a bunch of other fixes.

As a temporary work around you can create a custom document set class for each document set and fill in the $_dbName eg

class Once extends Shanty_Mongo_DocumentSet
{
protected static $_dbName = 'fin';
}

Then set the requirements for 'once' to 'DocumentSet:Once'

Cheers,
Coen

@SvetlovD
Copy link
Author

Thank you very match, Coen.

Waiting for your commits.

@coen-hyde
Copy link
Owner

New version is up. Lots of bug fixes! Just be aware that $_dbName and $_collectionName have been renamed to $_db and $_collection. As well as $_requirements has now become a static property.

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants