spotorm / spot2

Spot v2.x DataMapper built on top of Doctrine's Database Abstraction Layer
http://phpdatamapper.com
BSD 3-Clause "New" or "Revised" License
601 stars 101 forks source link

Catchable fatal error: Argument 1 passed to Spot\Mapper::__construct() #212

Closed flik closed 7 years ago

flik commented 7 years ago

I have a table scrapped in my database.

$spot = new \Spot\Mapper(); $tableMapper = $spot->mapper('Entity\Scrapped'); var_dump($tableMapper);

Catchable fatal error: Argument 1 passed to Spot\Mapper::__construct() must be an instance of Spot\Locator, none given, called in C:\xampp\htdocs\scrapped\index.php on line 24 and defined in C:\xampp\htdocs\scrapped\vendor\vlucas\spot2\lib\Mapper.php on line 33

FlipEverything commented 7 years ago

I have to say that you're doing it wrong. That's not how spot works. You can find everything about the first steps of using spot on the website:

Step 1. http://phpdatamapper.com/docs/database-setup/ Step 2. http://phpdatamapper.com/docs/mappers/ Step 3. http://phpdatamapper.com/docs/entities/ Step 4. http://phpdatamapper.com/docs/crud/

Have a nice day! If your issue is resolved please close it.