Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace FrontEndBundleEntity;
- use DoctrineORMMapping as ORM;
- /**
- * MarcaAuto
- *
- * @ORMTable(name="marcas_auto")
- * @ORMEntity(repositoryClass="FrontEndBundleRepositoryMarcaAutoRepository")
- */
- class MarcaAuto
- {
- /**
- * @var int
- *
- * @ORMColumn(name="id", type="integer")
- * @ORMId
- * @ORMGeneratedValue(strategy="AUTO")
- * @ORMOneToMany(targetEntity="ModeloAuto", mappedBy="idMarca")
- */
- private $id;
- /**
- * @ORMColumn(type="string", length=100)
- */
- private $marca;
- <?php
- namespace FrontEndBundleEntity;
- use DoctrineORMMapping as ORM;
- /**
- * ModeloAuto
- *
- * @ORMTable(name="modelos_auto")
- * @ORMEntity(repositoryClass="FrontEndBundleRepositoryModeloAutoRepository")
- */
- class ModeloAuto {
- /**
- * @var int
- *
- * @ORMColumn(name="id", type="integer")
- * @ORMId
- * @ORMGeneratedValue(strategy="AUTO")
- */
- private $id;
- /**
- * @var int
- * @ORMColumn(name="id_marca", type="integer")
- * @ORMManyToOne(targetEntity="MarcaAuto", inversedBy="id")
- * @ORMJoinColumn(name="id_marca", referencedColumnName="id")
- */
- private $idMarca;
- $em = $this->getDoctrine()->getManager();
- $query = $em->createQuery(
- 'SELECT a
- FROM FrontEndBundle:MarcaAuto a
- LEFT JOIN a.id
- ORDER BY a.marca ASC'
- );
- $marcasVehiculos = $query->getResult();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement