Comments (5)
@wughvor can you give more context, show some code?
from mongodm.
@jrschumacher hi, I use mongodm in Phalcon:
// User.php
class User extends \Purekid\Mongodm
{
static public $collection = 'user';
protected static $attrs = array(
'name' => array('type' = 'string'),
);
}
class UserManager
{
public function create()
{
$user = new User();
$user->name = 'somebody';
$user->save();
}
}
// IndexController.php
class IndexController extends \Phalcon\Mvc\Controller
{
public function indexAction()
{
$user = new User();
$user->name = 'somebody';
$user->save(); // This is ok, will save the somebody user in mongo
}
public function createAction()
{
$userManager = new UserManager();
$userManager->create(); // This is fail, and error like "Argument 2 passed to Purekid\Mongodm\MongoDB::__construct() must be of the type array, null given, called" will show.
}
}
I want to use some middle class to manage the models, like UserManager, but it' will show error message when create the UserManager in Controller.
This is my question, Thank you
from mongodm.
How are you setting up the database? https://github.com/purekid/mongodm/blob/master/README.md#setup-database
from mongodm.
@purekid , Thank you!!, I resolve this question by your suggestion. also thanks you, @jrschumacher
from mongodm.
@purekid , Thank you!!, I resolve this question by your suggestion. also thanks you, @jrschumacher
from mongodm.
Related Issues (20)
- Embedding: where's the id of the embedded object? HOT 4
- unsupported for Latest extension 'MongoDB'
- Remove _id dependancy of MongoId
- Model (with Reference to Json) HOT 3
- Edit and object HOT 2
- Add Late Static Binding and fix some methods call (i.e. static instead of self) HOT 1
- Geolocation data handling
- Inconsistent behavior when Mongo is not running HOT 3
- mongo transaction HOT 1
- Method conflicts with magic methods
- slow to update HOT 1
- is this Compatibled with mongodb 3.0+? HOT 2
- any examples with gridfs?
- PHP 7 support? HOT 2
- MongoDB extension?
- Regex query is not working. HOT 1
- Error in example
- Unit tests support
- MongoDM not fully support PHP 7.1/PHP 7.2/PHP7.0 for find() function
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mongodm.