1. Go to this page and download the library: Download vincentchalamon/nav-bundle 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/ */
vincentchalamon / nav-bundle example snippets
namespace App\Entity;
use NavBundle\Annotation as Nav;
/**
* @Nav\Entity(namespace="Contact")
*/
final class Contact
{
/**
* @Nav\Column
* @Nav\Key
*/
public $key;
/**
* @Nav\Column
* @Nav\No
*/
public $no;
/**
* @Nav\Column(name="Custom_Email", nullable=true)
*/
public $email;
/**
* @Nav\Column(type="date", nullable=true)
*/
public $date;
/**
* @Nav\ManyToOne(targetClass=Foo::class)
*/
public $foo;
}
/** @var \NavBundle\RegistryInterface $registry */
$registry = $container->get('nav.registry');
$manager = $registry->getManagerForClass(Contact::class);
$repository = $manager->getRepository(Contact::class);
// Find entity by primary key
$repository->find($no);
// Find collection by a set of criteria
$repository->findBy(['foo' => 'bar']);
// Find entity by a set of criteria
$repository->findOneBy(['foo' => 'bar']);
// Find all
$repository->findAll();
/** @var \NavBundle\RegistryInterface $registry */
$registry = $container->get('nav.registry');
$manager = $registry->getManagerForClass(Contact::class);
// Create/Update
$manager->persist($object);
// Delete
$manager->remove($object);
// Flush
$manager->flush();
// It's also possible to flush an object or an array of objects
$manager->flush($object);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.