1. Go to this page and download the library: Download devsdmf/datamonkey library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
devsdmf / datamonkey example snippets
namespace Vendor\Package;
use DataMonkey\Entity\ExportableEntity;
use DataMonkey\Entity\ExportAbstract;
class MyEntity extends ExportAbstract implements ExportableEntity
{
/**
* @pk
* @db_ref id_entity
* @strategy auto
*/
public $id = null;
/**
* @db_ref foo_column
*/
public $foo = null;
}
namespace Vendor\Package;
use DataMonkey\Entity\Factory\AbstractFactory;
use Vendor\Package\MyEntity;
class MyFactory extends AbstractFactory
{
public function create($options = null)
{
return MyEntity::factory($options);
}
}
namespace Vendor\Package;
use DataMonkey\Repository\Repository;
class MyRepository extends Repository
{
protected $_name = 'mytable';
}
use Vendor\Package\MyEntity;
use Vendor\Package\MyFactory;
use Vendor\Package\MyRepository;
// Configure your doctrine DBAL connection
$connection = new \Doctrine\DBAL\Connection(...);
$entity = new MyEntity();
$entity->foo = 'bar';
$repo = new MyRepository($connection, new MyFactory());
$repo->save($entity);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.